Oasys.PRIMER.Part class¶
Properties¶
- property Part.adpopt: integer¶
Adaptivity flag
- property Part.ansid: integer¶
Attachment node set ID
- property Part.attachment_nodes: boolean¶
If _ATTACHMENT_NODES option is set. Can be true or false
- property Part.averaged: boolean¶
If _AVERAGED option is set. Can be true or false
- property Part.cadname: string¶
CAD name stored for
Part
(or None if doesn’t exist). This property is only used by PRIMER
- property Part.cid: integer¶
Coordinate system number
- property Part.cmsn: integer¶
CAL3D/MADYMO number
- property Part.colour: Colour¶
The colour of the part
- property Part.composite: boolean¶
If _COMPOSITE option is set. Can be true or false
- property Part.composite_long: boolean¶
If _COMPOSITE_LONG option is set. Can be true or false
- property Part.contact: boolean¶
If _CONTACT option is set. Can be true or false
- property Part.dc: float¶
Exponential decay coefficient
- property Part.element_type(read only): string¶
The type of elements the
Part
contains. e.g. “SHELL”, “SOLID” or None if empty/no section
- property Part.elform: integer¶
Element formulation
- property Part.eosid: integer or string¶
Equation of state number or character label
- property Part.exists(read only): boolean¶
true if part exists, false if referred to but not defined
- property Part.fd: float¶
Dynamic coefficient of friction
- property Part.fs: float¶
Static coefficient of friction
- property Part.grav: integer¶
Gravity loading
- property Part.hmname: string¶
Hypermesh comment read from keyword file for
Part
(or None if doesn’t exist)
- property Part.iga_shell: boolean¶
If _COMPOSITE_IGA_SHELL option is set. Can be true or false
- property Part.inertia: boolean¶
If _INERTIA option is set. Can be true or false
- property Part.ircs: integer¶
Flag for inertia tensor reference coordinate system
- property Part.irl: integer¶
Lamina integration rule
- property Part.ixx: float¶
Ixx component of inertia tensor
- property Part.ixy: float¶
Ixy component of inertia tensor
- property Part.ixz: float¶
Ixz component of inertia tensor
- property Part.iyy: float¶
Iyy component of inertia tensor
- property Part.iyz: float¶
Iyz component of inertia tensor
- property Part.izz: float¶
Izz component of inertia tensor
- property Part.label: integer or string¶
Part
number or character label. Also see thepid
property which is an alternative name for this
- property Part.marea: float¶
Non structural mass per unit area
- property Part.mdep: integer¶
MADYMO ellipse/plane number
- property Part.movopt: integer¶
Flag to deactivate moving for merged rigid bodies
- property Part.nip: integer¶
Number of integration points (layers) present for _COMPOSITE parts
- property Part.nloc: integer¶
Location of reference surface
- property Part.optt: float¶
Contact thickness
- property Part.pid: integer or string¶
Part
number or character label. Also see thelabel
property which is an alternative name for this
- property Part.prbf: integer¶
Print flag for RBDOUT and MATSUM files
- property Part.print: boolean¶
If _PRINT option is set. Can be true or false
- property Part.reposition: boolean¶
If _REPOSITION option is set. Can be true or false
- property Part.rigid(read only): boolean¶
true if part is rigid, false if deformable
- property Part.sft: float¶
Thickness scale factor
- property Part.shrf: float¶
Shear correction factor
- property Part.ssf: float¶
Scale factor on default slave penalty stiffness
- property Part.thshel: integer¶
Thermal shell formulation
- property Part.tm: float¶
total mass
- property Part.tmid: integer or string¶
Thermal material number or character label
- property Part.transparency: integer¶
The transparency of the part (0-100) 0% is opaque, 100% is transparent
- property Part.tshear: integer¶
Flag for transverse shear strain distribution
- property Part.tshell: boolean¶
If _COMPOSITE_TSHELL option is set. Can be true or false
- property Part.vc: float¶
Coefficient for viscous friction
- property Part.vrx: float¶
x rotational velocity
- property Part.vry: float¶
y rotational velocity
- property Part.vrz: float¶
z rotational velocity
- property Part.vtx: float¶
x translational velocity
- property Part.vty: float¶
y translational velocity
- property Part.vtz: float¶
z translational velocity
- property Part.xc: float¶
x coordinate of centre of mass
- property Part.xl: float¶
x coordinate of local x axis
- property Part.xlip: float¶
x coordinate of vector in local xy plane
- property Part.yc: float¶
y coordinate of centre of mass
- property Part.yl: float¶
y coordinate of local x axis
- property Part.ylip: float¶
y coordinate of vector in local xy plane
- property Part.zc: float¶
z coordinate of centre of mass
- property Part.zl: float¶
z coordinate of local x axis
- property Part.zlip: float¶
z coordinate of vector in local xy plane
Constructor¶
Static methods¶
- classmethod Part.AllTableProperties(model)¶
Returns all of the properties available in the part table for the parts. The table values are returned in a list of objects (an object for each part). The object property names are the same as the table headers but spaces are replaced with underscore characters and characters other than 0-9, a-z and A-Z are removed to ensure that the property name is valid in JavaScript. If a table value is undefined the property value will be the JavaScript undefined value. If the table value is a valid number it will be a number, otherwise the value will returned as a string
- Parameters:
model (Model) –
Model
that the flagged parts are in- Returns:
List of objects
- Return type:
list
Example
To get all of the properties for parts in model m:
properties = Oasys.PRIMER.Part.AllTableProperties(m) for p in range(len(properties): for x in properties[p]: Message(x+"="+x)
- classmethod Part.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the parts in the model
- Parameters:
model (Model) –
Model
that all 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 parts in model m:
Oasys.PRIMER.Part.BlankAll(m)
- classmethod Part.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged parts in the model
- Parameters:
model (Model) –
Model
that all the flagged parts will be blanked inflag (Flag) – Flag set on the 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 parts in model m flagged with f:
Oasys.PRIMER.Part.BlankFlagged(m, f)
- classmethod Part.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a part
- Parameters:
model (Model) –
Model
that the 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:
Part object (or None if not made)
- Return type:
dict
Example
To start creating a part in model m:
p = Oasys.PRIMER.Part.Create(m)
- classmethod Part.First(model)¶
Returns the first part in the model
- Parameters:
model (Model) –
Model
to get first part in- Returns:
Part object (or None if there are no parts in the model)
- Return type:
Part
Example
To get the first part in model m:
p = Oasys.PRIMER.Part.First(m)
- classmethod Part.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free part label in the model. Also see
Part.LastFreeLabel()
,Part.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
Part label
- Return type:
int
Example
To get the first free part label in model m:
label = Oasys.PRIMER.Part.FirstFreeLabel(m)
- classmethod Part.FlagAll(model, flag)¶
Flags all of the parts in the model with a defined flag
- Parameters:
model (Model) –
Model
that all parts will be flagged inflag (Flag) – Flag to set on the parts
- Returns:
No return value
- Return type:
None
Example
To flag all of the parts with flag f in model m:
Oasys.PRIMER.Part.FlagAll(m, f)
- classmethod Part.FlagVisible(model, flag)¶
Flags all the unblanked parts in the model
- Parameters:
model (Model) –
Model
for which all unblanked parts will be flagged inflag (Flag) – Flag to set on the unblanked parts
- Returns:
No return value
- Return type:
None
Example
To flag all unblanked parts in model m with flag f:
Oasys.PRIMER.Part.FlagVisible(m, f)
- classmethod Part.FlaggedTableProperties(model, flag)¶
Returns all of the properties available in the part table for the flagged parts. The table values are returned in a list of objects (an object for each part). The object property names are the same as the table headers but spaces are replaced with underscore characters and characters other than 0-9, a-z and A-Z are removed to ensure that the property name is valid in JavaScript. If a table value is undefined the property value will be the JavaScript undefined value. If the table value is a valid number it will be a number, otherwise the value will returned as a string
- Parameters:
model (Model) –
Model
that the flagged parts are inflag (Flag) – Flag set on the parts that you want properties for
- Returns:
List of objects
- Return type:
list
Example
To get all of the properties for parts in model m flagged with f:
properties = Oasys.PRIMER.Part.FlaggedTableProperties(m, f) for p in range(len(properties): for x in properties[p]: Message(x+"="+x)
- classmethod Part.GetAll(model)¶
Returns a list of Part objects for all of the parts in a model in PRIMER
- Parameters:
model (Model) –
Model
to get parts from- Returns:
List of Part objects
- Return type:
list
Example
To make a list of Part objects for all of the parts in model m
p = Oasys.PRIMER.Part.GetAll(m)
- classmethod Part.GetFlagged(model, flag)¶
Returns a list of Part objects for all of the flagged parts in a model in PRIMER
- Parameters:
model (Model) –
Model
to get parts fromflag (Flag) – Flag set on the parts that you want to retrieve
- Returns:
List of Part objects
- Return type:
list
Example
To make a list of Part objects for all of the parts in model m flagged with f
p = Oasys.PRIMER.Part.GetFlagged(m, f)
- classmethod Part.GetFromID(model, number)¶
Returns the Part object for a part ID
- Parameters:
model (Model) –
Model
to find the part innumber (integer) – number of the part you want the Part object for
- Returns:
Part object (or None if part does not exist)
- Return type:
Part
Example
To get the Part object for part 100 in model m
p = Oasys.PRIMER.Part.GetFromID(m, 100)
- classmethod Part.Last(model)¶
Returns the last part in the model
- Parameters:
model (Model) –
Model
to get last part in- Returns:
Part object (or None if there are no parts in the model)
- Return type:
Part
Example
To get the last part in model m:
p = Oasys.PRIMER.Part.Last(m)
- classmethod Part.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free part label in the model. Also see
Part.FirstFreeLabel()
,Part.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
Part label
- Return type:
int
Example
To get the last free part label in model m:
label = Oasys.PRIMER.Part.LastFreeLabel(m)
- classmethod Part.MeasurePartToPart(part1, part2)¶
This static method measures the distance between two part objects contained in the same model or in two different models
- Parameters:
- Returns:
Dict with properties
- distance:
(real) Distance between the two parts
- vector:
(List of reals) Components of distance vector
- Return type:
dict
Example
To measure the distance between part object p1 and part object p2:
m = Oasys.PRIMER.Part.MeasurePartToPart(p1, p2) d = m["distance"] XComp = m["vector"][0] YComp = m["vector"][1] ZComp = m["vector"][2]
- classmethod Part.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) part label in the model. Also see
Part.FirstFreeLabel()
,Part.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
Part label
- Return type:
int
Example
To get the next free part label in model m:
label = Oasys.PRIMER.Part.NextFreeLabel(m)
- classmethod Part.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a 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 parts from that model can be picked. If the argument is aFlag
then only parts that are flagged with limit can be selected. If omitted, or None, any 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:
Part object (or None if not picked)
- Return type:
dict
Example
To pick a part from model m giving the prompt ‘Pick part from screen’:
p = Oasys.PRIMER.Part.Pick('Pick part from screen', m)
- classmethod Part.RenumberAll(model, start)¶
Renumbers all of the parts in the model
- Parameters:
model (Model) –
Model
that all parts will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the parts in model m, from 1000000:
Oasys.PRIMER.Part.RenumberAll(m, 1000000)
- classmethod Part.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged parts in the model
- Parameters:
model (Model) –
Model
that all the flagged parts will be renumbered inflag (Flag) – Flag set on the parts that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the parts in model m flagged with f, from 1000000:
Oasys.PRIMER.Part.RenumberFlagged(m, f, 1000000)
- classmethod Part.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select parts using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting 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 parts from that model can be selected. If the argument is aFlag
then only parts that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any 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 parts selected or None if menu cancelled
- Return type:
int
Example
To select parts from model m, flagging those selected with flag f, giving the prompt ‘Select parts’:
Oasys.PRIMER.Part.Select(f, 'Select parts', m)To select parts, flagging those selected with flag f but limiting selection to parts flagged with flag l, giving the prompt ‘Select parts’:
Oasys.PRIMER.Part.Select(f, 'Select parts', l)
- classmethod Part.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged parts in the model. The parts will be sketched until you either call
Part.Unsketch()
,Part.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged parts will be sketched inflag (Flag) – Flag set on the parts that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the parts are sketched. If omitted redraw is true. If you want to sketch flagged 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 parts flagged with flag in model m:
Oasys.PRIMER.Part.SketchFlagged(m, flag)
- classmethod Part.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of parts in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing parts should be counted. If false or omitted referenced but undefined parts will also be included in the total
- Returns:
number of parts
- Return type:
int
Example
To get the total number of parts in model m:
total = Oasys.PRIMER.Part.Total(m)
- classmethod Part.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the parts in the model
- Parameters:
model (Model) –
Model
that all 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 parts in model m:
Oasys.PRIMER.Part.UnblankAll(m)
- classmethod Part.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged parts in the model
- Parameters:
model (Model) –
Model
that the flagged parts will be unblanked inflag (Flag) – Flag set on the 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 parts in model m flagged with f:
Oasys.PRIMER.Part.UnblankFlagged(m, f)
- classmethod Part.UnflagAll(model, flag)¶
Unsets a defined flag on all of the parts in the model
- Parameters:
model (Model) –
Model
that the defined flag for all parts will be unset inflag (Flag) – Flag to unset on the parts
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the parts in model m:
Oasys.PRIMER.Part.UnflagAll(m, f)
- classmethod Part.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all parts
- Parameters:
model (Model) –
Model
that all parts will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the 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 parts in model m:
Oasys.PRIMER.Part.UnsketchAll(m)
- classmethod Part.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged parts in the model
- Parameters:
model (Model) –
Model
that all parts will be unsketched inflag (Flag) – Flag set on the parts that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the 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 parts flagged with flag in model m:
Oasys.PRIMER.Part.UnsketchAll(m, flag)
Instance methods¶
- Part.AssociateComment(comment)¶
Associates a comment with a part
- Parameters:
comment (Comment) –
Comment
that will be attached to the part- Returns:
No return value
- Return type:
None
Example
To associate comment c to the part p:
p.AssociateComment(c)
- Part.Blank()¶
Blanks the part
- Returns:
No return value
- Return type:
None
Example
To blank part p:
p.Blank()
- Part.Blanked()¶
Checks if the part is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if part p is blanked:
if p.Blanked(): do_something..
- Part.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 part p:
p.Browse()
- Part.CentreOfGravity(options=Oasys.gRPC.defaultArg)¶
Returns the centre of gravity for a part
- Parameters:
options (dict) –
Optional. Options specifying how the mass calculation should be done
- constrainedparts (optional):
(boolean) Mass of rigid lead part includes mass of its constrained parts. On by default
- lumpedmass (optional):
(boolean) Lumped mass is included for deformable parts. Off by default
- nrbmass (optional):
(boolean) NRB mass is included for deformable parts. Off by default. (tranfermass:true required for this option)
- plot (optional):
(boolean) Plot CofG
- skipconstrained (optional):
(boolean) Constrained rigid part is assigned zero mass (if constrainedparts = true). On by default
- timestepmass (optional):
(boolean) Timestep added mass is included for deformable parts. Off by default
- transfermass (optional):
(boolean) Mass of deformable nodes attached to rigid part/nrb is transferred. On by default
- Returns:
A list containing the x, y and z coordinates for the CofG
- Return type:
list
Example
To get the centre of gravity for part p with options configured:
cofg = p.CentreOfGravity({"constrainedparts":False, "transfermass":True, "lumpedmass":False, "nrbmass":True, "timestepmass":False, "plot":True}) x = cofg[0] y = cofg[1] z = cofg[2]
- Part.ClearFlag(flag)¶
Clears a flag on the part
- Parameters:
flag (Flag) – Flag to clear on the part
- Returns:
No return value
- Return type:
None
Example
To clear flag f for part p:
p.ClearFlag(f)
- Part.ClosestNode(x, y, z)¶
Finds the
Node
on the part closest to a coordinate
- Parameters:
x (float) – X coordinate of point
y (float) – Y coordinate of point
z (float) – Z coordinate of point
- Returns:
ID of Node or None if part has no nodes
- Return type:
int
Example
To find the node on part p closest to point (1, 2, 3):
n = p.ClosestNode(1, 2, 3)
- Part.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the part. The target include of the copied 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:
Part object
- Return type:
Part
Example
To copy part p into part z:
z = p.Copy()
- Part.DetachComment(comment)¶
Detaches a comment from a part
- Parameters:
comment (Comment) –
Comment
that will be detached from the part- Returns:
No return value
- Return type:
None
Example
To detach comment c from the part p:
p.DetachComment(c)
- Part.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 part p:
p.Edit()
- Part.ExtractColour()¶
Extracts the actual colour used for 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 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 part
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing part p:
colour = p.ExtractColour()
- Part.Flagged(flag)¶
Checks if the part is flagged or not
- Parameters:
flag (Flag) – Flag to test on the part
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if part p has flag f set on it:
if p.Flagged(f): do_something..
- Part.GetComments()¶
Extracts the comments associated to a 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 part p:
comm_list = p.GetComments()
- Part.GetCompositeData(ipt)¶
Returns the composite data for an integration point in *PART_COMPOSITE
- Parameters:
ipt (integer) – The integration point you want the data for. Note that integration points start at 0, not 1
- Returns:
A list containing the material id, thickness, beta angle and thermal material values. If the _COMPOSITE_LONG option is set, then the list returned will also contain the ply ID
- Return type:
list
Example
To get the composite data for the 3rd integration point for part p:
if (p.composite and p.nip >= 3): ipt_data = p.GetCompositeData(2)
- Part.GetParameter(prop)¶
Checks if a Part 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 thePart.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – part property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Part property p.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if p.GetParameter(p.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if Part property p.example is a parameter by using the GetParameter method:
if p.ViewParameters().GetParameter(p.example): do_something..
- Part.Keyword()¶
Returns the keyword for this part (*PART, *PART_SCALAR or *PART_SCALAR_VALUE). Note that a carriage return is not added. See also
Part.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for part p:
key = p.Keyword()
- Part.KeywordCards()¶
Returns the keyword cards for the part. Note that a carriage return is not added. See also
Part.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for part p:
cards = p.KeywordCards()
- Part.Mass()¶
Returns the mass properties for a part
- Returns:
Dict with properties
- Assign_Mass:
(real) Assign mass
- Component_Mass:
(real) Component mass
- Dyna_Added_Mass:
(real) Dyna added mass
- Dyna_Part_Mass:
(real) Dyna part mass
- Lumped_Mass:
(real) Lumped mass
- NRB_Mass:
(real) NRB mass
- NS_Mass:
(real) Non-structural mass
- Struct_Mass:
(real) Structural mass
- Transferrd_Mass:
(real) Transferred mass when deformable meshed to rigid
- Return type:
dict
Example
To get the structural mass for part p:
mprops = p.Mass() struct_mass = mprops["Struct_Mass"]
- Part.MaxMin()¶
Returns the max and min bounds of a part
- Returns:
A list containing the xMin, xMax, yMin, yMax, zMin and zMax coordinates for a box bounding the part, or None if the bounds cannot be calculated (e.g. the part has no structural elements)
- Return type:
list
Example
To get the bounds for part p:
bounds = p.MaxMin() if isinstance(bounds, list): xMin = bounds[0] xMax = bounds[1] yMin = bounds[2] yMax = bounds[3] zMin = bounds[4] zMax = bounds[5]
- Part.Next()¶
Returns the next part in the model
- Returns:
Part object (or None if there are no more parts in the model)
- Return type:
Part
Example
To get the part in model m after part p:
p = p.Next()
- Part.Previous()¶
Returns the previous part in the model
- Returns:
Part object (or None if there are no more parts in the model)
- Return type:
Part
Example
To get the part in model m before part p:
p = p.Previous()
- Part.RemoveCompositeData(ipt)¶
Removes the composite data for an integration point in *PART_COMPOSITE
- Parameters:
ipt (integer) – The integration point you want to remove. Note that integration points start at 0, not 1
- Returns:
No return value
- Return type:
None
Example
To remove the composite data for the 3rd integration point for part p:
p.RemoveCompositeData(2)
- Part.SetCompositeData(ipt, mid, thick, beta, tmid, plyid=Oasys.gRPC.defaultArg, shrfac=Oasys.gRPC.defaultArg)¶
Sets the composite data for an integration point in *PART_COMPOSITE
- Parameters:
ipt (integer) – The integration point you want to set the data for. Note that integration points start at 0, not 1
mid (integer) – Material ID for the integration point
thick (real) – Thickness of the integration point
beta (real) – Material angle of the integration point
tmid (integer) – Thermal material ID for the integration point
plyid (integer) – Optional. Ply ID for the integration point. This should be used if the _COMPOSITE_LONG option is set for the part
shrfac (real) – Optional. Transverse shear stress scale factor
- Returns:
No return value
- Return type:
None
Example
To set the composite data for the 3rd integration point to mat 1, thickness 0.5 and angle 45, for part p:
p.SetCompositeData(2, 1, 0.5, 45)
- Part.SetFlag(flag)¶
Sets a flag on the part
- Parameters:
flag (Flag) – Flag to set on the part
- Returns:
No return value
- Return type:
None
Example
To set flag f for part p:
p.SetFlag(f)
- Part.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the part. The part will be sketched until you either call
Part.Unsketch()
,Part.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the part is sketched. If omitted redraw is true. If you want to sketch several 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 part p:
p.Sketch()
- Part.TableProperties()¶
Returns all of the properties available for the part in the part table. The table values are returned in an object. The object property names are the same as the table headers but spaces are replaced with underscore characters and characters other than 0-9, a-z and A-Z are removed to ensure that the property name is valid in JavaScript. If a table value is undefined the property value will be the JavaScript undefined value. If the table value is a valid number it will be a number, otherwise the value will returned as a string
- Returns:
Dict
- Return type:
dict
Example
To get all of the properties for part p:
properties = p.TableProperties() for x in properties: Message(x+"="+x)
- Part.Unblank()¶
Unblanks the part
- Returns:
No return value
- Return type:
None
Example
To unblank part p:
p.Unblank()
- Part.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the part
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the part is unsketched. If omitted redraw is true. If you want to unsketch several 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 part p:
p.Unsketch()
- Part.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:
Part object
- Return type:
dict
Example
To check if Part property p.example is a parameter by using the
Part.GetParameter()
method:if p.ViewParameters().GetParameter(p.example): do_something..
- Part.Xrefs()¶
Returns the cross references for this part
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for part p:
xrefs = p.Xrefs()