Oasys.PRIMER.Set class¶
Constants¶
- Set.ADD¶
Set type is *SET_XYZ_ADD
- Set.ALL_TYPES¶
All set types - used in blanking etc
- Set.BEAM¶
Set beam type
- Set.BOX¶
Set box type
- Set.DISCRETE¶
Set discrete type
- Set.GENERAL¶
Set type is *SET_XYZ_GENERAL
- Set.GENERATE¶
Set type is *SET_XYZ_GENERATE
- Set.INTERSECT¶
Set type is *SET_XYZ_INTERSECT
- Set.MM_GROUP¶
Set multi-material group type
- Set.MODE¶
Set mode type
- Set.NODE¶
Set node type
- Set.PART¶
Set part type
- Set.PART_TREE¶
Set part tree type
- Set.PERI_LAMINATE¶
Set Peri Laminate type
- Set.SEGMENT¶
Set segment type
- Set.SEGMENT_2D¶
Set segment 2d type
- Set.SHELL¶
Set shell type
- Set.SOLID¶
Set solid type
- Set.TSHELL¶
Set thick shell type
Properties¶
- property Set.add: boolean¶
If _ADD option is active
- property Set.advanced(read only): boolean¶
If _ADD_ADVANCED option is active
- property Set.collect: boolean¶
If _COLLECT option is active. To manage _COLLECT sets PRIMER creates a ‘parent’ set that can be used to sketch/view all of the items from the _COLLECT sets with the same label. PRIMER then manages each _COLLECT set with the same label as a ‘child’ of this ‘parent’ set. Also see
collect_children
andGetCollectChild
. If the collect property is unset for a child collect set then a new label will be assigned for the child set. If the collect property is unset for a parent collect set then all of the child sets will be reassigned new labels
- property Set.collect_children(read only): integer¶
The number of child _COLLECT sets if _COLLECT option is active
- property Set.colour: Colour¶
The colour of the set
- property Set.column(read only): boolean¶
If _COLUMN option is active
- property Set.da1: float¶
The first default attribute for the set (only valid for Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
- property Set.da2: float¶
The second default attribute for the set (only valid for Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
- property Set.da3: float¶
The third default attribute for the set (only valid for Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
- property Set.da4: float¶
The fourth default attribute for the set (only valid for Set.NODE, Set.PART, Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
- property Set.exists(read only): boolean¶
true if set exists, false if referred to but not defined
- property Set.general: boolean¶
If _GENERAL option is active
- property Set.general_lines(read only): integer¶
Number of lines of data for _GENERAL set (if _GENERAL option is active)
- property Set.generate: boolean¶
If _GENERATE option is active
- property Set.increment(read only): boolean¶
If _GENERATE_INCREMENT option is active
- property Set.intersect: boolean¶
If _INTERSECT option is active
- property Set.its: integer¶
Coupling type across different scales in two-scale cosimulation (only valid for Set.SEGMENT or Set.NODE)
- property Set.label: integer¶
Set
number. Also see thesid
property which is an alternative name for this
- property Set.sid: integer¶
Set
number. Also see thelabel
property which is an alternative name for this
- property Set.smooth(read only): boolean¶
If _LIST_SMOOTH option is active
- property Set.solver: string¶
Solver to attach to set. Can be “MECH”, “CESE”, “EM”, “ICFD” or blank (only valid for Set.NODE, Set.PART, Set.SEGMENT and Set.SOLID)
- property Set.total(read only): integer¶
The total number of items in the set. Note that for _GENERAL and _GENERATE sets this is expensive to compute
- property Set.transparency: integer¶
The transparency of the set (0-100) 0% is opaque, 100% is transparent
- property Set.type(read only): constant¶
Set type. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
Constructor¶
- classmethod Set(model, sid, type, title=Oasys.gRPC.defaultArg, option=Oasys.gRPC.defaultArg)¶
Create a new
Set
object
- Parameters:
model (Model) –
Model
that set will be created insid (integer) –
Set
numbertype (constant) – Type of set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
title (string) – Optional. Title for the set
option (constant) – Optional. Set type. Can be
Set.ADD
,Set.INTERSECT
,Set.GENERAL
orSet.GENERATE
- Returns:
Set object
- Return type:
dict
Example
To create a new node set in model m with label 100:
s = Oasys.PRIMER.Set(m, 100, Oasys.PRIMER.Set.NODE)To create a new *NODE_SET_ADD in model m with label 101:
s = Oasys.PRIMER.Set(m, 101, Oasys.PRIMER.Set.NODE,"", Oasys.PRIMER.Set.ADD)
Static methods¶
- classmethod Set.BlankAll(model, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the sets in the model
- Parameters:
model (Model) –
Model
that all sets will be blanked intype (constant) – Optional. Type of sets to blank. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
.Set.ALL_TYPES
. If omitted sets of all types will be blankedredraw (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 sets in model m:
Oasys.PRIMER.Set.BlankAll(m)To blank all of the node sets in model m:
Oasys.PRIMER.Set.BlankAll(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.BlankFlagged(model, flag, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged sets in the model
- Parameters:
model (Model) –
Model
that all the flagged sets will be blanked inflag (Flag) – Flag set on the sets that you want to blank
type (constant) – Optional. Type of sets to blank. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
.Set.ALL_TYPES
. If set, only flagged sets of this type will be blanked. If omitted flagged sets of all types will be blankedredraw (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 sets in model m flagged with f:
Oasys.PRIMER.Set.BlankFlagged(m, f)To blank all of the node sets in model m flagged with f:
Oasys.PRIMER.Set.BlankFlagged(m, f, Oasys.PRIMER.Set.NODE)
- classmethod Set.Create(model, type, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a set
- Parameters:
model (Model) –
Model
that the set will be created intype (constant) – Type of the set that you want to create. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
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:
Set object (or None if not made)
- Return type:
dict
Example
To start creating a node set in model m:
s = Oasys.PRIMER.Set.Create(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.First(model, type)¶
Returns the first set in the model
- Parameters:
model (Model) –
Model
to get first set intype (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
- Returns:
Set object (or None if there are no sets in the model)
- Return type:
Set
Example
To get the first node set in model m:
n = Oasys.PRIMER.Set.First(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.FirstFreeLabel(model, type, layer=Oasys.gRPC.defaultArg)¶
Returns the first free set label in the model. Also see
Set.LastFreeLabel()
,Set.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
model (Model) –
Model
to get first free Set label intype (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
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:
Set label
- Return type:
int
Example
To get the first free node set label in model m:
label = Oasys.PRIMER.Set.FirstFreeLabel(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.FlagAll(model, flag, type=Oasys.gRPC.defaultArg)¶
Flags all of the sets in the model with a defined flag
- Parameters:
model (Model) –
Model
that all sets will be flagged inflag (Flag) – Flag to set on the sets
type (constant) – Optional. Type of the set. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
. If set, only sets of this type will be flagged. If omitted sets of all types will be flagged- Returns:
No return value
- Return type:
None
Example
To flag all of the node sets with flag f in model m:
Oasys.PRIMER.Set.FlagAll(m, f, Oasys.PRIMER.Set.NODE)
- classmethod Set.GetAll(model, type)¶
Returns a list of Set objects for all of the sets in a models in PRIMER
- Parameters:
model (Model) –
Model
to get sets fromtype (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
- Returns:
List of Set objects
- Return type:
list
Example
To make a list of Set objects for all of the node sets in model m
n = Oasys.PRIMER.Set.GetAll(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.GetFlagged(model, flag, type)¶
Returns a list of Set objects for all of the flagged sets in a models in PRIMER
- Parameters:
model (Model) –
Model
to get sets fromflag (Flag) – Flag set on the set that you want to retrieve
type (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
- Returns:
List of Set objects
- Return type:
list
Example
To make a list of Set objects for all of the node sets in model m flagged with f
n = Oasys.PRIMER.Set.GetFlagged(m, f, Oasys.PRIMER.Set.NODE)
- classmethod Set.GetFromID(model, set_number, type)¶
Returns the Set object for a set ID
- Parameters:
model (Model) –
Model
to find the set inset_number (integer) – number of the set you want the Set object for
type (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
- Returns:
Set object (or None if set does not exist)
- Return type:
Set
Example
To get the Set object for node set 100 in model m
n = Oasys.PRIMER.Set.GetFromID(m, 100, Oasys.PRIMER.Set.NODE)
- classmethod Set.Last(model, type)¶
Returns the last set in the model
- Parameters:
model (Model) –
Model
to get last set intype (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
- Returns:
Set object (or None if there are no sets in the model)
- Return type:
Set
Example
To get the last node set in model m:
n = Oasys.PRIMER.Set.Last(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.LastFreeLabel(model, type, layer=Oasys.gRPC.defaultArg)¶
Returns the last free set label in the model. Also see
Set.FirstFreeLabel()
,Set.NextFreeLabel()
andModel.LastFreeItemLabel()
- Parameters:
model (Model) –
Model
to get last free Set label intype (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
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:
Set label
- Return type:
int
Example
To get the last free node set label in model m:
label = Oasys.PRIMER.Set.LastFreeLabel(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.NextFreeLabel(model, type, layer=Oasys.gRPC.defaultArg)¶
Returns the next free set label in the model. Also see
Set.FirstFreeLabel()
,Set.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
model (Model) –
Model
to get next free Set label intype (constant) – Type of the set. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
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:
Set label
- Return type:
int
Example
To get the next free node set label in model m:
label = Oasys.PRIMER.Set.NextFreeLabel(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.Pick(type, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a set
- Parameters:
type (constant) – Type of sets to pick. Can be
Set.BEAM
,Set.BOX
,Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only sets from that model can be picked. If the argument is aFlag
then only sets that are flagged with limit can be selected. If omitted, or None, any sets 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:
Set object (or None if not picked)
- Return type:
dict
Example
To pick a node set from model m giving the prompt ‘Pick set from screen’:
n = Oasys.PRIMER.Set.Pick(Oasys.PRIMER.Set.NODE, 'Pick set from screen', m)
- classmethod Set.RenumberAll(model, start, type=Oasys.gRPC.defaultArg)¶
Renumbers all of the sets in the model
- Parameters:
model (Model) –
Model
that all sets will be renumbered instart (integer) – Start point for renumbering
type (constant) – Optional. Type of sets to renumber. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
. If omitted sets of all types will be blanked- Returns:
No return value
- Return type:
None
Example
To renumber all of the sets in model m, from 1000000:
Oasys.PRIMER.Set.RenumberAll(m, 1000000)To renumber all of the node sets in model m, from 1000000:
Oasys.PRIMER.Set.RenumberAll(m, 1000000, Oasys.PRIMER.Set.NODE)
- classmethod Set.RenumberFlagged(model, flag, start, type=Oasys.gRPC.defaultArg)¶
Renumbers all of the flagged sets in the model
- Parameters:
model (Model) –
Model
that all the flagged sets will be renumbered inflag (Flag) – Flag set on the sets that you want to renumber
start (integer) – Start point for renumbering
type (constant) – Optional. Type of sets to renumber. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
. If omitted sets of all types will be blanked- Returns:
No return value
- Return type:
None
Example
To renumber all of the sets in model m flagged with f, from 1000000:
Oasys.PRIMER.Set.RenumberFlagged(m, f, 1000000)To renumber all of the node sets in model m flagged with f, from 1000000:
Oasys.PRIMER.Set.RenumberFlagged(m, f, 1000000, Oasys.PRIMER.Set.NODE)
- classmethod Set.Select(type, flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select sets using standard PRIMER object menus
- Parameters:
type (constant) – Type of sets to pick. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
flag (Flag) – Flag to use when selecting 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 sets from that model can be selected. If the argument is aFlag
then only sets that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any sets from any model can be selectedmodal (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 items 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 sets’:
Oasys.PRIMER.Set.Select(Oasys.PRIMER.Set.NODE, f, 'Select sets', m)
- classmethod Set.SketchFlagged(model, flag, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged sets in the model
- Parameters:
model (Model) –
Model
that all the flagged sets will be sketched inflag (Flag) – Flag set on the sets that you want to sketch
type (constant) – Optional. Type of sets to sketch. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
.Set.ALL_TYPES
. If set, only flagged sets of this type will be sketched. If omitted flagged sets of all types will be sketchedredraw (boolean) – Optional. If model should be redrawn or not. If omitted redraw is true. If you want to do several (un)sketches 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 sketch all of the sets in model m flagged with f:
Oasys.PRIMER.Set.SketchFlagged(m, f)To sketch all of the node sets in model m flagged with f:
Oasys.PRIMER.Set.SketchFlagged(m, f, Oasys.PRIMER.Set.NODE)
- classmethod Set.UnblankAll(model, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the sets in the model
- Parameters:
model (Model) –
Model
that all sets will be unblanked intype (constant) – Optional. Type of sets to unblank. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
.Set.ALL_TYPES
. If omitted sets of all types will be blankedredraw (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 sets in model m:
Oasys.PRIMER.Set.UnblankAll(m)To unblank all of the node sets in model m:
Oasys.PRIMER.Set.UnblankAll(m, Oasys.PRIMER.Set.NODE)
- classmethod Set.UnblankFlagged(model, flag, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged sets in the model
- Parameters:
model (Model) –
Model
that the flagged sets will be unblanked inflag (Flag) – Flag set on the sets that you want to unblank
type (constant) – Optional. Type of sets to unblank. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
.Set.ALL_TYPES
. If set, only flagged sets of this type will be unblanked. If omitted flagged sets of all types will be unblankedredraw (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 sets in model m flagged with f:
Oasys.PRIMER.Set.UnblankFlagged(m, f)To unblank all of the node sets in model m flagged with f:
Oasys.PRIMER.Set.UnblankFlagged(m, f, Oasys.PRIMER.Set.NODE)
- classmethod Set.UnflagAll(model, flag, type=Oasys.gRPC.defaultArg)¶
Unsets a defined flag on all of the sets in the model
- Parameters:
model (Model) –
Model
that the defined flag for all sets will be unset inflag (Flag) – Flag to unset on the sets
type (constant) – Optional. Type of the set. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.MODE
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the sets in model m:
Oasys.PRIMER.Set.UnflagAll(m, f)
- classmethod Set.UnsketchAll(model, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all sets
- Parameters:
model (Model) –
Model
that all sets will be unsketched intype (constant) – Optional. Type of sets to unsketch. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
. If omitted sets of all types will be unsketchedredraw (boolean) – Optional. If model should be redrawn or not after the 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 sets in model m:
Oasys.PRIMER.Set.UnsketchAll(m)
- classmethod Set.UnsketchFlagged(model, flag, type=Oasys.gRPC.defaultArg, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged sets
- Parameters:
model (Model) –
Model
that all sets will be unsketched inflag (Flag) – Flag set on the sets that you want to unsketch
type (constant) – Optional. Type of sets to unsketch. Can be
Set.BEAM
,Set.BOX
Set.DISCRETE
,Set.MM_GROUP
,Set.NODE
,Set.PART
,Set.PART_TREE
,Set.PERI_LAMINATE
,Set.SEGMENT
,Set.SEGMENT_2D
,Set.SHELL
,Set.SOLID
orSet.TSHELL
. If omitted sets of all types will be unsketchedredraw (boolean) – Optional. If model should be redrawn or not after the 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 sets in model m flagged with f:
Oasys.PRIMER.Set.UnsketchFlagged(m, f)To unsketch all of the node sets in model m flagged with f:
Oasys.PRIMER.Set.UnsketchFlagged(m, f, Oasys.PRIMER.Set.NODE)
Instance methods¶
- Set.Add(id1, id2=Oasys.gRPC.defaultArg, id3=Oasys.gRPC.defaultArg, id4=Oasys.gRPC.defaultArg)¶
Adds an item to the set. This cannot be used for _COLUMN and _GENERAL sets. For segment sets four nodes must be given to define a segment to add to the set
- Parameters:
id1 (integer) – id of the item to add to the set (normal, _ADD or _ADD_ADVANCED sets) or Start ID (_GENERATE sets)
id2 (integer) – Optional. type of the item to add to the set [1-7] (_ADD_ADVANCED sets) or End ID (_GENERATE sets)
(only for SEGMENT, _GENERATE, _GENERATE_INCREMENT and _ADD_ADVANCED sets)id3 (integer) – Optional. Increment for _GENERATE_INCREMENT sets, otherwise id of the item to add to the set
(only for SEGMENT and _GENERATE_INCREMENT sets)id4 (integer) – Optional. id of the item to add to the set
(only for SEGMENT sets)- Returns:
No return value
- Return type:
None
Example
To add node 10 to node set ns:
ns.Add(10)To add segment 10, 11, 12, 13 to segment set ss:
ss.Add(10, 11, 12, 13)
SET PART TREE is a special type of set, which can contain PARTs (negative) and/or child SET PART TREEs (positive).
To add part 10 to SET PART TREE spt:spt.Add(-10)To add child SET PART TREE 20 to SET PART TREE spt:
spt.Add(20)
- Set.AddCollectChild(set)¶
Adds a child collect set to the set. The child set label will be changed to be the same as the parent set and it will become a child. Also see
Set.collect_children
andSet.GetCollectChild
- Parameters:
set (Set) –
Set
to be added as a child collect set- Returns:
No return value
- Return type:
None
Example
To make set ns2 to node set ns:
ns.AddCollectChild(ns2)
- Set.AddFlagged(flag)¶
Adds flagged items to the set. This cannot be used for _GENERAL or _GENERATE sets and cannot be used for segment sets
- Parameters:
flag (Flag) – Flag for items to add to the set
- Returns:
No return value
- Return type:
None
Example
To add any nodes flagged with flag f to node set ns:
ns.AddFlagged(f)
- Set.Blanked()¶
Checks if the set is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if set s is blanked:
s.Blanked() )
- Set.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 set s:
s.Browse()
- Set.ClearFlag(flag)¶
Clears a flag on the set
- Parameters:
flag (Flag) – Flag to clear on the set
- Returns:
No return value
- Return type:
None
Example
To clear flag f for set s:
s.ClearFlag(f)
- Set.Contains(id)¶
Checks if an item is in the set. This cannot be used for ADD_ADVANCED, _GENERAL or _GENERATE sets and cannot be used for segment sets
- Parameters:
id (integer) – id of the item to check
- Returns:
True if item is in set, False if not
- Return type:
bool
Example
To see if node 10 is in node set ns:
if (ns.Contains(10)): do something...
- Set.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the set
- Parameters:
range (boolean) – Optional. If you want to keep the copied item in the range specified for the current include. To set current include, use :py:meth:` Include.MakeCurrentLayer() <Include.MakeCurrentLayer>`
- Returns:
Set object
- Return type:
Set
Example
To copy node net ns into node net ns1:
ns1 = ns.Copy()
- Set.Edit(modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to edit the set
- 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 set s:
s.Edit()
- Set.Empty()¶
Removes all items from the set. This cannot be used for _GENERATE sets and cannot be used for segment sets
- Returns:
No return value
- Return type:
None
Example
To remove all nodes from node set ns:
ns.Empty(f)
- Set.Flagged(flag)¶
Checks if the set is flagged or not
- Parameters:
flag (Flag) – Flag to clear on the set
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if set s has flag f set on it:
s.Flagged(f) )
- Set.GetCollectChild(number)¶
Returns a child collect set. Also see
Set.collect_children
andSet.AddCollectChild
- Parameters:
number (Integer) – The index of the child collect set to return. Note that indices start at 0, not 1
- Returns:
Set object
- Return type:
dict
Example
To loop over the child collect sets for set ns:
if (ns.collect): for i in range(ns.collect_children): child = ns.GetCollectChild(i)
- Set.GetGeneralData(index)¶
Returns a line of data for a GENERAL set
- Parameters:
index (Integer) – The index of the GENERAL data to return. Note that indices start at 0, not 1.
0 <= index <general_lines
- Returns:
List containing data
- Return type:
list
Example
To loop over the lines of general data sets for set s:
if (s.general): for i in range(s.general_lines): data = s.GetGeneralData(i)
- Set.Keyword()¶
Returns the keyword for this set (*SET_NODE etc). Note that a carriage return is not added. See also
Set.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for set s:
key = s.Keyword()
- Set.KeywordCards()¶
Returns the keyword cards for the set. Note that a carriage return is not added. See also
Set.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for set s:
cards = s.KeywordCards()
- Set.Next()¶
Returns the next set in the model
- Returns:
Set object (or None if there are no more sets in the model)
- Return type:
Set
Example
To get the set in model m after set n:
n = n.Next()
- Set.Previous()¶
Returns the previous set in the model
- Returns:
Set object (or None if there are no more sets in the model)
- Return type:
Set
Example
To get the set in model m before this one:
s = s.Previous()
- Set.RebuildCache()¶
Rebuilds the cache for a set. As sets can be built using complex combinations of _GENERAL, _ADD, _INTERSECT options etc PRIMER creates a ‘cache’ for the set to speed up set drawing and usage. During normal interactive use this cache is rebuilt as necessary but in JavaScript it is possible for the cache to become out of date (e.g. you change a box position in JavaScript that is used by a *SET_GENERAL). Calling this forces the cache to be rebuilt
- Returns:
No return type
- Return type:
None
Example
To rebuild the cache for set s:
s.RebuildCache()
- Set.Remove(id)¶
Removes an item from the set. If the item is not in the set nothing is done. This cannot be used for ADD_ADVANCED, _COLUMN, _GENERAL or _GENERATE sets and cannot be used for segment sets
- Parameters:
id (integer) – id of the item to remove from the set
- Returns:
No return value
- Return type:
None
Example
To remove node 10 from node set ns:
ns.Remove(10)
- Set.RemoveFlagged(flag)¶
Removes flagged items from the set. This cannot be used for _GENERAL or _GENERATE sets and cannot be used for segment sets
- Parameters:
flag (Flag) – Flag for items to remove from the set
- Returns:
No return value
- Return type:
None
Example
To remove any nodes flagged with flag f from node set ns:
ns.RemoveFlagged(f)
- Set.RemoveGeneralData(index)¶
Removes a line of data from a GENERAL set
- Parameters:
index (Integer) – The index of the GENERAL data to remove. Note that indices start at 0, not 1.
0 <= index <general_lines
- Returns:
No return value
- Return type:
None
Example
To remove the first line of general data sets for set s:
if (s.general): s.RemoveGeneralData(0)
- Set.SetFlag(flag)¶
Sets a flag on the set
- Parameters:
flag (Flag) – Flag to set on the set
- Returns:
No return value
- Return type:
None
Example
To set flag f for set s:
s.SetFlag(f)
- Set.SetGeneralData(index, data)¶
Sets a line of data for a GENERAL set
- Parameters:
index (Integer) – The index of the GENERAL data to set. Note that indices start at 0, not 1.
0 <= index <=general_lines
data (List of data) – List containing GENERAL data to set
- Returns:
No return value
- Return type:
None
Example
To add nodes inside boxes 1, 2 and 3 as a new line of data to node general set s:
data = ["BOX", 1, 2, 3] s.SetGeneralData(s.general_lines, data)
- Set.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the set. The set will be sketched until you either call
Set.Unsketch()
,Set.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the set is sketched. If omitted redraw is true. If you want to sketch several 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 set s:
s.Sketch()
- Set.Spool()¶
Spools a set, entry by entry. See also
Set.StartSpool
- Returns:
For Set.SEGMENT returns a list containing node IDs, for all other set types returns the ID of the item. Returns 0 if no more items
- Return type:
list
Example
To spool set s:
s.StartSpool() while id := s.Spool(): do something..
- Set.StartSpool(raw=Oasys.gRPC.defaultArg)¶
Starts a set spooling operation. See also
Set.Spool
- Parameters:
raw (boolean) – Optional. If true then the raw data from _GENERATE, _ADD and _INTERSECT sets will be returned instead of expanding the data ranges or child set contents. If omitted raw will be false
- Returns:
No return value
- Return type:
None
Example
To start spooling set s:
s.StartSpool()
- Set.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the set
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the set is unsketched. If omitted redraw is true. If you want to unsketch several 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 set s:
s.Unsketch()
- Set.Xrefs()¶
Returns the cross references for this set
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for this set:
xrefs = s.Xrefs()