The RigidBodies class gives you access to constrained rigid bodies 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 | Description |
| RigidBodies.PART | RigidBodies is *CONSTRAINED_RIGID_BODIES. |
| RigidBodies.SET | RigidBodies is *CONSTRAINED_RIGID_BODIES_SET. |
| Name | Type | Description |
| colour | Colour | The colour of the rigid body |
| exists (read only) | logical | true if rigid body merge exists, false if referred to but not defined. |
| iflag | integer | Flag for adding coonstrained mass properties to part inertia. |
| include | integer | The Include file number that the rigid body merge is in. |
| label (read only) | integer | The label the constrained rigid bodies has in PRIMER |
| model (read only) | integer | The Model number that the rigid body merge is in. |
| option | constant | The Constrained Rigid Bodies option. Can be RigidBodies.PART or RigidBodies.SET. |
| pidc | integer | Constrained rigid body part ID. |
| pidl | integer | Lead rigid body part ID. |
Detailed DescriptionThe RigidBodies class allows you to create, modify, edit and manipulate constrained rigid bodies cards. See the documentation below for more details. |
Constructornew RigidBodies(Model[Model], options [object])DescriptionCreate a new RigidBodies object. |
Model that constrained rigid bodies will be created in
Options specifying which properties would be used to create the keyword. If optional values are not used, then the default values below will be used.
Object has the following properties:
| Name | Type | Description |
| iflag (optional) | integer | Flag for adding constrained mass properties to part inertia. (Default value 0) |
| option (optional) | constant | Specify the type of constrained rigid bodies. Can be RigidBodies.PART(default) or RigidBodies.SET |
| pidc | integer | Constrained rigid body part ID. |
| pidl | integer | Lead rigid body part ID. |
ReturnsRigidBodies object Return typeRigidBodies |
new RigidBodies(Model[Model], pidl[integer], pidc[integer], iflag (optional)[integer], option (optional)[constant]) [deprecated]This function is deprecated in version 20.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions. DescriptionCreate a new RigidBodies object. |
Model that constrained rigid bodies will be created in
Lead rigid body part ID.
Constrained rigid body part ID.
Flag for adding constrained mass properties to part inertia. (Default value 0)
Specify the type of constrained rigid bodies. Can be RigidBodies.PART(default) or RigidBodies.SET
ReturnsRigidBodies object Return typeRigidBodies |
ExampleTo create a new constrained rigid bodies in model m with lead part 5 and constrained part 10 var r = new RigidBodies(m, 5, 10, 0 , 1);
|
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a rigid body merge. |
Comment that will be attached to the rigid body merge
ReturnsNo return value |
ExampleTo associate comment c to the rigid body merge m: m.AssociateComment(c);
|
Blank()DescriptionBlanks the rigid body merge |
No arguments
ReturnsNo return value |
ExampleTo blank rigid body merge m: m.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the rigid body merges in the model. |
Model that all rigid body merges 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 rigid body merges in model m: RigidBodies.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged rigid body merges in the model. |
Model that all the flagged rigid body merges will be blanked in
Flag set on the rigid body merges 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 rigid body merges in model m flagged with f: RigidBodies.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the rigid body merge is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if rigid body merge m is blanked: if (m.Blanked() ) do_something...
|
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 rigid body merge m: m.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the rigid body merge. |
Flag to clear on the rigid body merge
ReturnsNo return value |
ExampleTo clear flag f for rigid body merge m: m.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the rigid body merge. The target include of the copied rigid body merge 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().
ReturnsRigidBodies object Return typeRigidBodies |
ExampleTo copy rigid body merge m into rigid body merge z: var z = m.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a rigid body merge |
Model that the rigid body merge 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.
ReturnsRigidBodies object (or null if not made). Return typeRigidBodies |
ExampleTo start creating a rigid body merge in model m: var m = RigidBodies.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a rigid body merge. |
Comment that will be detached from the rigid body merge
ReturnsNo return value |
ExampleTo detach comment c from the rigid body merge m: m.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 rigid body merge m: m.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for rigid body merge. 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 rigid body merge m: m.Error("My custom error");
|
ExtractColour()DescriptionExtracts the actual colour used for rigid body merge. |
No arguments
Returnscolour value (integer) Return typeNumber |
ExampleTo return the colour used for drawing rigid body merge m: var colour = m.ExtractColour();
|
First(Model[Model]) [static]DescriptionReturns the first rigid body merge in the model. |
Model to get first rigid body merge in
ReturnsRigidBodies object (or null if there are no rigid body merges in the model). Return typeRigidBodies |
ExampleTo get the first rigid body merge in model m: var m = RigidBodies.First(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the rigid body merges in the model with a defined flag. |
Model that all rigid body merges will be flagged in
Flag to set on the rigid body merges
ReturnsNo return value |
ExampleTo flag all of the rigid body merges with flag f in model m: RigidBodies.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the rigid body merge is flagged or not. |
Flag to test on the rigid body merge
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if rigid body merge m has flag f set on it: if (m.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each rigid body merge in the model. |
Model that all rigid body merges are in
Function to call for each rigid body merge
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 RigidBodies objects or properties for all of the rigid body merges in a model in PRIMER. If the optional property argument is not given then an array of RigidBodies objects is returned. If the property argument is given, that property value for each rigid body merge is returned in the array instead of a RigidBodies object |
Model to get rigid body merges from
Name for property to get for all rigid body merges in the model
ReturnsArray of RigidBodies objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a rigid body merge. |
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 rigid body merge m: var comm_array = m.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of RigidBodies objects for all of the flagged rigid body merges in a model in PRIMER If the optional property argument is not given then an array of RigidBodies objects is returned. If the property argument is given, then that property value for each rigid body merge is returned in the array instead of a RigidBodies object |
Model to get rigid body merges from
Flag set on the rigid body merges that you want to retrieve
Name for property to get for all flagged rigid body merges in the model
ReturnsArray of RigidBodies objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the RigidBodies object for a rigid body merge ID. |
Model to find the rigid body merge in
number of the rigid body merge you want the RigidBodies object for
ReturnsRigidBodies object (or null if rigid body merge does not exist). Return typeRigidBodies |
ExampleTo get the RigidBodies object for rigid body merge 100 in model m var m = RigidBodies.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a RigidBodies 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 RigidBodies.ViewParameters() method and 'method chaining' (see the examples below). |
rigid body merge property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
Keyword()DescriptionReturns the keyword for this constrained rigid bodies (*CONSTRAINED_RIGID_BODIES). Note that a carriage return is not added. See also RigidBodies.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for constrained rigid bodies r: var key = r.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the constrained rigid bodies. Note that a carriage return is not added. See also RigidBodies.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for constrained rigid bodies r: var cards = r.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last rigid body merge in the model. |
Model to get last rigid body merge in
ReturnsRigidBodies object (or null if there are no rigid body merges in the model). Return typeRigidBodies |
ExampleTo get the last rigid body merge in model m: var m = RigidBodies.Last(m);
|
Next()DescriptionReturns the next rigid body merge in the model. |
No arguments
ReturnsRigidBodies object (or null if there are no more rigid body merges in the model). Return typeRigidBodies |
ExampleTo get the rigid body merge in model m after rigid body merge m: var m = m.Next();
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a rigid body merge. |
Text to display as a prompt to the user
If the argument is a Model then only rigid body merges from that model can be picked. If the argument is a Flag then only rigid body merges that are flagged with limit can be selected. If omitted, or null, any rigid body merges 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.
ReturnsRigidBodies object (or null if not picked) Return typeRigidBodies |
ExampleTo pick a rigid body merge from model m giving the prompt 'Pick rigid body merge from screen': var m = RigidBodies.Pick('Pick rigid body merge from screen', m);
|
Previous()DescriptionReturns the previous rigid body merge in the model. |
No arguments
ReturnsRigidBodies object (or null if there are no more rigid body merges in the model). Return typeRigidBodies |
ExampleTo get the rigid body merge in model m before rigid body merge m: var m = m.Previous();
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select rigid body merges using standard PRIMER object menus. |
Flag to use when selecting rigid body merges
Text to display as a prompt to the user
If the argument is a Model then only rigid body merges from that model can be selected. If the argument is a Flag then only rigid body merges that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any rigid body merges 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 rigid body merges selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the rigid body merge. |
Flag to set on the rigid body merge
ReturnsNo return value |
ExampleTo set flag f for rigid body merge m: m.SetFlag(f);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the rigid body merge. The rigid body merge will be sketched until you either call RigidBodies.Unsketch(), RigidBodies.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the rigid body merge is sketched. If omitted redraw is true. If you want to sketch several rigid body merges and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch rigid body merge m: m.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged rigid body merges in the model. The rigid body merges will be sketched until you either call RigidBodies.Unsketch(), RigidBodies.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged rigid body merges will be sketched in
Flag set on the rigid body merges that you want to sketch
If model should be redrawn or not after the rigid body merges are sketched. If omitted redraw is true. If you want to sketch flagged rigid body merges several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all rigid body merges flagged with flag in model m: RigidBodies.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of rigid body merges in the model. |
Model to get total for
true if only existing rigid body merges should be counted. If false or omitted referenced but undefined rigid body merges will also be included in the total.
Returnsnumber of rigid body merges Return typeNumber |
ExampleTo get the total number of rigid body merges in model m: var total = RigidBodies.Total(m);
|
Unblank()DescriptionUnblanks the rigid body merge |
No arguments
ReturnsNo return value |
ExampleTo unblank rigid body merge m: m.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the rigid body merges in the model. |
Model that all rigid body merges 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 rigid body merges in model m: RigidBodies.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged rigid body merges in the model. |
Model that the flagged rigid body merges will be unblanked in
Flag set on the rigid body merges 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 rigid body merges in model m flagged with f: RigidBodies.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the rigid body merges in the model. |
Model that the defined flag for all rigid body merges will be unset in
Flag to unset on the rigid body merges
ReturnsNo return value |
ExampleTo unset the flag f on all the rigid body merges in model m: RigidBodies.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the rigid body merge. |
If model should be redrawn or not after the rigid body merge is unsketched. If omitted redraw is true. If you want to unsketch several rigid body merges and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch rigid body merge m: m.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all rigid body merges. |
Model that all rigid body merges will be unblanked in
If model should be redrawn or not after the rigid body merges 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 rigid body merges in model m: RigidBodies.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged rigid body merges in the model. |
Model that all rigid body merges will be unsketched in
Flag set on the rigid body merges that you want to unsketch
If model should be redrawn or not after the rigid body merges 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 rigid body merges flagged with flag in model m: RigidBodies.UnsketchAll(m, flag);
|
No arguments
ReturnsRigidBodies object. Return typeRigidBodies |
ExampleTo check if RigidBodies property m.example is a parameter by using the RigidBodies.GetParameter() method: if (m.ViewParameters().GetParameter(m.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for rigid body merge. 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 rigid body merge m: m.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this rigid body merge. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for rigid body merge m: var xrefs = m.Xrefs();
|
toString()DescriptionCreates a string containing the constrained rigid bodies data in keyword format. Note that this contains the keyword header and the keyword cards. See also RigidBodies.Keyword() and RigidBodies.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for constrained rigid bodies r in keyword format var s = r.toString();
|