Oasys.PRIMER.MassPart class¶
Constants¶
Properties¶
- property MassPart.addmass: float¶
Added translational mass to be distributed to the nodes of the part or part set ID
- property MassPart.colour: Colour¶
The colour of the mass part
- property MassPart.exists(read only): boolean¶
true if mass part exists, false if referred to but not defined
- property MassPart.finmass: float¶
Final translational mass of the part or part set ID
- property MassPart.id: integer¶
Part or part set ID if the SET option is active
- property MassPart.lcid: integer¶
Optional load curve ID to scale the added mass at time = 0
- property MassPart.mwd: integer¶
Optional flag for mass-weighted distribution
- property MassPart.option: constant¶
The Element Mass Part option. Can be
MassPart.PART
orMassPart.SET
- property MassPart.transparency: integer¶
The transparency of the mass part (0-100) 0% is opaque, 100% is transparent
Constructor¶
- classmethod MassPart(model, option, id, addmass=Oasys.gRPC.defaultArg, finmass=Oasys.gRPC.defaultArg)¶
Create a new
MassPart
object
- Parameters:
model (Model) –
Model
that mass part will be created inoption (constant) – Suffix for element mass part. Can be
MassPart.PART
orMassPart.SET
id (integer) – Part or part set ID
addmass (real) – Optional. Added translational mass
finmass (real) – Optional. Final translational mass
- Returns:
MassPart object
- Return type:
dict
Example
To create a new element mass part in model m with option _<BLANK> and part ID 10:
mp = Oasys.PRIMER.MassPart(m, Oasys.PRIMER.MassPart.PART, 10)
Static methods¶
- classmethod MassPart.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the element mass parts in the model
- Parameters:
model (Model) –
Model
that all element mass parts 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 element mass parts in model m:
Oasys.PRIMER.MassPart.BlankAll(m)
- classmethod MassPart.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged element mass parts in the model
- Parameters:
model (Model) –
Model
that all the flagged element mass parts will be blanked inflag (Flag) – Flag set on the element mass parts 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 element mass parts in model m flagged with f:
Oasys.PRIMER.MassPart.BlankFlagged(m, f)
- classmethod MassPart.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a mass part
- Parameters:
model (Model) –
Model
that the mass part 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:
MassPart object (or None if not made)
- Return type:
dict
Example
To start creating a mass part in model m:
mp = Oasys.PRIMER.MassPart.Create(m)
- classmethod MassPart.First(model)¶
Returns the first element mass part in the model
- Parameters:
model (Model) –
Model
to get first element mass part in- Returns:
MassPart object (or None if there are no element mass parts in the model)
- Return type:
MassPart
Example
To get the first element mass part in model m:
mp = Oasys.PRIMER.MassPart.First(m)
- classmethod MassPart.FlagAll(model, flag)¶
Flags all of the element mass parts in the model with a defined flag
- Parameters:
model (Model) –
Model
that all element mass parts will be flagged inflag (Flag) – Flag to set on the element mass parts
- Returns:
No return value
- Return type:
None
Example
To flag all of the element mass parts with flag f in model m:
Oasys.PRIMER.MassPart.FlagAll(m, f)
- classmethod MassPart.GetAll(model)¶
Returns a list of MassPart objects for all of the element mass parts in a model in PRIMER
- Parameters:
model (Model) –
Model
to get element mass parts from- Returns:
List of MassPart objects
- Return type:
list
Example
To make a list of MassPart objects for all of the element mass parts in model m
mp = Oasys.PRIMER.MassPart.GetAll(m)
- classmethod MassPart.GetFlagged(model, flag)¶
Returns a list of MassPart objects for all of the flagged element mass parts in a model in PRIMER
- Parameters:
model (Model) –
Model
to get element mass parts fromflag (Flag) – Flag set on the element mass parts that you want to retrieve
- Returns:
List of MassPart objects
- Return type:
list
Example
To make a list of MassPart objects for all of the element mass parts in model m flagged with f
mp = Oasys.PRIMER.MassPart.GetFlagged(m, f)
- classmethod MassPart.GetFromID(model, number)¶
Returns the MassPart object for a element mass part ID
- Parameters:
model (Model) –
Model
to find the element mass part innumber (integer) – number of the element mass part you want the MassPart object for
- Returns:
MassPart object (or None if element mass part does not exist)
- Return type:
MassPart
Example
To get the MassPart object for element mass part 100 in model m
mp = Oasys.PRIMER.MassPart.GetFromID(m, 100)
- classmethod MassPart.Last(model)¶
Returns the last element mass part in the model
- Parameters:
model (Model) –
Model
to get last element mass part in- Returns:
MassPart object (or None if there are no element mass parts in the model)
- Return type:
MassPart
Example
To get the last element mass part in model m:
mp = Oasys.PRIMER.MassPart.Last(m)
- classmethod MassPart.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a element mass part
- 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 element mass parts from that model can be picked. If the argument is aFlag
then only element mass parts that are flagged with limit can be selected. If omitted, or None, any element mass parts 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:
MassPart object (or None if not picked)
- Return type:
dict
Example
To pick a element mass part from model m giving the prompt ‘Pick element mass part from screen’:
mp = Oasys.PRIMER.MassPart.Pick('Pick element mass part from screen', m)
- classmethod MassPart.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select element mass parts using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting element mass parts
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only element mass parts from that model can be selected. If the argument is aFlag
then only element mass parts that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any element mass parts 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 element mass parts selected or None if menu cancelled
- Return type:
int
Example
To select element mass parts from model m, flagging those selected with flag f, giving the prompt ‘Select element mass parts’:
Oasys.PRIMER.MassPart.Select(f, 'Select element mass parts', m)To select element mass parts, flagging those selected with flag f but limiting selection to element mass parts flagged with flag l, giving the prompt ‘Select element mass parts’:
Oasys.PRIMER.MassPart.Select(f, 'Select element mass parts', l)
- classmethod MassPart.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged element mass parts in the model. The element mass parts will be sketched until you either call
MassPart.Unsketch()
,MassPart.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged element mass parts will be sketched inflag (Flag) – Flag set on the element mass parts that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the element mass parts are sketched. If omitted redraw is true. If you want to sketch flagged element mass parts 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 element mass parts flagged with flag in model m:
Oasys.PRIMER.MassPart.SketchFlagged(m, flag)
- classmethod MassPart.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of element mass parts in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing element mass parts should be counted. If false or omitted referenced but undefined element mass parts will also be included in the total
- Returns:
number of element mass parts
- Return type:
int
Example
To get the total number of element mass parts in model m:
total = Oasys.PRIMER.MassPart.Total(m)
- classmethod MassPart.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the element mass parts in the model
- Parameters:
model (Model) –
Model
that all element mass parts 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 element mass parts in model m:
Oasys.PRIMER.MassPart.UnblankAll(m)
- classmethod MassPart.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged element mass parts in the model
- Parameters:
model (Model) –
Model
that the flagged element mass parts will be unblanked inflag (Flag) – Flag set on the element mass parts 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 element mass parts in model m flagged with f:
Oasys.PRIMER.MassPart.UnblankFlagged(m, f)
- classmethod MassPart.UnflagAll(model, flag)¶
Unsets a defined flag on all of the element mass parts in the model
- Parameters:
model (Model) –
Model
that the defined flag for all element mass parts will be unset inflag (Flag) – Flag to unset on the element mass parts
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the element mass parts in model m:
Oasys.PRIMER.MassPart.UnflagAll(m, f)
- classmethod MassPart.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all element mass parts
- Parameters:
model (Model) –
Model
that all element mass parts will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the element mass parts 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 element mass parts in model m:
Oasys.PRIMER.MassPart.UnsketchAll(m)
- classmethod MassPart.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged element mass parts in the model
- Parameters:
model (Model) –
Model
that all element mass parts will be unsketched inflag (Flag) – Flag set on the element mass parts that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the element mass parts 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 element mass parts flagged with flag in model m:
Oasys.PRIMER.MassPart.UnsketchAll(m, flag)
Instance methods¶
- MassPart.AssociateComment(comment)¶
Associates a comment with a element mass part
- Parameters:
comment (Comment) –
Comment
that will be attached to the element mass part- Returns:
No return value
- Return type:
None
Example
To associate comment c to the element mass part mp:
mp.AssociateComment(c)
- MassPart.Blank()¶
Blanks the element mass part
- Returns:
No return value
- Return type:
None
Example
To blank element mass part mp:
mp.Blank()
- MassPart.Blanked()¶
Checks if the element mass part is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if element mass part mp is blanked:
if mp.Blanked(): do_something..
- MassPart.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 element mass part mp:
mp.Browse()
- MassPart.ClearFlag(flag)¶
Clears a flag on the element mass part
- Parameters:
flag (Flag) – Flag to clear on the element mass part
- Returns:
No return value
- Return type:
None
Example
To clear flag f for element mass part mp:
mp.ClearFlag(f)
- MassPart.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the element mass part. The target include of the copied element mass part 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:
MassPart object
- Return type:
MassPart
Example
To copy element mass part mp into element mass part z:
z = mp.Copy()
- MassPart.DetachComment(comment)¶
Detaches a comment from a element mass part
- Parameters:
comment (Comment) –
Comment
that will be detached from the element mass part- Returns:
No return value
- Return type:
None
Example
To detach comment c from the element mass part mp:
mp.DetachComment(c)
- MassPart.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 element mass part mp:
mp.Edit()
- MassPart.ExtractColour()¶
Extracts the actual colour used for element mass part.
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 element mass partcolour
property will return the valueColour.PART
instead of the actual colour. This method will return the actual colour which is used for drawing the element mass part
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing element mass part mp:
colour = mp.ExtractColour()
- MassPart.Flagged(flag)¶
Checks if the element mass part is flagged or not
- Parameters:
flag (Flag) – Flag to test on the element mass part
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if element mass part mp has flag f set on it:
if mp.Flagged(f): do_something..
- MassPart.GetComments()¶
Extracts the comments associated to a element mass part
- 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 element mass part mp:
comm_list = mp.GetComments()
- MassPart.GetParameter(prop)¶
Checks if a MassPart 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 theMassPart.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – element mass part property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if MassPart property mp.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if mp.GetParameter(mp.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if MassPart property mp.example is a parameter by using the GetParameter method:
if mp.ViewParameters().GetParameter(mp.example): do_something..
- MassPart.Keyword()¶
Returns the keyword for this mass part (*ELEMENT_MASS_PART) Note that a carriage return is not added. See also
MassPart.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for mass part mp:
key = mp.Keyword()
- MassPart.KeywordCards()¶
Returns the keyword cards for the mass part. Note that a carriage return is not added. See also
MassPart.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for mass part mp:
cards = mp.KeywordCards()
- MassPart.Next()¶
Returns the next element mass part in the model
- Returns:
MassPart object (or None if there are no more element mass parts in the model)
- Return type:
MassPart
Example
To get the element mass part in model m after element mass part mp:
mp = mp.Next()
- MassPart.Previous()¶
Returns the previous element mass part in the model
- Returns:
MassPart object (or None if there are no more element mass parts in the model)
- Return type:
MassPart
Example
To get the element mass part in model m before element mass part mp:
mp = mp.Previous()
- MassPart.SetFlag(flag)¶
Sets a flag on the element mass part
- Parameters:
flag (Flag) – Flag to set on the element mass part
- Returns:
No return value
- Return type:
None
Example
To set flag f for element mass part mp:
mp.SetFlag(f)
- MassPart.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the element mass part. The element mass part will be sketched until you either call
MassPart.Unsketch()
,MassPart.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the element mass part is sketched. If omitted redraw is true. If you want to sketch several element mass parts 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 element mass part mp:
mp.Sketch()
- MassPart.Unblank()¶
Unblanks the element mass part
- Returns:
No return value
- Return type:
None
Example
To unblank element mass part mp:
mp.Unblank()
- MassPart.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the element mass part
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the element mass part is unsketched. If omitted redraw is true. If you want to unsketch several element mass parts 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 element mass part mp:
mp.Unsketch()
- MassPart.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:
MassPart object
- Return type:
dict
Example
To check if MassPart property mp.example is a parameter by using the
MassPart.GetParameter()
method:if mp.ViewParameters().GetParameter(mp.example): do_something..
- MassPart.Xrefs()¶
Returns the cross references for this element mass part
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for element mass part mp:
xrefs = mp.Xrefs()