The Mechanism class gives you access to mechanism 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 |
| Mechanism.COUPLER | Coupler mechanism connection |
| Mechanism.HINGE | Hinge mechanism connection |
| Mechanism.LINE | Line mechanism connection |
| Mechanism.PIN | Pin mechanism connection |
| Name | Description |
| Mechanism.ROTATION | Rotational coupling on mechanism coupler |
| Mechanism.TRANSLATION | Translational coupling on mechanism coupler |
| Name | Type | Description |
| assemblies (read only) | integer | Number of assemblies defined. |
| connections (read only) | integer | Number of connections defined. |
| exists (read only) | logical | true if mechanism exists, false if referred to but not defined. |
| id (read only) | integer | Mechanism number. Also see the label property which is an alternative name for this. |
| include | integer | The Include file number that the mechanism is in. |
| label (read only) | integer | Mechanism number. Also see the id property which is an alternative name for this. |
| model (read only) | integer | The Model number that the mechanism is in. |
| points (read only) | integer | Number of reference points defined. |
| title | string | Mechanism title. |
Detailed DescriptionThe Mechanism class allows you to create, modify, edit and manipulate mechanism cards. See the documentation below for more details. |
Details of functionsAddNodeSetToAssembly(index[integer], nsid[integer])DescriptionAdd node set to assembly |
The index of the assembly in which you want to add node set. Note that reference points start at 0, not 1. 0 <= index < assemblies
The node set ID that you want to add.
ReturnsNo return value |
ExampleTo add node set 3 in 3rd assembly in mechanism m: m.AddNodeSetToAssembly(2,3);
|
AddPartSetToAssembly(index[integer], psid[integer])DescriptionAdd part set to assembly |
The index of the assembly in which you want to add part set. Note that reference points start at 0, not 1. 0 <= index < assemblies
The part set ID that you want to add.
ReturnsNo return value |
ExampleTo add part set 3 in 3rd assembly in mechanism m: m.AddPartSetToAssembly(2,3);
|
AddPartToAssembly(index[integer], pid[integer])DescriptionAdd part to assembly |
The index of the assembly in which you want to add part. Note that reference points start at 0, not 1. 0 <= index < assemblies
The part ID that you want to add.
ReturnsNo return value |
ExampleTo add part 3 in 3rd assembly in mechanism m: m.AddPartToAssembly(2,3);
|
AssociateComment(Comment[Comment])DescriptionAssociates a comment with a mechanism. |
Comment that will be attached to the mechanism
ReturnsNo return value |
ExampleTo associate comment c to the mechanism m: m.AssociateComment(c);
|
Blank()DescriptionBlanks the mechanism |
No arguments
ReturnsNo return value |
ExampleTo blank mechanism m: m.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the mechanisms in the model. |
Model that all mechanisms 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 mechanisms in model m: Mechanism.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged mechanisms in the model. |
Model that all the flagged mechanisms will be blanked in
Flag set on the mechanisms 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 mechanisms in model m flagged with f: Mechanism.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the mechanism is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if mechanism m is blanked: if (m.Blanked() ) do_something...
|
ClearFlag(flag[Flag])DescriptionClears a flag on the mechanism. |
Flag to clear on the mechanism
ReturnsNo return value |
ExampleTo clear flag f for mechanism m: m.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the mechanism. The target include of the copied mechanism 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().
ReturnsMechanism object Return typeMechanism |
ExampleTo copy mechanism m into mechanism z: var z = m.Copy();
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a mechanism. |
Comment that will be detached from the mechanism
ReturnsNo return value |
ExampleTo detach comment c from the mechanism m: m.DetachComment(c);
|
Error(message[string], details (optional)[string])DescriptionAdds an error for mechanism. 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 mechanism m: m.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first mechanism in the model. |
Model to get first mechanism in
ReturnsMechanism object (or null if there are no mechanisms in the model). Return typeMechanism |
ExampleTo get the first mechanism in model m: var m = Mechanism.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free mechanism label in the model. Also see Mechanism.LastFreeLabel(), Mechanism.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free mechanism 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).
ReturnsMechanism label. Return typeNumber |
ExampleTo get the first free mechanism label in model m: var label = Mechanism.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the mechanisms in the model with a defined flag. |
Model that all mechanisms will be flagged in
Flag to set on the mechanisms
ReturnsNo return value |
ExampleTo flag all of the mechanisms with flag f in model m: Mechanism.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the mechanism is flagged or not. |
Flag to test on the mechanism
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if mechanism 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 mechanism in the model. |
Model that all mechanisms are in
Function to call for each mechanism
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 Mechanism objects or properties for all of the mechanisms in a model in PRIMER. If the optional property argument is not given then an array of Mechanism objects is returned. If the property argument is given, that property value for each mechanism is returned in the array instead of a Mechanism object |
Model to get mechanisms from
Name for property to get for all mechanisms in the model
ReturnsArray of Mechanism 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 mechanism m: var info = m.GetAssembly(2);
|
GetComments()DescriptionExtracts the comments associated to a mechanism. |
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 mechanism m: var comm_array = m.GetComments();
|
GetConnection(index[integer])DescriptionReturns the information for a connection |
The index of the connection you want the information for. Note that connections start at 0, not 1. 0 <= index < connections
Returns |
Object with the following properties:
| Name | Type | Description |
| angle | real | Current angle in degrees (for Mechanism.LINE and Mechanism.HINGE) |
| assembly1 | integer | Assembly 1 label |
| assembly2 | integer | Assembly 2 label |
| assembly3 | integer | Assembly 3 label |
| coefficient1 | real | Coefficient for linear coupler equation for connection 1 (for Mechanism.COUPLER) |
| coefficient2 | real | Coefficient for linear coupler equation for connection 2 (for Mechanism.COUPLER) |
| coefficient3 | real | Coefficient for linear coupler equation for connection 3 (for Mechanism.COUPLER) |
| connection1 | integer | Connection 1 label (for Mechanism.COUPLER) |
| connection2 | integer | Connection 2 label (for Mechanism.COUPLER) |
| connection3 | integer | Connection 3 label (for Mechanism.COUPLER) |
| distance | real | Current distance (for Mechanism.LINE) |
| factor1 | real | Factor 1 on Assembly 3 (Mechanism.LINE only) |
| factor2 | real | Factor 2 on Assembly 3 (Mechanism.LINE only) |
| label | integer | Connection label |
| locked | integer | 1 if locked (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| mode1 | integer | Coupling mode for connection 1. 0 = translational coupling, 1 = rotational coupling (for Mechanism.COUPLER) |
| mode2 | integer | Coupling mode for connection 2. 0 = translational coupling, 1 = rotational coupling (for Mechanism.COUPLER) |
| mode3 | integer | Coupling mode for connection 3. 0 = translational coupling, 1 = rotational coupling (for Mechanism.COUPLER) |
| node1 | integer | Node 1 label (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| node2 | integer | Node 2 label (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| nrotation | real | -ve rotation limit in degrees (for Mechanism.LINE and Mechanism.HINGE) |
| nslide | real | -ve slide translation (for Mechanism.LINE) |
| protation | real | +ve rotation limit in degrees (for Mechanism.LINE and Mechanism.HINGE) |
| pslide | real | +ve slide translation (for Mechanism.LINE) |
| title | string | Connection label |
| type | integer | Mechanism type (Mechanism.COUPLER, Mechanism.HINGE, Mechanism.LINE, Mechanism.PIN) |
| x1 | real | X1 coordinates (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| x2 | real | X2 coordinates (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| y1 | real | Y1 coordinates (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| y2 | real | Y2 coordinates (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| z1 | real | Z1 coordinates (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| z2 | real | Z2 coordinates (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
object
ExampleTo get the information for the 3rd connection for mechanism m: var info = m.GetConnection(2);
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Mechanism objects for all of the flagged mechanisms in a model in PRIMER If the optional property argument is not given then an array of Mechanism objects is returned. If the property argument is given, then that property value for each mechanism is returned in the array instead of a Mechanism object |
Model to get mechanisms from
Flag set on the mechanisms that you want to retrieve
Name for property to get for all flagged mechanisms in the model
ReturnsArray of Mechanism objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Mechanism object for a mechanism ID. |
Model to find the mechanism in
number of the mechanism you want the Mechanism object for
ReturnsMechanism object (or null if mechanism does not exist). Return typeMechanism |
ExampleTo get the Mechanism object for mechanism 100 in model m var m = Mechanism.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a Mechanism 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 Mechanism.ViewParameters() method and 'method chaining' (see the examples below). |
mechanism 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 mechanism m: var info = m.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 mechanism mec: var c = mec.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 mechanism mec: var c = mec.GetPointTitle(2)
|
Last(Model[Model]) [static]DescriptionReturns the last mechanism in the model. |
Model to get last mechanism in
ReturnsMechanism object (or null if there are no mechanisms in the model). Return typeMechanism |
ExampleTo get the last mechanism in model m: var m = Mechanism.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free mechanism label in the model. Also see Mechanism.FirstFreeLabel(), Mechanism.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free mechanism 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.
ReturnsMechanism label. Return typeNumber |
ExampleTo get the last free mechanism label in model m: var label = Mechanism.LastFreeLabel(m);
|
Next()DescriptionReturns the next mechanism in the model. |
No arguments
ReturnsMechanism object (or null if there are no more mechanisms in the model). Return typeMechanism |
ExampleTo get the mechanism in model m after mechanism m: var m = m.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) mechanism label in the model. Also see Mechanism.FirstFreeLabel(), Mechanism.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free mechanism 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).
ReturnsMechanism label. Return typeNumber |
ExampleTo get the next free mechanism label in model m: var label = Mechanism.NextFreeLabel(m);
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a mechanism. |
Text to display as a prompt to the user
If the argument is a Model then only mechanisms from that model can be picked. If the argument is a Flag then only mechanisms that are flagged with limit can be selected. If omitted, or null, any mechanisms 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.
ReturnsMechanism object (or null if not picked) Return typeMechanism |
ExampleTo pick a mechanism from model m giving the prompt 'Pick mechanism from screen': var m = Mechanism.Pick('Pick mechanism from screen', m);
|
Previous()DescriptionReturns the previous mechanism in the model. |
No arguments
ReturnsMechanism object (or null if there are no more mechanisms in the model). Return typeMechanism |
ExampleTo get the mechanism in model m before mechanism m: var m = m.Previous();
|
RemoveConnection(index[integer])DescriptionRemoves a connection from a mechanism |
The index of the connection you want to remove. Note that connections start at 0, not 1. 0 <= index < connections
Returnsno return value |
ExampleTo remove the 3rd connection for mechanism m: m.RemoveConnection(2);
|
RemoveNodeSetFromAssembly(index[integer], nsid[integer])DescriptionRemove node set from assembly |
The index of the assembly from which you want to remove the node set. Note that reference points start at 0, not 1. 0 <= index < assemblies
The node set ID that you want to remove.
ReturnsNo return value |
ExampleTo remove node set 3 from 3rd assembly in mechanism m: m.RemoveNodeSetFromAssembly(2,3);
|
RemovePartFromAssembly(index[integer], pid[integer])DescriptionRemove part from assembly |
The index of the assembly from which you want to remove the part. Note that reference points start at 0, not 1. 0 <= index < assemblies
The part ID that you want to remove.
ReturnsNo return value |
ExampleTo remove part 3 from 3rd assembly in mechanism m: m.RemovePartFromAssembly(2,3);
|
RemovePartSetFromAssembly(index[integer], psid[integer])DescriptionRemove part set from assembly |
The index of the assembly from which you want to remove the part set. Note that reference points start at 0, not 1. 0 <= index < assemblies
The part set ID that you want to remove.
ReturnsNo return value |
ExampleTo remove part set 3 from 3rd assembly in mechanism m: m.RemovePartSetFromAssembly(2,3);
|
RemovePoint(index[integer])DescriptionRemoves a reference point from a mechanism |
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 the 3rd reference point for mechanism m: m.RemovePoint(2);
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the mechanisms in the model. |
Model that all mechanisms will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the mechanisms in model m, from 1000000: Mechanism.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged mechanisms in the model. |
Model that all the flagged mechanisms will be renumbered in
Flag set on the mechanisms that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the mechanisms in model m flagged with f, from 1000000: Mechanism.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select mechanisms using standard PRIMER object menus. |
Flag to use when selecting mechanisms
Text to display as a prompt to the user
If the argument is a Model then only mechanisms from that model can be selected. If the argument is a Flag then only mechanisms that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any mechanisms 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 mechanisms selected or null if menu cancelled Return typeNumber |
SetConnection(index[integer], data[object])DescriptionSets the data for a connection in a mechanism |
The index of the connection you want to set. Note that connections start at 0, not 1. To add a new connection use index connections
Object containing the connection data. The properties can be:
Object has the following properties:
| Name | Type | Description |
| angle (optional) | real | Current angle in degrees (for Mechanism.LINE and Mechanism.HINGE) |
| assembly1 (optional) | integer | Assembly 1 label (required for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| assembly2 (optional) | integer | Assembly 2 label (required for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| assembly3 | integer | Assembly 3 label (required for Mechanism.LINE) |
| coefficient1 (optional) | real | Coefficient for linear coupler equation for connection 1 (for Mechanism.COUPLER) |
| coefficient2 (optional) | real | Coefficient for linear coupler equation for connection 2 (for Mechanism.COUPLER) |
| coefficient3 (optional) | real | Coefficient for linear coupler equation for connection 3 (for Mechanism.COUPLER) |
| connection1 (optional) | integer | Connection 1 label (for Mechanism.COUPLER) |
| connection2 (optional) | integer | Connection 2 label (for Mechanism.COUPLER) |
| connection3 (optional) | integer | Connection 3 label (for Mechanism.COUPLER) |
| distance (optional) | real | Current distance (for Mechanism.LINE) |
| factor1 (optional) | real | Factor 1 on Assembly 3 (Mechanism.LINE only) |
| factor2 (optional) | real | Factor 2 on Assembly 3 (Mechanism.LINE only) |
| locked (optional) | integer | 1 if locked (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE) |
| mode1 (optional) | integer | Coupling mode for connection 1. 0 = translational coupling, 1 = rotational coupling (for Mechanism.COUPLER) |
| mode2 (optional) | integer | Coupling mode for connection 2. 0 = translational coupling, 1 = rotational coupling (for Mechanism.COUPLER) |
| mode3 (optional) | integer | Coupling mode for connection 3. 0 = translational coupling, 1 = rotational coupling (for Mechanism.COUPLER) |
| node1 (optional) | integer | Node 1 label (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using x1, y1 and z1) |
| node2 (optional) | integer | Node 2 label (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using x2, y2 and z2) |
| nrotation (optional) | real | -ve rotation limit in degrees (for Mechanism.LINE and Mechanism.HINGE) |
| nslide (optional) | real | -ve slide translation (for Mechanism.LINE) |
| protation (optional) | real | +ve rotation limit in degrees (for Mechanism.LINE and Mechanism.HINGE) |
| pslide (optional) | real | +ve slide translation (for Mechanism.LINE) |
| title (optional) | string | Title |
| type | integer | Connection type. Can be one of: Mechanism.PIN, Mechanism.LINE, Mechanism.HINGE or Mechanism.COUPLER] |
| x1 (optional) | real | x1 coordinate (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using node1) |
| x2 (optional) | real | x2 coordinate (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using node2) |
| y1 (optional) | real | y1 coordinate (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using node1) |
| y2 (optional) | real | y2 coordinate (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using node2) |
| z1 (optional) | real | z1 coordinate (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using node1) |
| z2 (optional) | real | z2 coordinate (for Mechanism.LINE, Mechanism.PIN and Mechanism.HINGE, not required if using node2) |
Returnsno return value |
SetFlag(flag[Flag])DescriptionSets a flag on the mechanism. |
Flag to set on the mechanism
ReturnsNo return value |
ExampleTo set flag f for mechanism m: m.SetFlag(f);
|
SetPoint(index[integer], data[object])DescriptionSets the data for a reference point in a mechanism |
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 required 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 | Point 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 mechanism. The mechanism will be sketched until you either call Mechanism.Unsketch(), Mechanism.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the mechanism is sketched. If omitted redraw is true. If you want to sketch several mechanisms and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch mechanism m: m.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged mechanisms in the model. The mechanisms will be sketched until you either call Mechanism.Unsketch(), Mechanism.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged mechanisms will be sketched in
Flag set on the mechanisms that you want to sketch
If model should be redrawn or not after the mechanisms are sketched. If omitted redraw is true. If you want to sketch flagged mechanisms several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all mechanisms flagged with flag in model m: Mechanism.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of mechanisms in the model. |
Model to get total for
true if only existing mechanisms should be counted. If false or omitted referenced but undefined mechanisms will also be included in the total.
Returnsnumber of mechanisms Return typeNumber |
ExampleTo get the total number of mechanisms in model m: var total = Mechanism.Total(m);
|
Unblank()DescriptionUnblanks the mechanism |
No arguments
ReturnsNo return value |
ExampleTo unblank mechanism m: m.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the mechanisms in the model. |
Model that all mechanisms 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 mechanisms in model m: Mechanism.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged mechanisms in the model. |
Model that the flagged mechanisms will be unblanked in
Flag set on the mechanisms 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 mechanisms in model m flagged with f: Mechanism.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the mechanisms in the model. |
Model that the defined flag for all mechanisms will be unset in
Flag to unset on the mechanisms
ReturnsNo return value |
ExampleTo unset the flag f on all the mechanisms in model m: Mechanism.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the mechanism. |
If model should be redrawn or not after the mechanism is unsketched. If omitted redraw is true. If you want to unsketch several mechanisms and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch mechanism m: m.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all mechanisms. |
Model that all mechanisms will be unblanked in
If model should be redrawn or not after the mechanisms 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 mechanisms in model m: Mechanism.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged mechanisms in the model. |
Model that all mechanisms will be unsketched in
Flag set on the mechanisms that you want to unsketch
If model should be redrawn or not after the mechanisms 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 mechanisms flagged with flag in model m: Mechanism.UnsketchAll(m, flag);
|
No arguments
ReturnsMechanism object. Return typeMechanism |
ExampleTo check if Mechanism property m.example is a parameter by using the Mechanism.GetParameter() method: if (m.ViewParameters().GetParameter(m.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for mechanism. 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 mechanism m: m.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this mechanism. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for mechanism m: var xrefs = m.Xrefs();
|