The Joint class gives you access to constrained joint 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 |
| cid | integer | Coordinate system number. |
| colour | Colour | The colour of the joint |
| coupl | real | Coupling between force and moment failure. |
| damp | real | Damping scale factor. |
| exists (read only) | logical | true if joint exists, false if referred to but not defined. |
| failure | logical | true if _FAILURE option is set, false if not. |
| h_angle | real | Helix angle for gears. |
| heading | string | Constrained joint heading. |
| id | logical | true if _ID option is set, false if not |
| include | integer | The Include file number that the joint is in. |
| jid | integer | Constrained joint number (identical to label). |
| label | integer | Constrained joint number. |
| lcid | integer | Loadcuve number. |
| local | logical | true if _LOCAL option is set, false if not. |
| lst | integer | Local system type is accelerometer if lst is 1, rigid body if 0. |
| model (read only) | integer | The Model number that the joint is in. |
| mxx | real | Torsional moment resultant at failure. |
| myy | real | Moment resultant at failure. |
| mzz | real | Moment resultant at failure. |
| n1 | integer | Node number 1. |
| n2 | integer | Node number 2. |
| n3 | integer | Node number 3. |
| n4 | integer | Node number 4. |
| n5 | integer | Node number 5. |
| n6 | integer | Node number 6. |
| nxx | real | Axial force resultant at failure. |
| nyy | real | Force resultant at failure. |
| nzz | real | Force resultant at failure. |
| option | constant | The Constrained Joint option. Can be: Joint.SPHERICAL, Joint.REVOLUTE, Joint.CYLINDRICAL, Joint.PLANAR, Joint.UNIVERSAL, Joint.TRANSLATIONAL, Joint.LOCKING, Joint.TRANSLATIONAL_MOTOR, Joint.ROTATIONAL_MOTOR, Joint.GEARS, Joint.RACK_AND_PINION, Joint.CONSTANT_VELOCITY, Joint.PULLEY or Joint.SCREW |
| parm | real | Parameter for function. |
| r1 | real | Gear and pulley radius. |
| raid | integer | Rigid body or accelerometer number. |
| rps | real | Relative penalty stiffness. |
| tfail | real | Time for joint failure. |
| type | integer | Flag for motor type. |
Detailed DescriptionThe Joint class allows you to create, modify, edit and manipulate constrained joint cards. See the documentation below for more details. |
Constructornew Joint(Model[Model], options [object])DescriptionCreate a new Joint object |
Model that constrained joint will be created in
Options for creating the joint
Object has the following properties:
| Name | Type | Description |
| heading (optional) | string | Constrained joint title |
| id (optional) | integer | Constrained joint ID. If omitted, the joint will be created without the _ID option |
| nodes | array | Array of Node IDs for the joint. At least 2 nodes must be given |
| type | constant | Constrained joint type (any) |
ReturnsJoint object Return typeJoint |
new Joint(Model[Model], option[constant], n1[integer], n2[integer], jid (optional)[integer], heading (optional)[string]) [deprecated]This function is deprecated in version 21.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 Joint object. |
Model that constrained joint will be created in
Constrained joint type (any).
Node 1.
Node 2.
Constrained joint number.
Constrained joint title.
ReturnsJoint object Return typeJoint |
new Joint(Model[Model], option[constant], n1[integer], n2[integer], n3[integer], n4[integer], jid (optional)[integer], heading (optional)[string]) [deprecated]This function is deprecated in version 21.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 Joint object. |
Model that constrained joint will be created in
Constrained joint type. Can be Joint.REVOLUTE, Joint.CYLINDRICAL, Joint.PLANAR, Joint.UNIVERSAL or Joint.TRANSLATIONAL_MOTOR.
Node 1.
Node 2.
Node 3.
Node 4.
Constrained joint number.
Constrained joint title.
ReturnsJoint object Return typeJoint |
new Joint(Model[Model], option[constant], n1[integer], n2[integer], n3[integer], n4[integer], n5[integer], n6[integer], jid (optional)[integer], heading (optional)[string]) [deprecated]This function is deprecated in version 21.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 Joint object. |
Model that constrained joint will be created in
Constrained joint type. Can be Joint.TRANSLATIONAL, Joint.LOCKING, Joint.ROTATIONAL_MOTOR, Joint.GEARS, Joint.RACK_AND_PINION, Joint.CONSTANT_VELOCITY, Joint.PULLEY or Joint.SCREW.
Node 1.
Node 2.
Node 3.
Node 4.
Node 5.
Node 6.
Constrained joint number.
Constrained joint title.
ReturnsJoint object Return typeJoint |
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a joint. |
Comment that will be attached to the joint
ReturnsNo return value |
ExampleTo associate comment c to the joint j: j.AssociateComment(c);
|
Blank()DescriptionBlanks the joint |
No arguments
ReturnsNo return value |
ExampleTo blank joint j: j.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the joints in the model. |
Model that all joints 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 joints in model m: Joint.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged joints in the model. |
Model that all the flagged joints will be blanked in
Flag set on the joints 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 joints in model m flagged with f: Joint.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the joint is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if joint j is blanked: if (j.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 joint j: j.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the joint. |
Flag to clear on the joint
ReturnsNo return value |
ExampleTo clear flag f for joint j: j.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the joint. The target include of the copied joint 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().
ReturnsJoint object Return typeJoint |
ExampleTo copy joint j into joint z: var z = j.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a joint |
Model that the joint 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.
ReturnsJoint object (or null if not made). Return typeJoint |
ExampleTo start creating a joint in model m: var j = Joint.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a joint. |
Comment that will be detached from the joint
ReturnsNo return value |
ExampleTo detach comment c from the joint j: j.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 joint j: j.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for joint. 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 joint j: j.Error("My custom error");
|
ExtractColour()DescriptionExtracts the actual colour used for joint. |
No arguments
Returnscolour value (integer) Return typeNumber |
ExampleTo return the colour used for drawing joint j: var colour = j.ExtractColour();
|
First(Model[Model]) [static]DescriptionReturns the first joint in the model. |
Model to get first joint in
ReturnsJoint object (or null if there are no joints in the model). Return typeJoint |
ExampleTo get the first joint in model m: var j = Joint.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free joint label in the model. Also see Joint.LastFreeLabel(), Joint.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free joint 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).
ReturnsJoint label. Return typeNumber |
ExampleTo get the first free joint label in model m: var label = Joint.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the joints in the model with a defined flag. |
Model that all joints will be flagged in
Flag to set on the joints
ReturnsNo return value |
ExampleTo flag all of the joints with flag f in model m: Joint.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the joint is flagged or not. |
Flag to test on the joint
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if joint j has flag f set on it: if (j.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each joint in the model. |
Model that all joints are in
Function to call for each joint
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 Joint objects or properties for all of the joints in a model in PRIMER. If the optional property argument is not given then an array of Joint objects is returned. If the property argument is given, that property value for each joint is returned in the array instead of a Joint object |
Model to get joints from
Name for property to get for all joints in the model
ReturnsArray of Joint objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a joint. |
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 joint j: var comm_array = j.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Joint objects for all of the flagged joints in a model in PRIMER If the optional property argument is not given then an array of Joint objects is returned. If the property argument is given, then that property value for each joint is returned in the array instead of a Joint object |
Model to get joints from
Flag set on the joints that you want to retrieve
Name for property to get for all flagged joints in the model
ReturnsArray of Joint objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Joint object for a joint ID. |
Model to find the joint in
number of the joint you want the Joint object for
ReturnsJoint object (or null if joint does not exist). Return typeJoint |
ExampleTo get the Joint object for joint 100 in model m var j = Joint.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a Joint 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 Joint.ViewParameters() method and 'method chaining' (see the examples below). |
joint property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
Keyword()DescriptionReturns the keyword for this joint (*CONSTRAINED_JOINT). Note that a carriage return is not added. See also Joint.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for joint j: var key = j.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the joint. Note that a carriage return is not added. See also Joint.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for joint j: var cards = j.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last joint in the model. |
Model to get last joint in
ReturnsJoint object (or null if there are no joints in the model). Return typeJoint |
ExampleTo get the last joint in model m: var j = Joint.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free joint label in the model. Also see Joint.FirstFreeLabel(), Joint.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free joint 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.
ReturnsJoint label. Return typeNumber |
ExampleTo get the last free joint label in model m: var label = Joint.LastFreeLabel(m);
|
Next()DescriptionReturns the next joint in the model. |
No arguments
ReturnsJoint object (or null if there are no more joints in the model). Return typeJoint |
ExampleTo get the joint in model m after joint j: var j = j.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) joint label in the model. Also see Joint.FirstFreeLabel(), Joint.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free joint 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).
ReturnsJoint label. Return typeNumber |
ExampleTo get the next free joint label in model m: var label = Joint.NextFreeLabel(m);
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a joint. |
Text to display as a prompt to the user
If the argument is a Model then only joints from that model can be picked. If the argument is a Flag then only joints that are flagged with limit can be selected. If omitted, or null, any joints 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.
ReturnsJoint object (or null if not picked) Return typeJoint |
ExampleTo pick a joint from model m giving the prompt 'Pick joint from screen': var j = Joint.Pick('Pick joint from screen', m);
|
Previous()DescriptionReturns the previous joint in the model. |
No arguments
ReturnsJoint object (or null if there are no more joints in the model). Return typeJoint |
ExampleTo get the joint in model m before joint j: var j = j.Previous();
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the joints in the model. |
Model that all joints will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the joints in model m, from 1000000: Joint.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged joints in the model. |
Model that all the flagged joints will be renumbered in
Flag set on the joints that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the joints in model m flagged with f, from 1000000: Joint.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select joints using standard PRIMER object menus. |
Flag to use when selecting joints
Text to display as a prompt to the user
If the argument is a Model then only joints from that model can be selected. If the argument is a Flag then only joints that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any joints 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 joints selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the joint. |
Flag to set on the joint
ReturnsNo return value |
ExampleTo set flag f for joint j: j.SetFlag(f);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the joint. The joint will be sketched until you either call Joint.Unsketch(), Joint.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the joint is sketched. If omitted redraw is true. If you want to sketch several joints and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch joint j: j.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged joints in the model. The joints will be sketched until you either call Joint.Unsketch(), Joint.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged joints will be sketched in
Flag set on the joints that you want to sketch
If model should be redrawn or not after the joints are sketched. If omitted redraw is true. If you want to sketch flagged joints several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all joints flagged with flag in model m: Joint.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of joints in the model. |
Model to get total for
true if only existing joints should be counted. If false or omitted referenced but undefined joints will also be included in the total.
Returnsnumber of joints Return typeNumber |
ExampleTo get the total number of joints in model m: var total = Joint.Total(m);
|
Unblank()DescriptionUnblanks the joint |
No arguments
ReturnsNo return value |
ExampleTo unblank joint j: j.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the joints in the model. |
Model that all joints 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 joints in model m: Joint.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged joints in the model. |
Model that the flagged joints will be unblanked in
Flag set on the joints 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 joints in model m flagged with f: Joint.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the joints in the model. |
Model that the defined flag for all joints will be unset in
Flag to unset on the joints
ReturnsNo return value |
ExampleTo unset the flag f on all the joints in model m: Joint.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the joint. |
If model should be redrawn or not after the joint is unsketched. If omitted redraw is true. If you want to unsketch several joints and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch joint j: j.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all joints. |
Model that all joints will be unblanked in
If model should be redrawn or not after the joints 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 joints in model m: Joint.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged joints in the model. |
Model that all joints will be unsketched in
Flag set on the joints that you want to unsketch
If model should be redrawn or not after the joints 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 joints flagged with flag in model m: Joint.UnsketchAll(m, flag);
|
No arguments
ReturnsJoint object. Return typeJoint |
ExampleTo check if Joint property j.example is a parameter by using the Joint.GetParameter() method: if (j.ViewParameters().GetParameter(j.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for joint. 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 joint j: j.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this joint. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for joint j: var xrefs = j.Xrefs();
|
toString()DescriptionCreates a string containing the joint data in keyword format. Note that this contains the keyword header and the keyword cards. See also Joint.Keyword() and Joint.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for joint j in keyword format var s = j.toString();
|