Oasys.PRIMER.NodeSet class

Properties

property NodeSet.cnsid: integer

Constrained node set number (identical to label)

property NodeSet.colour: Colour

The colour of the node set

property NodeSet.dof: integer

Degree of freedom

property NodeSet.exists(read only): boolean

true if constrained node set exists, false if referred to but not defined

property NodeSet.id: boolean

true if _ID option is set, false if not

property NodeSet.include: integer

The Include file number that the constrained node set is in

property NodeSet.label: integer

Constrained node set number

property NodeSet.model(read only): integer

The Model number that the node set is in

property NodeSet.nsid: integer

Set Node ID

property NodeSet.tf: float

Failure time

Constructor

classmethod NodeSet(model, nsid, dof, tf, label=Oasys.gRPC.defaultArg)

Create a new NodeSet object

Parameters:
  • model (Model) – Model that constrained node set will be created in

  • nsid (integer) – Set Node ID

  • dof (integer) – Degree of freedom

  • tf (float) – Failure time

  • label (integer) – Optional. Constrained node set number

Returns:

NodeSet object

Return type:

dict

Example

To create a new constrained node set 500 in model m, of type SET, with node set 9, degree of freedom 1 and failure time 1000

n = Oasys.PRIMER.NodeSet(m, 9, 1, 1000, 500)

Static methods

classmethod NodeSet.BlankAll(model, redraw=Oasys.gRPC.defaultArg)

Blanks all of the node sets in the model

Parameters:
  • model (Model) – Model that all node sets will be blanked in

  • 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 node sets in model m:

Oasys.PRIMER.NodeSet.BlankAll(m)
classmethod NodeSet.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Blanks all of the flagged node sets in the model

Parameters:
  • model (Model) – Model that all the flagged node sets will be blanked in

  • flag (Flag) – Flag set on the node sets 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 node sets in model m flagged with f:

Oasys.PRIMER.NodeSet.BlankFlagged(m, f)
classmethod NodeSet.Create(model, modal=Oasys.gRPC.defaultArg)

Starts an interactive editing panel to create a node_set

Parameters:
  • model (Model) – Model that the node_set will be created in

  • 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:

NodeSet object (or None if not made)

Return type:

dict

Example

To start creating a node set in model n:

n = Oasys.PRIMER.NodeSet.Create(m)
classmethod NodeSet.First(model)

Returns the first node set in the model

Parameters:

model (Model) – Model to get first node set in

Returns:

NodeSet object (or None if there are no node sets in the model)

Return type:

NodeSet

Example

To get the first node set in model m:

ns = Oasys.PRIMER.NodeSet.First(m)
classmethod NodeSet.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the first free node set label in the model. Also see NodeSet.LastFreeLabel(), NodeSet.NextFreeLabel() and Model.FirstFreeItemLabel()

Parameters:
  • model (Model) – Model to get first free node set label in

  • layer (Include number) – Optional. 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)

Returns:

NodeSet label

Return type:

int

Example

To get the first free node set label in model m:

label = Oasys.PRIMER.NodeSet.FirstFreeLabel(m)
classmethod NodeSet.FlagAll(model, flag)

Flags all of the node sets in the model with a defined flag

Parameters:
  • model (Model) – Model that all node sets will be flagged in

  • flag (Flag) – Flag to set on the node sets

Returns:

No return value

Return type:

None

Example

To flag all of the node sets with flag f in model m:

Oasys.PRIMER.NodeSet.FlagAll(m, f)
classmethod NodeSet.GetAll(model)

Returns a list of NodeSet objects for all of the node sets in a model in PRIMER

Parameters:

model (Model) – Model to get node sets from

Returns:

List of NodeSet objects

Return type:

list

Example

To make a list of NodeSet objects for all of the node sets in model m

ns = Oasys.PRIMER.NodeSet.GetAll(m)
classmethod NodeSet.GetFlagged(model, flag)

Returns a list of NodeSet objects for all of the flagged node sets in a model in PRIMER

Parameters:
  • model (Model) – Model to get node sets from

  • flag (Flag) – Flag set on the node sets that you want to retrieve

Returns:

List of NodeSet objects

Return type:

list

Example

To make a list of NodeSet objects for all of the node sets in model m flagged with f

ns = Oasys.PRIMER.NodeSet.GetFlagged(m, f)
classmethod NodeSet.GetFromID(model, number)

Returns the NodeSet object for a node set ID

Parameters:
  • model (Model) – Model to find the node set in

  • number (integer) – number of the node set you want the NodeSet object for

Returns:

NodeSet object (or None if node set does not exist)

Return type:

NodeSet

Example

To get the NodeSet object for node set 100 in model m

ns = Oasys.PRIMER.NodeSet.GetFromID(m, 100)
classmethod NodeSet.Last(model)

Returns the last node set in the model

Parameters:

model (Model) – Model to get last node set in

Returns:

NodeSet object (or None if there are no node sets in the model)

Return type:

NodeSet

Example

To get the last node set in model m:

ns = Oasys.PRIMER.NodeSet.Last(m)
classmethod NodeSet.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the last free node set label in the model. Also see NodeSet.FirstFreeLabel(), NodeSet.NextFreeLabel() and see Model.LastFreeItemLabel()

Parameters:
  • model (Model) – Model to get last free node set label in

  • layer (Include number) – Optional. 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

Returns:

NodeSet label

Return type:

int

Example

To get the last free node set label in model m:

label = Oasys.PRIMER.NodeSet.LastFreeLabel(m)
classmethod NodeSet.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)

Returns the next free (highest+1) node set label in the model. Also see NodeSet.FirstFreeLabel(), NodeSet.LastFreeLabel() and Model.NextFreeItemLabel()

Parameters:
  • model (Model) – Model to get next free node set label in

  • layer (Include number) – Optional. 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)

Returns:

NodeSet label

Return type:

int

Example

To get the next free node set label in model m:

label = Oasys.PRIMER.NodeSet.NextFreeLabel(m)
classmethod NodeSet.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)

Allows the user to pick a node set

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 node sets from that model can be picked. If the argument is a Flag then only node sets that are flagged with limit can be selected. If omitted, or None, any node sets from any model can be selected. from any model

  • modal (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:

NodeSet object (or None if not picked)

Return type:

dict

Example

To pick a node set from model m giving the prompt ‘Pick node set from screen’:

ns = Oasys.PRIMER.NodeSet.Pick('Pick node set from screen', m)
classmethod NodeSet.RenumberAll(model, start)

Renumbers all of the node sets in the model

Parameters:
  • model (Model) – Model that all node sets will be renumbered in

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber all of the node sets in model m, from 1000000:

Oasys.PRIMER.NodeSet.RenumberAll(m, 1000000)
classmethod NodeSet.RenumberFlagged(model, flag, start)

Renumbers all of the flagged node sets in the model

Parameters:
  • model (Model) – Model that all the flagged node sets will be renumbered in

  • flag (Flag) – Flag set on the node sets that you want to renumber

  • start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber all of the node sets in model m flagged with f, from 1000000:

Oasys.PRIMER.NodeSet.RenumberFlagged(m, f, 1000000)
classmethod NodeSet.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)

Allows the user to select node sets using standard PRIMER object menus

Parameters:
  • flag (Flag) – Flag to use when selecting node sets

  • prompt (string) – Text to display as a prompt to the user

  • limit (Model or Flag) – Optional. If the argument is a Model then only node sets from that model can be selected. If the argument is a Flag then only node sets that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any node sets can be selected. from any model

  • modal (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 node sets selected or None if menu cancelled

Return type:

int

Example

To select node sets from model m, flagging those selected with flag f, giving the prompt ‘Select node sets’:

Oasys.PRIMER.NodeSet.Select(f, 'Select node sets', m)

To select node sets, flagging those selected with flag f but limiting selection to node sets flagged with flag l, giving the prompt ‘Select node sets’:

Oasys.PRIMER.NodeSet.Select(f, 'Select node sets', l)
classmethod NodeSet.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Sketches all of the flagged node sets in the model. The node sets will be sketched until you either call NodeSet.Unsketch(), NodeSet.UnsketchFlagged(), Model.UnsketchAll(), or delete the model

Parameters:
  • model (Model) – Model that all the flagged node sets will be sketched in

  • flag (Flag) – Flag set on the node sets that you want to sketch

  • redraw (boolean) – Optional. If model should be redrawn or not after the node sets are sketched. If omitted redraw is true. If you want to sketch flagged node sets 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 node sets flagged with flag in model m:

Oasys.PRIMER.NodeSet.SketchFlagged(m, flag)
classmethod NodeSet.Total(model, exists=Oasys.gRPC.defaultArg)

Returns the total number of node sets in the model

Parameters:
  • model (Model) – Model to get total for

  • exists (boolean) – Optional. true if only existing node sets should be counted. If false or omitted referenced but undefined node sets will also be included in the total

Returns:

number of node sets

Return type:

int

Example

To get the total number of node sets in model m:

total = Oasys.PRIMER.NodeSet.Total(m)
classmethod NodeSet.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the node sets in the model

Parameters:
  • model (Model) – Model that all node sets will be unblanked in

  • 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 node sets in model m:

Oasys.PRIMER.NodeSet.UnblankAll(m)
classmethod NodeSet.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the flagged node sets in the model

Parameters:
  • model (Model) – Model that the flagged node sets will be unblanked in

  • flag (Flag) – Flag set on the node sets 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 node sets in model m flagged with f:

Oasys.PRIMER.NodeSet.UnblankFlagged(m, f)
classmethod NodeSet.UnflagAll(model, flag)

Unsets a defined flag on all of the node sets in the model

Parameters:
  • model (Model) – Model that the defined flag for all node sets will be unset in

  • flag (Flag) – Flag to unset on the node sets

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the node sets in model m:

Oasys.PRIMER.NodeSet.UnflagAll(m, f)
classmethod NodeSet.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)

Unsketches all node sets

Parameters:
  • model (Model) – Model that all node sets will be unblanked in

  • redraw (boolean) – Optional. If model should be redrawn or not after the node sets 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 node sets in model m:

Oasys.PRIMER.NodeSet.UnsketchAll(m)
classmethod NodeSet.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Unsketches all flagged node sets in the model

Parameters:
  • model (Model) – Model that all node sets will be unsketched in

  • flag (Flag) – Flag set on the node sets that you want to unsketch

  • redraw (boolean) – Optional. If model should be redrawn or not after the node sets 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 node sets flagged with flag in model m:

Oasys.PRIMER.NodeSet.UnsketchAll(m, flag)

Instance methods

NodeSet.AssociateComment(comment)

Associates a comment with a node set

Parameters:

comment (Comment) – Comment that will be attached to the node set

Returns:

No return value

Return type:

None

Example

To associate comment c to the node set ns:

ns.AssociateComment(c)
NodeSet.Blank()

Blanks the node set

Returns:

No return value

Return type:

None

Example

To blank node set ns:

ns.Blank()
NodeSet.Blanked()

Checks if the node set is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if node set ns is blanked:

if ns.Blanked():
    do_something..
NodeSet.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 set ns:

ns.Browse()
NodeSet.ClearFlag(flag)

Clears a flag on the node set

Parameters:

flag (Flag) – Flag to clear on the node set

Returns:

No return value

Return type:

None

Example

To clear flag f for node set ns:

ns.ClearFlag(f)
NodeSet.Copy(range=Oasys.gRPC.defaultArg)

Copies the node set. The target include of the copied node set 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:

NodeSet object

Return type:

NodeSet

Example

To copy node set ns into node set z:

z = ns.Copy()
NodeSet.DetachComment(comment)

Detaches a comment from a node set

Parameters:

comment (Comment) – Comment that will be detached from the node set

Returns:

No return value

Return type:

None

Example

To detach comment c from the node set ns:

ns.DetachComment(c)
NodeSet.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 set ns:

ns.Edit()
NodeSet.ExtractColour()

Extracts the actual colour used for node set.
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 node set colour property will return the value Colour.PART instead of the actual colour. This method will return the actual colour which is used for drawing the node set

Returns:

colour value (integer)

Return type:

int

Example

To return the colour used for drawing node set ns:

colour = ns.ExtractColour()
NodeSet.Flagged(flag)

Checks if the node set is flagged or not

Parameters:

flag (Flag) – Flag to test on the node set

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if node set ns has flag f set on it:

if ns.Flagged(f):
    do_something..
NodeSet.GetComments()

Extracts the comments associated to a node set

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 set ns:

comm_list = ns.GetComments()
NodeSet.GetParameter(prop)

Checks if a NodeSet 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 NodeSet.ViewParameters() method and ‘method chaining’ (see the examples below)

Parameters:

prop (string) – node set property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if NodeSet property ns.example is a parameter:

Oasys.PRIMER.Options.property_parameter_names = True
if ns.GetParameter(ns.example):
    do_something...
Oasys.PRIMER.Options.property_parameter_names = False

To check if NodeSet property ns.example is a parameter by using the GetParameter method:

if ns.ViewParameters().GetParameter(ns.example):
    do_something..
NodeSet.Keyword()

Returns the keyword for this node_set (*CONSTRAINED_NODE_SET). Note that a carriage return is not added. See also NodeSet.KeywordCards()

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for node_set n:

key = n.Keyword()
NodeSet.KeywordCards()

Returns the keyword cards for the node_set. Note that a carriage return is not added. See also NodeSet.Keyword()

Returns:

string containing the cards

Return type:

str

Example

To get the cards for node_set n:

cards = n.KeywordCards()
NodeSet.Next()

Returns the next node set in the model

Returns:

NodeSet object (or None if there are no more node sets in the model)

Return type:

NodeSet

Example

To get the node set in model m after node set ns:

ns = ns.Next()
NodeSet.Previous()

Returns the previous node set in the model

Returns:

NodeSet object (or None if there are no more node sets in the model)

Return type:

NodeSet

Example

To get the node set in model m before node set ns:

ns = ns.Previous()
NodeSet.SetFlag(flag)

Sets a flag on the node set

Parameters:

flag (Flag) – Flag to set on the node set

Returns:

No return value

Return type:

None

Example

To set flag f for node set ns:

ns.SetFlag(f)
NodeSet.Sketch(redraw=Oasys.gRPC.defaultArg)

Sketches the node set. The node set will be sketched until you either call NodeSet.Unsketch(), NodeSet.UnsketchAll(), Model.UnsketchAll(), or delete the model

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the node set is sketched. If omitted redraw is true. If you want to sketch several node sets 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 set ns:

ns.Sketch()
NodeSet.Unblank()

Unblanks the node set

Returns:

No return value

Return type:

None

Example

To unblank node set ns:

ns.Unblank()
NodeSet.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the node set

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the node set is unsketched. If omitted redraw is true. If you want to unsketch several node sets 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 set ns:

ns.Unsketch()
NodeSet.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:

NodeSet object

Return type:

dict

Example

To check if NodeSet property ns.example is a parameter by using the NodeSet.GetParameter() method:

if ns.ViewParameters().GetParameter(ns.example):
    do_something..
NodeSet.Xrefs()

Returns the cross references for this node set

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for node set ns:

xrefs = ns.Xrefs()