The Node class gives you access to node 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 |
| Node.SCALAR | Node is *NODE_SCALAR. |
| Node.SCALAR_VALUE | Node is *NODE_SCALAR_VALUE. |
| Name | Type | Description |
| colour | Colour | The colour of the node |
| exists (read only) | logical | true if node exists, false if referred to but not defined. |
| include | integer | The Include file number that the node is in. |
| label | integer | Node number. Also see the nid property which is an alternative name for this. |
| model (read only) | integer | The Model number that the node is in. |
| ndof | integer | Number of degrees of freedom (SCALAR and SCALAR_VALUE only). |
| nid | integer | Node number. Also see the label property which is an alternative name for this. |
| rc | integer | Rotational constraint (0-7) |
| scalar | integer | The type of the node. Can be false (*NODE), Node.SCALAR (*NODE_SCALAR) or Node.SCALAR_VALUE (*NODE_SCALAR_VALUE) |
| tc | integer | Translational constraint (0-7) |
| x | real | X coordinate |
| x1 | integer | Initial value of 1st degree of freedom (SCALAR_VALUE only). |
| x2 | integer | Initial value of 2nd degree of freedom (SCALAR_VALUE only). |
| x3 | integer | Initial value of 3rd degree of freedom (SCALAR_VALUE only). |
| y | real | Y coordinate |
| z | real | Z coordinate |
Detailed DescriptionThe Node class allows you to create, modify, edit and manipulate node cards. See the documentation below for more details. |
Constructornew Node(Model[Model], nid[integer], x[real], y[real], z[real], tc (optional)[integer], rc (optional)[integer])DescriptionCreate a new Node object. |
Model that node will be created in
Node number
X coordinate
Y coordinate
Z coordinate
Translational constraint (0-7). If omitted tc will be set to 0.
Rotational constraint (0-7). If omitted rc will be set to 0.
ReturnsNode object Return typeNode |
ExampleTo create a new node in model m with label 100, at coordinates (20, 40, 10) var n = new Node(m, 100, 20, 40, 10);
|
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a node. |
Comment that will be attached to the node
ReturnsNo return value |
ExampleTo associate comment c to the node n: n.AssociateComment(c);
|
Blank()DescriptionBlanks the node |
No arguments
ReturnsNo return value |
ExampleTo blank node n: n.Blank();
|
BlankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionBlanks all of the nodes in the model. |
Model that all nodes 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 nodes in model m: Node.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged nodes in the model. |
Model that all the flagged nodes will be blanked in
Flag set on the nodes 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 nodes in model m flagged with f: Node.BlankFlagged(m, f);
|
Blanked()DescriptionChecks if the node is blanked or not. |
No arguments
Returnstrue if blanked, false if not. Return typeBoolean |
ExampleTo check if node n is blanked: if (n.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 node n: n.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the node. |
Flag to clear on the node
ReturnsNo return value |
ExampleTo clear flag f for node n: n.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the node. The target include of the copied node 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().
ReturnsNode object Return typeNode |
ExampleTo copy node n into node z: var z = n.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a node |
Model that the node 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.
ReturnsNode object (or null if not made). Return typeNode |
ExampleTo start creating a node in model m: var n = Node.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a node. |
Comment that will be detached from the node
ReturnsNo return value |
ExampleTo detach comment c from the node n: n.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 node n: n.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for node. 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 node n: n.Error("My custom error");
|
ExtractColour()DescriptionExtracts the actual colour used for node. |
No arguments
Returnscolour value (integer) Return typeNumber |
ExampleTo return the colour used for drawing node n: var colour = n.ExtractColour();
|
First(Model[Model]) [static]DescriptionReturns the first node in the model. |
Model to get first node in
ReturnsNode object (or null if there are no nodes in the model). Return typeNode |
ExampleTo get the first node in model m: var n = Node.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free node label in the model. Also see Node.LastFreeLabel(), Node.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free node 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).
ReturnsNode label. Return typeNumber |
ExampleTo get the first free node label in model m: var label = Node.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the nodes in the model with a defined flag. |
Model that all nodes will be flagged in
Flag to set on the nodes
ReturnsNo return value |
ExampleTo flag all of the nodes with flag f in model m: Node.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the node is flagged or not. |
Flag to test on the node
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if node n has flag f set on it: if (n.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each node in the model. |
Model that all nodes are in
Function to call for each node
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 Node objects or properties for all of the nodes in a model in PRIMER. If the optional property argument is not given then an array of Node objects is returned. If the property argument is given, that property value for each node is returned in the array instead of a Node object |
Model to get nodes from
Name for property to get for all nodes in the model
ReturnsArray of Node objects or properties Return typeArray |
GetAttachedShells(recursive (optional)[boolean])DescriptionReturns the shells that are attached to the node. |
If recursive is false then only the shells actually attached to the node will be returned (this could also be done by using the Xrefs class but this method is provided for convenience. If recursive is true then PRIMER will keep finding attached shells until no more can be found. If omitted recursive will be false.
ReturnsArray of Shell objects (or null if there are no attached shells). Return typeArray |
ExampleTo find the shells attached to node n, growing the selection until no more shells can be found: var shell_array = n.GetAttachedShells(true);
|
GetComments()DescriptionExtracts the comments associated to a node. |
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 node n: var comm_array = n.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Node objects for all of the flagged nodes in a model in PRIMER If the optional property argument is not given then an array of Node objects is returned. If the property argument is given, then that property value for each node is returned in the array instead of a Node object |
Model to get nodes from
Flag set on the nodes that you want to retrieve
Name for property to get for all flagged nodes in the model
ReturnsArray of Node objects or properties Return typeArray |
GetFreeEdgeNodes()Description
If the node is on a shell free edge and that edge forms a loop like the boundary of a hole, then GetFreeEdgeNodes returns all of the nodes on the hole/boundary in order. Note that a free edge is a shell edge which is only used by one shell, whereas edges in the middle of a shell part will have got more than one adjacent shell and are therefore not free edges. If every node on a boundary belongs to exactly two free edges, then this function returns the array as described. In more involved combinatorics of shells, for example multiple parts sharing nodes along their boundaries, there can be one, three or more free edges at a node, and this function should not be used. If you only need to know whether or not a node is on a free edge, you should find the shells attached to it by cross references with Xrefs.GetItemID and see whether these shells have got other nodes in common as well. If nodes along an edge of a shell only appear in that one shell, this is a free edge. |
No arguments
ReturnsArray of Node objects (or null if not on a shell free edge). Return typeArray |
ExampleTo find all the nodes on the hole/boundary that node n is on: var node_array = n.GetFreeEdgeNodes();
|
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Node object for a node ID. |
Model to find the node in
number of the node you want the Node object for
ReturnsNode object (or null if node does not exist). Return typeNode |
ExampleTo get the Node object for node 100 in model m var n = Node.GetFromID(m, 100);
|
GetInitialVelocities()DescriptionReturns the initial velocity of the node. You need to be sure the field nvels of the node is populate before to use GetInitialVelocities. To do so you can use Model.PopNodeVels . |
No arguments
ReturnsArray containing the 3 translational and 3 rotational velocity values. Return typeArray |
ExampleTo get the initial velocity of the node n: var vel = n.GetInitialVelocities();
|
GetParameter(prop[string])DescriptionChecks if a Node 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 Node.ViewParameters() method and 'method chaining' (see the examples below). |
node property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
GetReferenceGeometry()DescriptionReturns the airbag reference geometry of the node |
No arguments
ReturnsThe reference geometry ID of the node (or 0 if it hasn't got any) Return typeNumber |
ExampleTo get the reference geometry of the node n: var a = n.GetReferenceGeometry();
|
Keyword()DescriptionReturns the keyword for this node (*NODE, *NODE_SCALAR or *NODE_SCALAR_VALUE). Note that a carriage return is not added. See also Node.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for node n: var key = n.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the node. Note that a carriage return is not added. See also Node.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for node n: var cards = n.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last node in the model. |
Model to get last node in
ReturnsNode object (or null if there are no nodes in the model). Return typeNode |
ExampleTo get the last node in model m: var n = Node.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free node label in the model. Also see Node.FirstFreeLabel(), Node.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free node 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.
ReturnsNode label. Return typeNumber |
ExampleTo get the last free node label in model m: var label = Node.LastFreeLabel(m);
|
Merge(Model[Model], flag[Flag], dist[real], label (optional)[integer], position (optional)[integer]) [static]DescriptionAttempts to merge nodes flagged with flag for a model in PRIMER. Merging nodes on *AIRBAG_SHELL_REFERENCE_GEOMETRY can be controlled by using Options.node_replace_asrg. Also see Model.MergeNodes(). |
Model that the nodes will be merged in
Flag set on nodes to nodes
Nodes closer than dist will be potentially merged.
Label to keep after merge. If > 0 then highest label kept. If <= 0 then lowest kept. If omitted the lowest label will be kept.
Position to merge at. If > 0 then merged at highest label position. If < 0 then merged at lowest label position. If 0 then merged at midpoint. If omitted the merge will be done at the lowest label.
ReturnsThe number of nodes merged Return typeNumber |
ExampleTo (try to) merge nodes in model m flagged with flag f, with a distance of 0.1: Node.Merge(m, f, 0.1);
|
Next()DescriptionReturns the next node in the model. |
No arguments
ReturnsNode object (or null if there are no more nodes in the model). Return typeNode |
ExampleTo get the node in model m after node n: var n = n.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) node label in the model. Also see Node.FirstFreeLabel(), Node.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free node 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).
ReturnsNode label. Return typeNumber |
ExampleTo get the next free node label in model m: var label = Node.NextFreeLabel(m);
|
No arguments
Returnsreal Return typeNumber |
ExampleTo get the mass for node n: var mass = n.NodalMass();
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick a node. |
Text to display as a prompt to the user
If the argument is a Model then only nodes from that model can be picked. If the argument is a Flag then only nodes that are flagged with limit can be selected. If omitted, or null, any nodes 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.
ReturnsNode object (or null if not picked) Return typeNode |
ExampleTo pick a node from model m giving the prompt 'Pick node from screen': var n = Node.Pick('Pick node from screen', m);
|
Previous()DescriptionReturns the previous node in the model. |
No arguments
ReturnsNode object (or null if there are no more nodes in the model). Return typeNode |
ExampleTo get the node in model m before node n: var n = n.Previous();
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the nodes in the model. |
Model that all nodes will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the nodes in model m, from 1000000: Node.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged nodes in the model. |
Model that all the flagged nodes will be renumbered in
Flag set on the nodes that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the nodes in model m flagged with f, from 1000000: Node.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select nodes using standard PRIMER object menus. |
Flag to use when selecting nodes
Text to display as a prompt to the user
If the argument is a Model then only nodes from that model can be selected. If the argument is a Flag then only nodes that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any nodes 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 nodes selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the node. |
Flag to set on the node
ReturnsNo return value |
ExampleTo set flag f for node n: n.SetFlag(f);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the node. The node will be sketched until you either call Node.Unsketch(), Node.UnsketchAll(), Model.UnsketchAll(), or delete the model |
If model should be redrawn or not after the node is sketched. If omitted redraw is true. If you want to sketch several nodes and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch node n: n.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches all of the flagged nodes in the model. The nodes will be sketched until you either call Node.Unsketch(), Node.UnsketchFlagged(), Model.UnsketchAll(), or delete the model |
Model that all the flagged nodes will be sketched in
Flag set on the nodes that you want to sketch
If model should be redrawn or not after the nodes are sketched. If omitted redraw is true. If you want to sketch flagged nodes several times and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo sketch all nodes flagged with flag in model m: Node.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of nodes in the model. |
Model to get total for
true if only existing nodes should be counted. If false or omitted referenced but undefined nodes will also be included in the total.
Returnsnumber of nodes Return typeNumber |
ExampleTo get the total number of nodes in model m: var total = Node.Total(m);
|
Unblank()DescriptionUnblanks the node |
No arguments
ReturnsNo return value |
ExampleTo unblank node n: n.Unblank();
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the nodes in the model. |
Model that all nodes 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 nodes in model m: Node.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged nodes in the model. |
Model that the flagged nodes will be unblanked in
Flag set on the nodes 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 nodes in model m flagged with f: Node.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the nodes in the model. |
Model that the defined flag for all nodes will be unset in
Flag to unset on the nodes
ReturnsNo return value |
ExampleTo unset the flag f on all the nodes in model m: Node.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the node. |
If model should be redrawn or not after the node is unsketched. If omitted redraw is true. If you want to unsketch several nodes and only redraw after the last one then use false for redraw and call View.Redraw().
ReturnsNo return value |
ExampleTo unsketch node n: n.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all nodes. |
Model that all nodes will be unblanked in
If model should be redrawn or not after the nodes 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 nodes in model m: Node.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged nodes in the model. |
Model that all nodes will be unsketched in
Flag set on the nodes that you want to unsketch
If model should be redrawn or not after the nodes 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 nodes flagged with flag in model m: Node.UnsketchAll(m, flag);
|
No arguments
ReturnsNode object. Return typeNode |
ExampleTo check if Node property n.example is a parameter by using the Node.GetParameter() method: if (n.ViewParameters().GetParameter(n.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for node. 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 node n: n.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this node. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for node n: var xrefs = n.Xrefs();
|
toString()DescriptionCreates a string containing the node data in keyword format. Note that this contains the keyword header and the keyword cards. See also Node.Keyword() and Node.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for node n in keyword format var s = n.toString();
|