Oasys.PRIMER.Node class¶
Constants¶
Properties¶
- property Node.colour: Colour¶
The colour of the node
- property Node.exists(read only): boolean¶
true if node exists, false if referred to but not defined
- property Node.label: integer¶
Node
number. Also see thenid
property which is an alternative name for this
- property Node.ndof: integer¶
Number of degrees of freedom (SCALAR and SCALAR_VALUE only)
- property Node.nid: integer¶
Node
number. Also see thelabel
property which is an alternative name for this
- property Node.rc: integer¶
Rotational constraint (0-7)
- property Node.scalar: integer¶
The type of the node. Can be false (*NODE), Node.SCALAR (*NODE_SCALAR) or Node.SCALAR_VALUE (*NODE_SCALAR_VALUE)
- property Node.tc: integer¶
Translational constraint (0-7)
- property Node.x: float¶
X coordinate
- property Node.x1: integer¶
Initial value of 1st degree of freedom (SCALAR_VALUE only)
- property Node.x2: integer¶
Initial value of 2nd degree of freedom (SCALAR_VALUE only)
- property Node.x3: integer¶
Initial value of 3rd degree of freedom (SCALAR_VALUE only)
- property Node.y: float¶
Y coordinate
- property Node.z: float¶
Z coordinate
Constructor¶
- classmethod Node(model, nid, x, y, z, tc=Oasys.gRPC.defaultArg, rc=Oasys.gRPC.defaultArg)¶
Create a new
Node
object
- Parameters:
model (Model) –
Model
that node will be created innid (integer) –
Node
numberx (float) – X coordinate
y (float) – Y coordinate
z (float) – Z coordinate
tc (integer) – Optional. Translational constraint (0-7). If omitted tc will be set to 0
rc (integer) – Optional. Rotational constraint (0-7). If omitted rc will be set to 0
- Returns:
Node object
- Return type:
dict
Example
To create a new node in model m with label 100, at coordinates (20, 40, 10)
n = Oasys.PRIMER.Node(m, 100, 20, 40, 10)
Static methods¶
- classmethod Node.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the nodes in the model
- Parameters:
model (Model) –
Model
that all nodes will be blanked inredraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To blank all of the nodes in model m:
Oasys.PRIMER.Node.BlankAll(m)
- classmethod Node.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged nodes in the model
- Parameters:
model (Model) –
Model
that all the flagged nodes will be blanked inflag (Flag) – Flag set on the nodes that you want to blank
redraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To blank all of the nodes in model m flagged with f:
Oasys.PRIMER.Node.BlankFlagged(m, f)
- classmethod Node.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a node
- Parameters:
model (Model) –
Model
that the node will be created inmodal (boolean) – Optional. 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
- Returns:
Node object (or None if not made)
- Return type:
dict
Example
To start creating a node in model m:
n = Oasys.PRIMER.Node.Create(m)
- classmethod Node.First(model)¶
Returns the first node in the model
- Parameters:
model (Model) –
Model
to get first node in- Returns:
Node object (or None if there are no nodes in the model)
- Return type:
Node
Example
To get the first node in model m:
n = Oasys.PRIMER.Node.First(m)
- classmethod Node.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free node label in the model. Also see
Node.LastFreeLabel()
,Node.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
Node label
- Return type:
int
Example
To get the first free node label in model m:
label = Oasys.PRIMER.Node.FirstFreeLabel(m)
- classmethod Node.FlagAll(model, flag)¶
Flags all of the nodes in the model with a defined flag
- Parameters:
model (Model) –
Model
that all nodes will be flagged inflag (Flag) – Flag to set on the nodes
- Returns:
No return value
- Return type:
None
Example
To flag all of the nodes with flag f in model m:
Oasys.PRIMER.Node.FlagAll(m, f)
- classmethod Node.GetAll(model)¶
Returns a list of Node objects for all of the nodes in a model in PRIMER
- Parameters:
model (Model) –
Model
to get nodes from- Returns:
List of Node objects
- Return type:
list
Example
To make a list of Node objects for all of the nodes in model m
n = Oasys.PRIMER.Node.GetAll(m)
- classmethod Node.GetFlagged(model, flag)¶
Returns a list of Node objects for all of the flagged nodes in a model in PRIMER
- Parameters:
model (Model) –
Model
to get nodes fromflag (Flag) – Flag set on the nodes that you want to retrieve
- Returns:
List of Node objects
- Return type:
list
Example
To make a list of Node objects for all of the nodes in model m flagged with f
n = Oasys.PRIMER.Node.GetFlagged(m, f)
- classmethod Node.GetFromID(model, number)¶
Returns the Node object for a node ID
- Parameters:
model (Model) –
Model
to find the node innumber (integer) – number of the node you want the Node object for
- Returns:
Node object (or None if node does not exist)
- Return type:
Node
Example
To get the Node object for node 100 in model m
n = Oasys.PRIMER.Node.GetFromID(m, 100)
- classmethod Node.Last(model)¶
Returns the last node in the model
- Parameters:
model (Model) –
Model
to get last node in- Returns:
Node object (or None if there are no nodes in the model)
- Return type:
Node
Example
To get the last node in model m:
n = Oasys.PRIMER.Node.Last(m)
- classmethod Node.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free node label in the model. Also see
Node.FirstFreeLabel()
,Node.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
Node label
- Return type:
int
Example
To get the last free node label in model m:
label = Oasys.PRIMER.Node.LastFreeLabel(m)
- classmethod Node.Merge(model, flag, dist, label=Oasys.gRPC.defaultArg, position=Oasys.gRPC.defaultArg)¶
Attempts 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 seeModel.MergeNodes()
- Parameters:
model (Model) –
Model
that the nodes will be merged inflag (Flag) – Flag set on nodes to nodes
dist (float) – Nodes closer than dist will be potentially merged
label (integer) – Optional. 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 (integer) – Optional. 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
- Returns:
The number of nodes merged
- Return type:
int
Example
To (try to) merge nodes in model m flagged with flag f, with a distance of 0.1:
Oasys.PRIMER.Node.Merge(m, f, 0.1)
- classmethod Node.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) node label in the model. Also see
Node.FirstFreeLabel()
,Node.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
Node label
- Return type:
int
Example
To get the next free node label in model m:
label = Oasys.PRIMER.Node.NextFreeLabel(m)
- classmethod Node.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a node
- Parameters:
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only nodes from that model can be picked. If the argument is aFlag
then only nodes that are flagged with limit can be selected. If omitted, or None, any nodes from any model can be selected. from any modelmodal (boolean) – Optional. 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
button_text (string) – Optional. By default the window with the prompt will have a button labelled ‘Cancel’ which if pressed will cancel the pick and return None. If you want to change the text on the button use this argument. If omitted ‘Cancel’ will be used
- Returns:
Node object (or None if not picked)
- Return type:
dict
Example
To pick a node from model m giving the prompt ‘Pick node from screen’:
n = Oasys.PRIMER.Node.Pick('Pick node from screen', m)
- classmethod Node.RenumberAll(model, start)¶
Renumbers all of the nodes in the model
- Parameters:
model (Model) –
Model
that all nodes will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the nodes in model m, from 1000000:
Oasys.PRIMER.Node.RenumberAll(m, 1000000)
- classmethod Node.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged nodes in the model
- Parameters:
model (Model) –
Model
that all the flagged nodes will be renumbered inflag (Flag) – Flag set on the nodes that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the nodes in model m flagged with f, from 1000000:
Oasys.PRIMER.Node.RenumberFlagged(m, f, 1000000)
- classmethod Node.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select nodes using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting nodes
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only nodes from that model can be selected. If the argument is aFlag
then only nodes that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any nodes can be selected. from any modelmodal (boolean) – Optional. 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
- Returns:
Number of nodes selected or None if menu cancelled
- Return type:
int
Example
To select nodes from model m, flagging those selected with flag f, giving the prompt ‘Select nodes’:
Oasys.PRIMER.Node.Select(f, 'Select nodes', m)To select nodes, flagging those selected with flag f but limiting selection to nodes flagged with flag l, giving the prompt ‘Select nodes’:
Oasys.PRIMER.Node.Select(f, 'Select nodes', l)
- classmethod Node.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches 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
- Parameters:
model (Model) –
Model
that all the flagged nodes will be sketched inflag (Flag) – Flag set on the nodes that you want to sketch
redraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To sketch all nodes flagged with flag in model m:
Oasys.PRIMER.Node.SketchFlagged(m, flag)
- classmethod Node.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of nodes in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing nodes should be counted. If false or omitted referenced but undefined nodes will also be included in the total
- Returns:
number of nodes
- Return type:
int
Example
To get the total number of nodes in model m:
total = Oasys.PRIMER.Node.Total(m)
- classmethod Node.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the nodes in the model
- Parameters:
model (Model) –
Model
that all nodes will be unblanked inredraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To unblank all of the nodes in model m:
Oasys.PRIMER.Node.UnblankAll(m)
- classmethod Node.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged nodes in the model
- Parameters:
model (Model) –
Model
that the flagged nodes will be unblanked inflag (Flag) – Flag set on the nodes that you want to unblank
redraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To unblank all of the nodes in model m flagged with f:
Oasys.PRIMER.Node.UnblankFlagged(m, f)
- classmethod Node.UnflagAll(model, flag)¶
Unsets a defined flag on all of the nodes in the model
- Parameters:
model (Model) –
Model
that the defined flag for all nodes will be unset inflag (Flag) – Flag to unset on the nodes
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the nodes in model m:
Oasys.PRIMER.Node.UnflagAll(m, f)
- classmethod Node.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all nodes
- Parameters:
model (Model) –
Model
that all nodes will be unblanked inredraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To unsketch all nodes in model m:
Oasys.PRIMER.Node.UnsketchAll(m)
- classmethod Node.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged nodes in the model
- Parameters:
model (Model) –
Model
that all nodes will be unsketched inflag (Flag) – Flag set on the nodes that you want to unsketch
redraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To unsketch all nodes flagged with flag in model m:
Oasys.PRIMER.Node.UnsketchAll(m, flag)
Instance methods¶
- Node.AssociateComment(comment)¶
Associates a comment with a node
- Parameters:
comment (Comment) –
Comment
that will be attached to the node- Returns:
No return value
- Return type:
None
Example
To associate comment c to the node n:
n.AssociateComment(c)
- Node.Blank()¶
Blanks the node
- Returns:
No return value
- Return type:
None
Example
To blank node n:
n.Blank()
- Node.Blanked()¶
Checks if the node is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if node n is blanked:
if n.Blanked(): do_something..
- Node.Browse(modal=Oasys.gRPC.defaultArg)¶
Starts an edit panel in Browse mode
- Parameters:
modal (boolean) – Optional. 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
- Returns:
no return value
- Return type:
None
Example
To Browse node n:
n.Browse()
- Node.ClearFlag(flag)¶
Clears a flag on the node
- Parameters:
flag (Flag) – Flag to clear on the node
- Returns:
No return value
- Return type:
None
Example
To clear flag f for node n:
n.ClearFlag(f)
- Node.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the node. The target include of the copied node can be set using
Options.copy_target_include
- Parameters:
range (boolean) – Optional. 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()
- Returns:
Node object
- Return type:
Node
Example
To copy node n into node z:
z = n.Copy()
- Node.DetachComment(comment)¶
Detaches a comment from a node
- Parameters:
comment (Comment) –
Comment
that will be detached from the node- Returns:
No return value
- Return type:
None
Example
To detach comment c from the node n:
n.DetachComment(c)
- Node.Edit(modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel
- Parameters:
modal (boolean) – Optional. 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
- Returns:
no return value
- Return type:
None
Example
To Edit node n:
n.Edit()
- Node.ExtractColour()¶
Extracts the actual colour used for node.
By default in PRIMER many entities such as elements get their colour automatically from the part that they are in. PRIMER cycles through 13 default colours based on the label of the entity. In this case the nodecolour
property will return the valueColour.PART
instead of the actual colour. This method will return the actual colour which is used for drawing the node
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing node n:
colour = n.ExtractColour()
- Node.Flagged(flag)¶
Checks if the node is flagged or not
- Parameters:
flag (Flag) – Flag to test on the node
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if node n has flag f set on it:
if n.Flagged(f): do_something..
- Node.GetAttachedShells(recursive=Oasys.gRPC.defaultArg)¶
Returns the shells that are attached to the node
- Parameters:
recursive (boolean) – Optional. 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- Returns:
List of Shell objects (or None if there are no attached shells)
- Return type:
list
Example
To find the shells attached to node n, growing the selection until no more shells can be found:
shell_list = n.GetAttachedShells(True)
- Node.GetComments()¶
Extracts the comments associated to a node
- Returns:
List of Comment objects (or None if there are no comments associated to the node)
- Return type:
list
Example
To get the list of comments associated to the node n:
comm_list = n.GetComments()
- Node.GetFreeEdgeNodes()¶
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 list 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.
- Returns:
List of Node objects (or None if not on a shell free edge)
- Return type:
list
Example
To find all the nodes on the hole/boundary that node n is on:
node_list = n.GetFreeEdgeNodes()
- Node.GetInitialVelocities()¶
Returns 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 :py:meth:` Model.PopNodeVels <Model.PopulateInitialVelocities>`
- Returns:
List containing the 3 translational and 3 rotational velocity values
- Return type:
list
Example
To get the initial velocity of the node n:
vel = n.GetInitialVelocities()
- Node.GetParameter(prop)¶
Checks 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 theNode.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – node property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Node property n.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if n.GetParameter(n.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if Node property n.example is a parameter by using the GetParameter method:
if n.ViewParameters().GetParameter(n.example): do_something..
- Node.GetReferenceGeometry()¶
Returns the airbag reference geometry of the node
- Returns:
The reference geometry ID of the node (or 0 if it hasn’t got any)
- Return type:
int
Example
To get the reference geometry of the node n:
a = n.GetReferenceGeometry()
- Node.Keyword()¶
Returns the keyword for this node (*NODE, *NODE_SCALAR or *NODE_SCALAR_VALUE). Note that a carriage return is not added. See also
Node.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for node n:
key = n.Keyword()
- Node.KeywordCards()¶
Returns the keyword cards for the node. Note that a carriage return is not added. See also
Node.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for node n:
cards = n.KeywordCards()
- Node.Next()¶
Returns the next node in the model
- Returns:
Node object (or None if there are no more nodes in the model)
- Return type:
Node
Example
To get the node in model m after node n:
n = n.Next()
- Node.NodalMass()¶
Get the mass of a node. This will be the sum of the structural element mass attached to the node plus any lumped mass. If called on the node of a PART_INERTIA or NRBC_INERTIA, this function will return the mass of the part/nrbc, as ‘nodal mass’ has no meaning in this context
- Returns:
float
- Return type:
float
Example
To get the mass for node n:
mass = n.NodalMass()
- Node.Previous()¶
Returns the previous node in the model
- Returns:
Node object (or None if there are no more nodes in the model)
- Return type:
Node
Example
To get the node in model m before node n:
n = n.Previous()
- Node.SetFlag(flag)¶
Sets a flag on the node
- Parameters:
flag (Flag) – Flag to set on the node
- Returns:
No return value
- Return type:
None
Example
To set flag f for node n:
n.SetFlag(f)
- Node.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the node. The node will be sketched until you either call
Node.Unsketch()
,Node.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To sketch node n:
n.Sketch()
- Node.Unblank()¶
Unblanks the node
- Returns:
No return value
- Return type:
None
Example
To unblank node n:
n.Unblank()
- Node.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the node
- Parameters:
redraw (boolean) – Optional. 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()
- Returns:
No return value
- Return type:
None
Example
To unsketch node n:
n.Unsketch()
- Node.ViewParameters()¶
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. This function temporarily changes the behaviour so that if a property is a parameter the parameter name is returned instead. This can be used with ‘method chaining’ (see the example below) to make sure a property argument is correct
- Returns:
Node object
- Return type:
dict
Example
To check if Node property n.example is a parameter by using the
Node.GetParameter()
method:if n.ViewParameters().GetParameter(n.example): do_something..
- Node.Xrefs()¶
Returns the cross references for this node
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for node n:
xrefs = n.Xrefs()