Oasys.PRIMER.LoadGravity class

Constants

LoadGravity.PART

LOAD is *LOAD_GRAVITY_PART

LoadGravity.SET_PART

LOAD is *LOAD_GRAVITY_PART_SET

Properties

property LoadGravity.accel: float

Acceleration (will be multiplied by factor from curve)

property LoadGravity.dof: integer

Direction: enter 1, 2 or 3 for x, y, or z

property LoadGravity.exists(read only): boolean

true if LoadGravity exists, false if referred to but not defined

property LoadGravity.include: integer

The Include file number that the LoadGravity is in

property LoadGravity.lc: integer

Curve ID. Load curve defining factor vs. time (or zero if STGA, STGR are defined)

property LoadGravity.lcdr: integer

Curve ID. Load curve defining factor vs. time during dynamic relaxation

property LoadGravity.model(read only): integer

The Model number that the load gravity is in

property LoadGravity.pid: integer

Part ID or Part set ID

property LoadGravity.stga: integer

Construction Stages ID at which part is added (optional)

property LoadGravity.stgr: integer

Construction Stages ID at which part is removed (optional)

property LoadGravity.type: constant

The Load Gravity type. Can be LoadGravity.PART or LoadGravity.SET_PART

Constructor

classmethod LoadGravity(model, type, pid, dof, lc, accel, lcdr, stga=Oasys.gRPC.defaultArg, stgr=Oasys.gRPC.defaultArg)

Create a new LoadGravity object

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

  • type (constant) – Specify the type of LoadGravity (Can be LoadGravity.PART or LoadGravity.SET_PART

  • pid (integer) – Part ID or Part set ID

  • dof (integer) – Direction: enter 1, 2 or 3 for x, y or z

  • lc (integer) – Curve ID. Load curve defining factor vs. time (or zero if STGA, STGR are defined)

  • accel (float) – Acceleration (will be multiplied by factor from curve)

  • lcdr (integer) – Curve ID. Load curve defining factor vs. time during dynamic relaxation

  • stga (integer) – Optional. Construction Stage ID at which part is added

  • stgr (integer) – Optional. Construction Stage ID at which part is removed

Returns:

LoadGravity object

Return type:

dict

Example

To create a new load gravity in model m, of type SET, with dof 2, loadcurve 9, acceleration of 0.5, and lcdr 10

lg = Oasys.PRIMER.LoadGravity(m, Oasys.PRIMER.LoadGravity.PART, 100, 2, 9, 0.5, 10)

Static methods

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

Blanks all of the load gravitys in the model

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

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

Blanks all of the flagged load gravitys in the model

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

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

Oasys.PRIMER.LoadGravity.BlankFlagged(m, f)
classmethod LoadGravity.First(model)

Returns the first load gravity in the model

Parameters:

model (Model) – Model to get first load gravity in

Returns:

LoadGravity object (or None if there are no load gravitys in the model)

Return type:

LoadGravity

Example

To get the first load gravity in model m:

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

Flags all of the load gravitys in the model with a defined flag

Parameters:
  • model (Model) – Model that all load gravitys will be flagged in

  • flag (Flag) – Flag to set on the load gravitys

Returns:

No return value

Return type:

None

Example

To flag all of the load gravitys with flag f in model m:

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

Returns a list of LoadGravity objects for all of the load gravitys in a model in PRIMER

Parameters:

model (Model) – Model to get load gravitys from

Returns:

List of LoadGravity objects

Return type:

list

Example

To make a list of LoadGravity objects for all of the load gravitys in model m

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

Returns a list of LoadGravity objects for all of the flagged load gravitys in a model in PRIMER

Parameters:
  • model (Model) – Model to get load gravitys from

  • flag (Flag) – Flag set on the load gravitys that you want to retrieve

Returns:

List of LoadGravity objects

Return type:

list

Example

To make a list of LoadGravity objects for all of the load gravitys in model m flagged with f

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

Returns the LoadGravity object for a load gravity ID

Parameters:
  • model (Model) – Model to find the load gravity in

  • number (integer) – number of the load gravity you want the LoadGravity object for

Returns:

LoadGravity object (or None if load gravity does not exist)

Return type:

LoadGravity

Example

To get the LoadGravity object for load gravity 100 in model m

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

Returns the last load gravity in the model

Parameters:

model (Model) – Model to get last load gravity in

Returns:

LoadGravity object (or None if there are no load gravitys in the model)

Return type:

LoadGravity

Example

To get the last load gravity in model m:

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

Allows the user to pick a load gravity

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

LoadGravity object (or None if not picked)

Return type:

dict

Example

To pick a load gravity from model m giving the prompt ‘Pick load gravity from screen’:

lg = Oasys.PRIMER.LoadGravity.Pick('Pick load gravity from screen', m)
classmethod LoadGravity.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)

Allows the user to select load gravitys using standard PRIMER object menus

Parameters:
  • flag (Flag) – Flag to use when selecting load gravitys

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

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

Return type:

int

Example

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

Oasys.PRIMER.LoadGravity.Select(f, 'Select load gravitys', m)

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

Oasys.PRIMER.LoadGravity.Select(f, 'Select load gravitys', l)
classmethod LoadGravity.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

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

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

  • flag (Flag) – Flag set on the load gravitys that you want to sketch

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

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

Returns the total number of load gravitys in the model

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

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

Returns:

number of load gravitys

Return type:

int

Example

To get the total number of load gravitys in model m:

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

Unblanks all of the load gravitys in the model

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

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

Unblanks all of the flagged load gravitys in the model

Parameters:
  • model (Model) – Model that the flagged load gravitys will be unblanked in

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

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

Unsets a defined flag on all of the load gravitys in the model

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

  • flag (Flag) – Flag to unset on the load gravitys

Returns:

No return value

Return type:

None

Example

To unset the flag f on all the load gravitys in model m:

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

Unsketches all load gravitys

Parameters:
  • model (Model) – Model that all load gravitys will be unblanked in

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

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

Unsketches all flagged load gravitys in the model

Parameters:
  • model (Model) – Model that all load gravitys will be unsketched in

  • flag (Flag) – Flag set on the load gravitys that you want to unsketch

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

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

Instance methods

LoadGravity.AssociateComment(comment)

Associates a comment with a load gravity

Parameters:

comment (Comment) – Comment that will be attached to the load gravity

Returns:

No return value

Return type:

None

Example

To associate comment c to the load gravity lg:

lg.AssociateComment(c)
LoadGravity.Blank()

Blanks the load gravity

Returns:

No return value

Return type:

None

Example

To blank load gravity lg:

lg.Blank()
LoadGravity.Blanked()

Checks if the load gravity is blanked or not

Returns:

True if blanked, False if not

Return type:

bool

Example

To check if load gravity lg is blanked:

if lg.Blanked():
    do_something..
LoadGravity.ClearFlag(flag)

Clears a flag on the load gravity

Parameters:

flag (Flag) – Flag to clear on the load gravity

Returns:

No return value

Return type:

None

Example

To clear flag f for load gravity lg:

lg.ClearFlag(f)
LoadGravity.Copy(range=Oasys.gRPC.defaultArg)

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

LoadGravity object

Return type:

LoadGravity

Example

To copy load gravity lg into load gravity z:

z = lg.Copy()
LoadGravity.DetachComment(comment)

Detaches a comment from a load gravity

Parameters:

comment (Comment) – Comment that will be detached from the load gravity

Returns:

No return value

Return type:

None

Example

To detach comment c from the load gravity lg:

lg.DetachComment(c)
LoadGravity.Flagged(flag)

Checks if the load gravity is flagged or not

Parameters:

flag (Flag) – Flag to test on the load gravity

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if load gravity lg has flag f set on it:

if lg.Flagged(f):
    do_something..
LoadGravity.GetComments()

Extracts the comments associated to a load gravity

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 load gravity lg:

comm_list = lg.GetComments()
LoadGravity.GetParameter(prop)

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

Parameters:

prop (string) – load gravity property to get parameter for

Returns:

Parameter object if property is a parameter, None if not

Return type:

dict

Example

To check if LoadGravity property lg.example is a parameter:

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

To check if LoadGravity property lg.example is a parameter by using the GetParameter method:

if lg.ViewParameters().GetParameter(lg.example):
    do_something..
LoadGravity.Keyword()

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

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for LoadGravity lg:

key = lg.Keyword()
LoadGravity.KeywordCards()

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

Returns:

string containing the cards

Return type:

str

Example

To get the cards for LoadGravity lg:

cards = lg.KeywordCards()
LoadGravity.Next()

Returns the next load gravity in the model

Returns:

LoadGravity object (or None if there are no more load gravitys in the model)

Return type:

LoadGravity

Example

To get the load gravity in model m after load gravity lg:

lg = lg.Next()
LoadGravity.Previous()

Returns the previous load gravity in the model

Returns:

LoadGravity object (or None if there are no more load gravitys in the model)

Return type:

LoadGravity

Example

To get the load gravity in model m before load gravity lg:

lg = lg.Previous()
LoadGravity.SetFlag(flag)

Sets a flag on the load gravity

Parameters:

flag (Flag) – Flag to set on the load gravity

Returns:

No return value

Return type:

None

Example

To set flag f for load gravity lg:

lg.SetFlag(f)
LoadGravity.Sketch(redraw=Oasys.gRPC.defaultArg)

Sketches the load gravity. The load gravity will be sketched until you either call LoadGravity.Unsketch(), LoadGravity.UnsketchAll(), Model.UnsketchAll(), or delete the model

Parameters:

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

lg.Sketch()
LoadGravity.Unblank()

Unblanks the load gravity

Returns:

No return value

Return type:

None

Example

To unblank load gravity lg:

lg.Unblank()
LoadGravity.Unsketch(redraw=Oasys.gRPC.defaultArg)

Unsketches the load gravity

Parameters:

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

lg.Unsketch()
LoadGravity.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:

LoadGravity object

Return type:

dict

Example

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

if lg.ViewParameters().GetParameter(lg.example):
    do_something..
LoadGravity.Xrefs()

Returns the cross references for this load gravity

Returns:

Xrefs object

Return type:

dict

Example

To get the cross references for load gravity lg:

xrefs = lg.Xrefs()