The Transformation class gives you access to define transform cards in PRIMER. More...
The PRIMER JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
| Name | Type | Description |
| exists (read only) | logical | true if transformation exists, false if referred to but not defined. |
| include | integer | The Include file number that the transformation is in. |
| label | integer | Transformation number. Also see the tranid property which is an alternative name for this. |
| model (read only) | integer | The Model number that the transformation is in. |
| nrow (read only) | integer | Number of rows of transformations |
| title | string | The title for the transformation. |
| tranid | integer | Transformation number. Also see the label property which is an alternative name for this. |
Detailed DescriptionThe Transformation class allows you to create, modify, edit and manipulate define transformation cards. See the documentation below for more details. |
Constructornew Transformation(Model[Model], tranid[integer], title (optional)[string])DescriptionCreate a new Transformation object. |
Model that transformation will be created in
Transformation label
Transformation title
ReturnsTransformation object Return typeTransformation |
ExampleTo create a new transformation in model m with label 1000 and title "Example transform" var t = new Transformation(m, 1000, "Example transform");
|
Details of functionsAddRow(data[Array of data], row (optional)[integer])DescriptionAdds a row of data for a *DEFINE_TRANSFORMATION. |
The data you want to add
The row you want to add the data at. Existing transforms will be shifted. If omitted the data will be added to the end of the existing transforms. Note that row indices start at 0.
ReturnsNo return value. |
ExampleTo add a translation of (0, 0, 100) to transformation t: var array = ["TRANSL", 0, 0, 100]; t.AddRow(array);
|
AssociateComment(Comment[Comment])DescriptionAssociates a comment with a transformation. |
Comment that will be attached to the transformation
ReturnsNo return value |
ExampleTo associate comment c to the transformation t: t.AssociateComment(c);
|
Browse(modal (optional)[boolean])DescriptionStarts an edit panel in Browse mode. |
If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal.
Returnsno return value |
ExampleTo Browse transformation t: t.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the transformation. |
Flag to clear on the transformation
ReturnsNo return value |
ExampleTo clear flag f for transformation t: t.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the transformation. The target include of the copied transformation can be set using Options.copy_target_include. |
If you want to keep the copied item in the range specified for the current include. Default value is false. To set current include, use Include.MakeCurrentLayer().
ReturnsTransformation object Return typeTransformation |
ExampleTo copy transformation t into transformation z: var z = t.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a transformation |
Model that the transformation will be created in.
If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal.
ReturnsTransformation object (or null if not made). Return typeTransformation |
ExampleTo start creating a transformation in model m: var t = Transformation.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a transformation. |
Comment that will be detached from the transformation
ReturnsNo return value |
ExampleTo detach comment c from the transformation t: t.DetachComment(c);
|
Edit(modal (optional)[boolean])DescriptionStarts an interactive editing panel. |
If this window is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the window will be modal.
Returnsno return value |
ExampleTo Edit transformation t: t.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for transformation. For more details on checking see the Check class. |
The error message to give
An optional detailed error message
ReturnsNo return value |
ExampleTo add an error message "My custom error" for transformation t: t.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first transformation in the model. |
Model to get first transformation in
ReturnsTransformation object (or null if there are no transformations in the model). Return typeTransformation |
ExampleTo get the first transformation in model m: var t = Transformation.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free transformation label in the model. Also see Transformation.LastFreeLabel(), Transformation.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free transformation label in
Include file (0 for the main file) to search for labels in (Equivalent to First free in layer in editing panels). If omitted the whole model will be used (Equivalent to First free in editing panels).
ReturnsTransformation label. Return typeNumber |
ExampleTo get the first free transformation label in model m: var label = Transformation.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the transformations in the model with a defined flag. |
Model that all transformations will be flagged in
Flag to set on the transformations
ReturnsNo return value |
ExampleTo flag all of the transformations with flag f in model m: Transformation.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the transformation is flagged or not. |
Flag to test on the transformation
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if transformation t has flag f set on it: if (t.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each transformation in the model. |
Model that all transformations are in
Function to call for each transformation
An optional extra object/array/string etc that will appended to arguments when calling the function
ReturnsNo return value |
GetAll(Model[Model], property (optional)[string]) [static]DescriptionReturns an array of Transformation objects or properties for all of the transformations in a model in PRIMER. If the optional property argument is not given then an array of Transformation objects is returned. If the property argument is given, that property value for each transformation is returned in the array instead of a Transformation object |
Model to get transformations from
Name for property to get for all transformations in the model
ReturnsArray of Transformation objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a transformation. |
No arguments
ReturnsArray of Comment objects (or null if there are no comments associated to the node). Return typeArray |
ExampleTo get the array of comments associated to the transformation t: var comm_array = t.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Transformation objects for all of the flagged transformations in a model in PRIMER If the optional property argument is not given then an array of Transformation objects is returned. If the property argument is given, then that property value for each transformation is returned in the array instead of a Transformation object |
Model to get transformations from
Flag set on the transformations that you want to retrieve
Name for property to get for all flagged transformations in the model
ReturnsArray of Transformation objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Transformation object for a transformation ID. |
Model to find the transformation in
number of the transformation you want the Transformation object for
ReturnsTransformation object (or null if transformation does not exist). Return typeTransformation |
ExampleTo get the Transformation object for transformation 100 in model m var t = Transformation.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a Transformation property is a parameter or not. Note that object properties that are parameters are normally returned as the integer or float parameter values as that is virtually always what the user would want. For this function to work the JavaScript interpreter must use the parameter name instead of the value. This can be done by setting the Options.property_parameter_names option to true before calling the function and then resetting it to false afterwards.. This behaviour can also temporarily be switched by using the Transformation.ViewParameters() method and 'method chaining' (see the examples below). |
transformation property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
GetRow(row[integer])DescriptionReturns the data for a row in the transformation. |
The row you want the data for. Note row indices start at 0.
ReturnsAn array of numbers containing the row variables. Return typeNumber |
ExampleTo get the data for the 2nd row in transformation t: var data = t.GetRow(1);
|
Keyword()DescriptionReturns the keyword for this transformation. Note that a carriage return is not added. See also Transformation.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for transformation t: var key = t.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the transformation. Note that a carriage return is not added. See also Transformation.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for transformation i: var cards = i.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last transformation in the model. |
Model to get last transformation in
ReturnsTransformation object (or null if there are no transformations in the model). Return typeTransformation |
ExampleTo get the last transformation in model m: var t = Transformation.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free transformation label in the model. Also see Transformation.FirstFreeLabel(), Transformation.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free transformation label in
Include file (0 for the main file) to search for labels in (Equivalent to Highest free in layer in editing panels). If omitted the whole model will be used.
ReturnsTransformation label. Return typeNumber |
ExampleTo get the last free transformation label in model m: var label = Transformation.LastFreeLabel(m);
|
Next()DescriptionReturns the next transformation in the model. |
No arguments
ReturnsTransformation object (or null if there are no more transformations in the model). Return typeTransformation |
ExampleTo get the transformation in model m after transformation t: var t = t.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) transformation label in the model. Also see Transformation.FirstFreeLabel(), Transformation.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free transformation label in
Include file (0 for the main file) to search for labels in (Equivalent to Highest+1 in layer in editing panels). If omitted the whole model will be used (Equivalent to Highest+1 in editing panels).
ReturnsTransformation label. Return typeNumber |
ExampleTo get the next free transformation label in model m: var label = Transformation.NextFreeLabel(m);
|
Previous()DescriptionReturns the previous transformation in the model. |
No arguments
ReturnsTransformation object (or null if there are no more transformations in the model). Return typeTransformation |
ExampleTo get the transformation in model m before transformation t: var t = t.Previous();
|
RemoveRow(row[integer])DescriptionRemoves the data for a row in *DEFINE_TRANSFORMATION. |
The row you want to remove the data for. Note that row indices start at 0.
ReturnsNo return value. |
ExampleTo remove the second row of data for transformation t: t.RemoveRow(1);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select transformations using standard PRIMER object menus. |
Flag to use when selecting transformations
Text to display as a prompt to the user
If the argument is a Model then only transformations from that model can be selected. If the argument is a Flag then only transformations that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any transformations can be selected. from any model.
If selection is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the selection will be modal.
ReturnsNumber of transformations selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the transformation. |
Flag to set on the transformation
ReturnsNo return value |
ExampleTo set flag f for transformation t: t.SetFlag(f);
|
SetRow(row[integer], data[Array of data])DescriptionSets the data for a row in *DEFINE_TRANSFORMATION. |
The row you want to set the data for. Note that row indices start at 0.
The data you want to set the row to
ReturnsNo return value. |
ExampleTo set the second row of data for transformation t to be a translation of (0, 0, 100): var array = ["TRANSL", 0, 0, 100]; t.SetRow(1, array);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of transformations in the model. |
Model to get total for
true if only existing transformations should be counted. If false or omitted referenced but undefined transformations will also be included in the total.
Returnsnumber of transformations Return typeNumber |
ExampleTo get the total number of transformations in model m: var total = Transformation.Total(m);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the transformations in the model. |
Model that the defined flag for all transformations will be unset in
Flag to unset on the transformations
ReturnsNo return value |
ExampleTo unset the flag f on all the transformations in model m: Transformation.UnflagAll(m, f);
|
No arguments
ReturnsTransformation object. Return typeTransformation |
ExampleTo check if Transformation property t.example is a parameter by using the Transformation.GetParameter() method: if (t.ViewParameters().GetParameter(t.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for transformation. For more details on checking see the Check class. |
The warning message to give
An optional detailed warning message
ReturnsNo return value |
ExampleTo add a warning message "My custom warning" for transformation t: t.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this transformation. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for transformation t: var xrefs = t.Xrefs();
|
toString()DescriptionCreates a string containing the transformation data in keyword format. Note that this contains the keyword header and the keyword cards. See also Transformation.Keyword() and Transformation.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for transformation t in keyword format var s = t.toString();
|