The Dummy class gives you access to dummy 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 |
| assemblies (read only) | integer | Number of assemblies defined. |
| exists (read only) | logical | true if dummy exists, false if referred to but not defined. |
| id (read only) | integer | Dummy number. Also see the label property which is an alternative name for this. |
| include | integer | The Include file number that the dummy is in. |
| label (read only) | integer | Dummy number. Also see the id property which is an alternative name for this. |
| model (read only) | integer | The Model number that the dummy is in. |
| points (read only) | integer | Number of reference points defined. |
| title | string | Dummy title. |
| xhpoint (read only) | real | H-Point X coordinate. |
| yhpoint (read only) | real | H-Point Y coordinate. |
| zhpoint (read only) | real | H-Point Z coordinate. |
Detailed DescriptionThe Dummy class allows you to create, modify, edit and manipulate dummy cards. See the documentation below for more details. |
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a dummy. |
Comment that will be attached to the dummy
ReturnsNo return value |
ExampleTo associate comment c to the dummy d: d.AssociateComment(c);
|
Blank()DescriptionBlanks the dummy |
No arguments
ReturnsNo return value |
ExampleTo blank dummy d: d.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the dummies in the model. |
Model that all dummies will be blanked in
If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().
ReturnsNo return value |
ExampleTo blank all of the dummies in model m: Dummy.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged dummies in the model. |
Model that all the flagged dummies will be blanked in
Flag set on the dummies that you want to blank
If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().
ReturnsNo return value |
ExampleTo blank all of the dummies in model m flagged with f: Dummy.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the dummy is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if dummy d is blanked: if (d.Blanked() ) do_something...
|
ClearFlag(flag[Flag])DescriptionClears a flag on the dummy. |
Flag to clear on the dummy
ReturnsNo return value |
ExampleTo clear flag f for dummy d: d.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the dummy. The target include of the copied dummy 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().
ReturnsDummy object Return typeDummy |
ExampleTo copy dummy d into dummy z: var z = d.Copy();
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a dummy. |
Comment that will be detached from the dummy
ReturnsNo return value |
ExampleTo detach comment c from the dummy d: d.DetachComment(c);
|
Error(message[string], details (optional)[string])DescriptionAdds an error for dummy. 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 dummy d: d.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first dummy in the model. |
Model to get first dummy in
ReturnsDummy object (or null if there are no dummies in the model). Return typeDummy |
ExampleTo get the first dummy in model m: var d = Dummy.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free dummy label in the model. Also see Dummy.LastFreeLabel(), Dummy.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free dummy 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).
ReturnsDummy label. Return typeNumber |
ExampleTo get the first free dummy label in model m: var label = Dummy.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the dummies in the model with a defined flag. |
Model that all dummies will be flagged in
Flag to set on the dummies
ReturnsNo return value |
ExampleTo flag all of the dummies with flag f in model m: Dummy.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the dummy is flagged or not. |
Flag to test on the dummy
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if dummy d has flag f set on it: if (d.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each dummy in the model. |
Model that all dummies are in
Function to call for each dummy
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 Dummy objects or properties for all of the dummies in a model in PRIMER. If the optional property argument is not given then an array of Dummy objects is returned. If the property argument is given, that property value for each dummy is returned in the array instead of a Dummy object |
Model to get dummies from
Name for property to get for all dummies in the model
ReturnsArray of Dummy objects or properties Return typeArray |
GetAssembly(index[integer])DescriptionReturns the information for an assembly |
The index of the assembly you want the coordinates for. Note that reference points start at 0, not 1. 0 <= index < assemblies
Returns |
Object with the following properties:
| Name | Type | Description |
| label | integer | Assembly label |
| parent | integer | Parent assembly label |
| title | string | Assembly title |
object
ExampleTo get the information for the 3rd assembly for dummy d: var info = d.GetAssembly(2);
|
GetAssemblyChildInfo(label[integer], index[integer])DescriptionGet information about a child assembly from its parent assembly. |
The label of the parent assembly.
index of the child (start with 0 till n-1, where n is total number of child).
Returns |
Object with the following properties:
| Name | Type | Description |
| dof_code | integer | Degree of freedom codes |
| joint_stiff | integer | Constrained joint stiffness label |
| label | integer | Label of the child assembly |
| node_a | integer | Node A label |
| node_b | integer | Node B label |
object
ExampleTo get the information of first child assembly for which index will be 0 (starts with 0) in the assembly with label = 2 for dummy d: var info = d.GetAssemblyChildInfo(2, 0);
|
GetAssemblyFromID(label[integer])DescriptionGet assembly information for a given assembly ID and returns an object containing the details. |
The label of the assembly you want the Assembly object for.
Returns |
Object with the following properties:
| Name | Type | Description |
| child (read only) | integer | Total number of child assembly(s). |
| exists (read only) | logical | true if assembly exists, false if not defined. |
| index | integer | Assembly index |
| label | integer | Assembly label |
| parent | integer | Parent assembly label |
| rx (read only) | real | x-angle of the assembly. |
| ry (read only) | real | y-angle of the assembly. |
| rz (read only) | real | z-angle of the assembly. |
| title | string | Assembly title |
object
ExampleTo get the information for the assembly with label = 2 for dummy d: var info = d.GetAssemblyFromID(2);
|
GetAssemblyPart(label[integer])DescriptionReturns an array of Part objects representing all the parts within the assembly. |
The label of the assembly.
ReturnsArray of Part objects Return typeArray |
ExampleTo get all the parts in the assembly with label = 2 for dummy d: var info = d.GetAssemblyPart(2);
|
GetComments()DescriptionExtracts the comments associated to a dummy. |
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 dummy d: var comm_array = d.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Dummy objects for all of the flagged dummies in a model in PRIMER If the optional property argument is not given then an array of Dummy objects is returned. If the property argument is given, then that property value for each dummy is returned in the array instead of a Dummy object |
Model to get dummies from
Flag set on the dummies that you want to retrieve
Name for property to get for all flagged dummies in the model
ReturnsArray of Dummy objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Dummy object for a dummy ID. |
Model to find the dummy in
number of the dummy you want the Dummy object for
ReturnsDummy object (or null if dummy does not exist). Return typeDummy |
ExampleTo get the Dummy object for dummy 100 in model m var d = Dummy.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a Dummy 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 Dummy.ViewParameters() method and 'method chaining' (see the examples below). |
dummy property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
GetPoint(index[integer])DescriptionReturns the information for a reference point |
The index of the reference point you want the information for. Note that reference points start at 0, not 1. 0 <= index < points
Returns |
Object with the following properties:
| Name | Type | Description |
| assembly | integer | Assembly label |
| csys | integer | Coordinate system |
| hpt | boolean | If point has been automatically created by PRIMER at the H-point |
| label | integer | Point label |
| node | integer | Node label (0 if coordinate) |
| rx | boolean | Point restrained rotationally in X |
| ry | boolean | Point restrained rotationally in Y |
| rz | boolean | Point restrained rotationally in Z |
| title | string | Point title |
| tx | boolean | Point restrained translationally in X |
| ty | boolean | Point restrained translationally in Y |
| tz | boolean | Point restrained translationally in Z |
| x | real | Node/point x coordinate |
| y | real | Node/point y coordinate |
| z | real | Node/point z coordinate |
object
ExampleTo get the information for the 3rd reference point for dummy d: var info = d.GetPoint(2);
|
GetPointData(rpt[integer])DescriptionReturns the coordinates of a reference point |
The reference point you want the coordinates for. Note that reference points start at 0, not 1.
ReturnsArray containing the reference point coordinates Return typeArray |
ExampleTo get the coordinates of the 3rd reference point for dummy d: var c = d.GetPointData(2);
|
GetPointTitle(rpt[integer])DescriptionReturns the title of a reference point |
The reference point you want the title for. Note that reference points start at 0, not 1.
ReturnsThe reference point title Return typeString |
ExampleTo get the title of the 3rd reference point for dummy d: var c = d.GetPointTitle(2);
|
Last(Model[Model]) [static]DescriptionReturns the last dummy in the model. |
Model to get last dummy in
ReturnsDummy object (or null if there are no dummies in the model). Return typeDummy |
ExampleTo get the last dummy in model m: var d = Dummy.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free dummy label in the model. Also see Dummy.FirstFreeLabel(), Dummy.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free dummy 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.
ReturnsDummy label. Return typeNumber |
ExampleTo get the last free dummy label in model m: var label = Dummy.LastFreeLabel(m);
|
Next()DescriptionReturns the next dummy in the model. |
No arguments
ReturnsDummy object (or null if there are no more dummies in the model). Return typeDummy |
ExampleTo get the dummy in model m after dummy d: var d = d.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) dummy label in the model. Also see Dummy.FirstFreeLabel(), Dummy.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free dummy 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).
ReturnsDummy label. Return typeNumber |
ExampleTo get the next free dummy label in model m: var label = Dummy.NextFreeLabel(m);
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a dummy. |
Text to display as a prompt to the user
If the argument is a Model then only dummies from that model can be picked. If the argument is a Flag then only dummies that are flagged with limit can be selected. If omitted, or null, any dummies from any model can be selected. from any model.
If picking is modal (blocks the user from doing anything else in PRIMER until this window is dismissed). If omitted the pick will be modal.
By default the window with the prompt will have a button labelled 'Cancel' which if pressed will cancel the pick and return null. If you want to change the text on the button use this argument. If omitted 'Cancel' will be used.
ReturnsDummy object (or null if not picked) Return typeDummy |
ExampleTo pick a dummy from model m giving the prompt 'Pick dummy from screen': var d = Dummy.Pick('Pick dummy from screen', m);
|
Previous()DescriptionReturns the previous dummy in the model. |
No arguments
ReturnsDummy object (or null if there are no more dummies in the model). Return typeDummy |
ExampleTo get the dummy in model m before dummy d: var d = d.Previous();
|
RemovePoint(index[integer])DescriptionRemoves a reference point from a dummy |
The index of the reference point you want to remove. Note that reference points start at 0, not 1. 0 <= index < points
Returnsno return value |
ExampleTo remove for the 3rd reference point for dummy d: d.RemovePoint(2);
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the dummies in the model. |
Model that all dummies will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the dummies in model m, from 1000000: Dummy.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged dummies in the model. |
Model that all the flagged dummies will be renumbered in
Flag set on the dummies that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the dummies in model m flagged with f, from 1000000: Dummy.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select dummies using standard PRIMER object menus. |
Flag to use when selecting dummies
Text to display as a prompt to the user
If the argument is a Model then only dummies from that model can be selected. If the argument is a Flag then only dummies that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any dummies 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 dummies selected or null if menu cancelled Return typeNumber |
SelectAssembly()DescriptionReturns an array of objects containing the assembly informaitons or null if menu cancelled. |
No arguments
Returns |
Array of objects with the following properties:
| Name | Type | Description |
| label | integer | Assembly label |
| parent | integer | Parent assembly label |
| title | string | Assembly title |
object
ExampleTo select assemblies in dummy d, giving the prompt "Select assemblies": d.SelectAssembly();
|
SetAssemblyNodeSet(label[integer], nsid[integer])DescriptionSets a set node for a Dummy/HBM assembly. |
The label of the assembly.
The label of the set node to be added into the assembly.
Returnsno return value |
ExampleTo set the node set with label=100 in the assembly with label = 2 for dummy d: d.SetAssemblyNodeSet(2, 100);
|
SetAssemblyPart(label[integer], pid[integer])DescriptionSets a part for a Dummy assembly. |
The label of the assembly.
The label of the set part to be added into the assembly.
Returnsno return value |
ExampleTo set the part with label=100 in the assembly with label = 2 for dummy d: d.SetAssemblyPart(2, 100);
|
SetAssemblyPartSet(label[integer], psid[integer])DescriptionSets a set part for a Dummy/HBM assembly. |
The label of the assembly.
The label of the set part to be added into the assembly.
Returnsno return value |
ExampleTo set the set part with label=100 in the assembly with label = 2 for dummy d: d.SetAssemblyPartSet(2, 100);
|
SetAssemblyStopAngle(label[integer], axis[integer], stop_neg[real], stop_pos[real])DescriptionSets -ve and +ve stop angles in the assembly. |
The label of the assembly.
Axis (0 = X, 1 = Y, or 2 = Z) on which to define stop angles.
-ve stop angle.
+ve stop angle.
ReturnsNo return value |
ExampleTo set -90 and 90 stop angles in X-axis in the assembly with label = 2 for dummy d: d.SetAssemblyStopAngle(2, 0, -90, 90);
|
SetFlag(flag[Flag])DescriptionSets a flag on the dummy. |
Flag to set on the dummy
ReturnsNo return value |
ExampleTo set flag f for dummy d: d.SetFlag(f);
|
SetPoint(index[integer], data[object])DescriptionSets the data for a reference point in a dummy |
The index of the reference point you want to set. Note that reference points start at 0, not 1. To add a new point use index points
Object containing the reference point data. The properties can be:
Object has the following properties:
| Name | Type | Description |
| assembly | integer | Assembly label |
| csys (optional) | integer | Coordinate system label |
| node (optional) | integer | Node label (not rewuired if using x, y and z) |
| rx (optional) | boolean | Point restrained rotationally in X |
| ry (optional) | boolean | Point restrained rotationally in Y |
| rz (optional) | boolean | Point restrained rotationally in Z |
| title (optional) | string | Title |
| tx (optional) | boolean | Point restrained translationally in X |
| ty (optional) | boolean | Point restrained translationally in Y |
| tz (optional) | boolean | Point restrained translationally in Z |
| x (optional) | real | X coordinate (not required if using node) |
| y (optional) | real | Y coordinate (not required if using node) |
| z (optional) | real | Z coordinate (not required if using node) |
Returnsno return value |
Sketch(redraw (optional)[boolean])DescriptionSketches the dummy. The dummy will be sketched until you either call Dummy.Unsketch(), Dummy.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the dummy is sketched. If omitted redraw is true. If you want to sketch several dummies and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch dummy d: d.Sketch();
|
SketchAssembly(label[integer], redraw (optional)[boolean])DescriptionSketches the assembly |
The label of the assembly you want to sketch.
If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().
ReturnsNo return value |
ExampleTo sketch the assembly with label 3 in dummy d: var info = d.SketchAssembly(3);
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged dummies in the model. The dummies will be sketched until you either call Dummy.Unsketch(), Dummy.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged dummies will be sketched in
Flag set on the dummies that you want to sketch
If model should be redrawn or not after the dummies are sketched. If omitted redraw is true. If you want to sketch flagged dummies several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all dummies flagged with flag in model m: Dummy.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of dummies in the model. |
Model to get total for
true if only existing dummies should be counted. If false or omitted referenced but undefined dummies will also be included in the total.
Returnsnumber of dummies Return typeNumber |
ExampleTo get the total number of dummies in model m: var total = Dummy.Total(m);
|
Unblank()DescriptionUnblanks the dummy |
No arguments
ReturnsNo return value |
ExampleTo unblank dummy d: d.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the dummies in the model. |
Model that all dummies will be unblanked in
If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().
ReturnsNo return value |
ExampleTo unblank all of the dummies in model m: Dummy.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged dummies in the model. |
Model that the flagged dummies will be unblanked in
Flag set on the dummies that you want to unblank
If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().
ReturnsNo return value |
ExampleTo unblank all of the dummies in model m flagged with f: Dummy.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the dummies in the model. |
Model that the defined flag for all dummies will be unset in
Flag to unset on the dummies
ReturnsNo return value |
ExampleTo unset the flag f on all the dummies in model m: Dummy.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the dummy. |
If model should be redrawn or not after the dummy is unsketched. If omitted redraw is true. If you want to unsketch several dummies and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch dummy d: d.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all dummies. |
Model that all dummies will be unblanked in
If model should be redrawn or not after the dummies are unsketched. If omitted redraw is true. If you want to unsketch several things and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch all dummies in model m: Dummy.UnsketchAll(m);
|
UnsketchAssembly(label[integer], redraw (optional)[boolean])DescriptionUnsketches the assembly |
The label of the assembly you want to unsketch.
If model should be redrawn or not. If omitted redraw is false. If you want to do several (un)blanks and only redraw after the last one then use false for all redraws apart from the last one. Alternatively you can redraw using View.Redraw().
ReturnsNo return value |
ExampleTo unsketch the assembly with label 3 in dummy d: var info = d.UnsketchAssembly(3);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged dummies in the model. |
Model that all dummies will be unsketched in
Flag set on the dummies that you want to unsketch
If model should be redrawn or not after the dummies are unsketched. If omitted redraw is true. If you want to unsketch several things and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch all dummies flagged with flag in model m: Dummy.UnsketchAll(m, flag);
|
No arguments
ReturnsDummy object. Return typeDummy |
ExampleTo check if Dummy property d.example is a parameter by using the Dummy.GetParameter() method: if (d.ViewParameters().GetParameter(d.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for dummy. 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 dummy d: d.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this dummy. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for dummy d: var xrefs = d.Xrefs();
|