Oasys.PRIMER.RigidBodies class

Constants

RigidBodies.PART

RigidBodies is *CONSTRAINED_RIGID_BODIES

RigidBodies.SET

RigidBodies is *CONSTRAINED_RIGID_BODIES_SET

Properties

property RigidBodies.colour: Colour

The colour of the rigid body

property RigidBodies.exists(read only): boolean

true if constrained rigid bodies exists, false if referred to but not defined

property RigidBodies.iflag: integer

Flag for adding coonstrained mass properties to part inertia

property RigidBodies.include: integer

The Include file number that the constrained rigid bodies is in

property RigidBodies.label(read only): integer

The label the constrained rigid bodies has in PRIMER

property RigidBodies.model(read only): integer

The Model number that the rigid body merge is in

property RigidBodies.option: constant

The Constrained Rigid Bodies option. Can be RigidBodies.PART or RigidBodies.SET

property RigidBodies.pidc: integer

Constrained rigid body part ID

property RigidBodies.pidl: integer

Lead rigid body part ID

Constructor

classmethod RigidBodies(model, options)

Create a new RigidBodies object

Parameters:
  • model (Model) – Model that constrained rigid bodies will be created in

  • options (dict) –

    Options specifying which properties would be used to create the keyword. If optional values are not used, then the default values below will be used

    iflag (optional):

    (integer) Flag for adding constrained mass properties to part inertia. (Default value 0)

    option (optional):

    (constant) Specify the type of constrained rigid bodies. Can be RigidBodies.PART

    pidc:

    (integer) Constrained rigid body part ID

    pidl:

    (integer) Lead rigid body part ID

Returns:

RigidBodies object

Return type:

dict

Example

To create a new constrained rigid bodies in model m with lead part 6 and constrained SET_PART 8

output_obj = { "pidl" : 6, "pidc" : 8, "iflag" : 1, "option" : Oasys.PRIMER.RigidBodies.SET }
cnst = Oasys.PRIMER.RigidBodies(m, output_obj)

Static methods

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

Blanks all of the rigid body merges in the model

Parameters:
  • model (Model) – Model that all rigid body merges 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 rigid body merges in model m:

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

Blanks all of the flagged rigid body merges in the model

Parameters:
  • model (Model) – Model that all the flagged rigid body merges will be blanked in

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

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

Starts an interactive editing panel to create a constrained rigid bodies definition

Parameters:
  • model (Model) – Model that the constrained rigid bodies definition 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:

RigidBodies object (or None if not made)

Return type:

dict

Example

To start creating a constrained rigid bodies definition in model m:

r = Oasys.PRIMER.RigidBodies.Create(m)
classmethod RigidBodies.First(model)

Returns the first rigid body merge in the model

Parameters:

model (Model) – Model to get first rigid body merge in

Returns:

RigidBodies object (or None if there are no rigid body merges in the model)

Return type:

RigidBodies

Example

To get the first rigid body merge in model m:

m = Oasys.PRIMER.RigidBodies.First(m)
classmethod RigidBodies.FlagAll(model, flag)

Flags all of the rigid body merges in the model with a defined flag

Parameters:
  • model (Model) – Model that all rigid body merges will be flagged in

  • flag (Flag) – Flag to set on the rigid body merges

Returns:

No return value

Return type:

None

Example

To flag all of the rigid body merges with flag f in model m:

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

Returns a list of RigidBodies objects for all of the rigid body merges in a model in PRIMER

Parameters:

model (Model) – Model to get rigid body merges from

Returns:

List of RigidBodies objects

Return type:

list

Example

To make a list of RigidBodies objects for all of the rigid body merges in model m

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

Returns a list of RigidBodies objects for all of the flagged rigid body merges in a model in PRIMER

Parameters:
  • model (Model) – Model to get rigid body merges from

  • flag (Flag) – Flag set on the rigid body merges that you want to retrieve

Returns:

List of RigidBodies objects

Return type:

list

Example

To make a list of RigidBodies objects for all of the rigid body merges in model m flagged with f

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

Returns the RigidBodies object for a rigid body merge ID

Parameters:
  • model (Model) – Model to find the rigid body merge in

  • number (integer) – number of the rigid body merge you want the RigidBodies object for

Returns:

RigidBodies object (or None if rigid body merge does not exist)

Return type:

RigidBodies

Example

To get the RigidBodies object for rigid body merge 100 in model m

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

Returns the last rigid body merge in the model

Parameters:

model (Model) – Model to get last rigid body merge in

Returns:

RigidBodies object (or None if there are no rigid body merges in the model)

Return type:

RigidBodies

Example

To get the last rigid body merge in model m:

m = Oasys.PRIMER.RigidBodies.Last(m)
classmethod RigidBodies.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)

Allows the user to pick a rigid body merge

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

RigidBodies object (or None if not picked)

Return type:

dict

Example

To pick a rigid body merge from model m giving the prompt ‘Pick rigid body merge from screen’:

m = Oasys.PRIMER.RigidBodies.Pick('Pick rigid body merge from screen', m)
classmethod RigidBodies.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)

Allows the user to select rigid body merges using standard PRIMER object menus

Parameters:
  • flag (Flag) – Flag to use when selecting rigid body merges

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

  • limit (Model or Flag) – Optional. If the argument is a Model then only rigid body merges from that model can be selected. If the argument is a Flag then only rigid body merges that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any rigid body merges 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 rigid body merges selected or None if menu cancelled

Return type:

int

Example

To select rigid body merges from model m, flagging those selected with flag f, giving the prompt ‘Select rigid body merges’:

Oasys.PRIMER.RigidBodies.Select(f, 'Select rigid body merges', m)

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

Oasys.PRIMER.RigidBodies.Select(f, 'Select rigid body merges', l)
classmethod RigidBodies.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Sketches all of the flagged rigid body merges in the model. The rigid body merges will be sketched until you either call RigidBodies.Unsketch(), RigidBodies.UnsketchFlagged(), Model.UnsketchAll(), or delete the model

Parameters:
  • model (Model) – Model that all the flagged rigid body merges will be sketched in

  • flag (Flag) – Flag set on the rigid body merges that you want to sketch

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

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

Returns the total number of rigid body merges in the model

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

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

Returns:

number of rigid body merges

Return type:

int

Example

To get the total number of rigid body merges in model m:

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

Unblanks all of the rigid body merges in the model

Parameters:
  • model (Model) – Model that all rigid body merges 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 rigid body merges in model m:

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

Unblanks all of the flagged rigid body merges in the model

Parameters:
  • model (Model) – Model that the flagged rigid body merges will be unblanked in

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

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

Unsets a defined flag on all of the rigid body merges in the model

Parameters:
  • model (Model) – Model that the defined flag for all rigid body merges will be unset in

  • flag (Flag) – Flag to unset on the rigid body merges

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the rigid body merges in model m:

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

Unsketches all rigid body merges

Parameters:
  • model (Model) – Model that all rigid body merges will be unblanked in

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

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

Unsketches all flagged rigid body merges in the model

Parameters:
  • model (Model) – Model that all rigid body merges will be unsketched in

  • flag (Flag) – Flag set on the rigid body merges that you want to unsketch

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

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

Instance methods

RigidBodies.AssociateComment(comment)

Associates a comment with a rigid body merge

Parameters:

comment (Comment) – Comment that will be attached to the rigid body merge

Returns:

No return value

Return type:

None

Example

To associate comment c to the rigid body merge m:

m.AssociateComment(c)
RigidBodies.Blank()

Blanks the rigid body merge

Returns:

No return value

Return type:

None

Example

To blank rigid body merge m:

m.Blank()
RigidBodies.Blanked()

Checks if the rigid body merge is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if rigid body merge m is blanked:

if m.Blanked():
    do_something..
RigidBodies.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 rigid body merge m:

m.Browse()
RigidBodies.ClearFlag(flag)

Clears a flag on the rigid body merge

Parameters:

flag (Flag) – Flag to clear on the rigid body merge

Returns:

No return value

Return type:

None

Example

To clear flag f for rigid body merge m:

m.ClearFlag(f)
RigidBodies.Copy(range=Oasys.gRPC.defaultArg)

Copies the rigid body merge. The target include of the copied rigid body merge 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:

RigidBodies object

Return type:

RigidBodies

Example

To copy rigid body merge m into rigid body merge z:

z = m.Copy()
RigidBodies.DetachComment(comment)

Detaches a comment from a rigid body merge

Parameters:

comment (Comment) – Comment that will be detached from the rigid body merge

Returns:

No return value

Return type:

None

Example

To detach comment c from the rigid body merge m:

m.DetachComment(c)
RigidBodies.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 rigid body merge m:

m.Edit()
RigidBodies.ExtractColour()

Extracts the actual colour used for rigid body merge.
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 rigid body merge 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 rigid body merge

Returns:

colour value (integer)

Return type:

int

Example

To return the colour used for drawing rigid body merge m:

colour = m.ExtractColour()
RigidBodies.Flagged(flag)

Checks if the rigid body merge is flagged or not

Parameters:

flag (Flag) – Flag to test on the rigid body merge

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if rigid body merge m has flag f set on it:

if m.Flagged(f):
    do_something..
RigidBodies.GetComments()

Extracts the comments associated to a rigid body merge

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 rigid body merge m:

comm_list = m.GetComments()
RigidBodies.GetParameter(prop)

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

Parameters:

prop (string) – rigid body merge property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if RigidBodies property m.example is a parameter:

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

To check if RigidBodies property m.example is a parameter by using the GetParameter method:

if m.ViewParameters().GetParameter(m.example):
    do_something..
RigidBodies.Keyword()

Returns the keyword for this constrained rigid bodies (*CONSTRAINED_RIGID_BODIES). Note that a carriage return is not added. See also RigidBodies.KeywordCards()

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for constrained rigid bodies r:

key = r.Keyword()
RigidBodies.KeywordCards()

Returns the keyword cards for the constrained rigid bodies. Note that a carriage return is not added. See also RigidBodies.Keyword()

Returns:

string containing the cards

Return type:

str

Example

To get the cards for constrained rigid bodies r:

cards = r.KeywordCards()
RigidBodies.Next()

Returns the next rigid body merge in the model

Returns:

RigidBodies object (or None if there are no more rigid body merges in the model)

Return type:

RigidBodies

Example

To get the rigid body merge in model m after rigid body merge m:

m = m.Next()
RigidBodies.Previous()

Returns the previous rigid body merge in the model

Returns:

RigidBodies object (or None if there are no more rigid body merges in the model)

Return type:

RigidBodies

Example

To get the rigid body merge in model m before rigid body merge m:

m = m.Previous()
RigidBodies.SetFlag(flag)

Sets a flag on the rigid body merge

Parameters:

flag (Flag) – Flag to set on the rigid body merge

Returns:

No return value

Return type:

None

Example

To set flag f for rigid body merge m:

m.SetFlag(f)
RigidBodies.Sketch(redraw=Oasys.gRPC.defaultArg)

Sketches the rigid body merge. The rigid body merge will be sketched until you either call RigidBodies.Unsketch(), RigidBodies.UnsketchAll(), Model.UnsketchAll(), or delete the model

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the rigid body merge is sketched. If omitted redraw is true. If you want to sketch several rigid body merges 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 rigid body merge m:

m.Sketch()
RigidBodies.Unblank()

Unblanks the rigid body merge

Returns:

No return value

Return type:

None

Example

To unblank rigid body merge m:

m.Unblank()
RigidBodies.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the rigid body merge

Parameters:

redraw (boolean) – Optional. If model should be redrawn or not after the rigid body merge is unsketched. If omitted redraw is true. If you want to unsketch several rigid body merges 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 rigid body merge m:

m.Unsketch()
RigidBodies.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:

RigidBodies object

Return type:

dict

Example

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

if m.ViewParameters().GetParameter(m.example):
    do_something..
RigidBodies.Xrefs()

Returns the cross references for this rigid body merge

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for rigid body merge m:

xrefs = m.Xrefs()