Oasys.PRIMER.Accelerometer class¶
Properties¶
- property Accelerometer.colour: Colour¶
The colour of the accelerometer
- property Accelerometer.exists(read only): boolean¶
true if accelerometer exists, false if referred to but not defined
- property Accelerometer.igrav: integer¶
Gravitational acceleration due to body force loads is included in acceleration output if igrav is 0, removed if igrav is 1
- property Accelerometer.intopt: integer¶
Integration option; velocities are integrated from global accelerations and transformed into local system if intopt is 0, they are integrated directly from local accelerations if intopt is 1
- property Accelerometer.label: integer¶
Accelerometer
number. Also see thesbacid
property which is an alternative name for this
- property Accelerometer.mass: float¶
Optional added mass for accelerometer
- property Accelerometer.sbacid: integer¶
Accelerometer
number. Also see thelabel
property which is an alternative name for this
- property Accelerometer.transparency: integer¶
The transparency of the accelerometer (0-100) 0% is opaque, 100% is transparent
Constructor¶
- classmethod Accelerometer(model, sbacid, nid1, nid2, nid3, igrav=Oasys.gRPC.defaultArg, intopt=Oasys.gRPC.defaultArg, mass=Oasys.gRPC.defaultArg)¶
Create a new
Seatbelt Accelerometer
object
- Parameters:
model (Model) –
Model
that accelerometer will be created insbacid (integer) –
Accelerometer
number. Also see thelabel
property which is an alternative name for thisnid1 (integer) –
Node
number 1nid2 (integer) –
Node
number 2nid3 (integer) –
Node
number 3igrav (integer) – Optional. Gravitational acceleration due to body force loads is included in acceleration output if igrav is 0, removed if igrav is 1
intopt (integer) – Optional. Integration option; velocities are integrated from global accelerations and transformed into local system if intopt is 0, they are integrated directly from local accelerations if intopt is 1
mass (real) – Optional. Optional added mass for accelerometer
- Returns:
Accelerometer object
- Return type:
dict
Example
To create a new seatbelt accelerometer in model m with label 100, nodes 1, 2 and 3:
a = Oasys.PRIMER.Accelerometer(m, 100, 1, 2, 3)
Static methods¶
- classmethod Accelerometer.BlankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the accelerometers in the model
- Parameters:
model (Model) –
Model
that all accelerometers 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 accelerometers in model m:
Oasys.PRIMER.Accelerometer.BlankAll(m)
- classmethod Accelerometer.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Blanks all of the flagged accelerometers in the model
- Parameters:
model (Model) –
Model
that all the flagged accelerometers will be blanked inflag (Flag) – Flag set on the accelerometers 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 accelerometers in model m flagged with f:
Oasys.PRIMER.Accelerometer.BlankFlagged(m, f)
- classmethod Accelerometer.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create a accelerometer
- Parameters:
model (Model) –
Model
that the accelerometer 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:
Accelerometer object (or None if not made)
- Return type:
dict
Example
To start creating an accelerometer in model m:
a = Oasys.PRIMER.Accelerometer.Create(m)
- classmethod Accelerometer.First(model)¶
Returns the first accelerometer in the model
- Parameters:
model (Model) –
Model
to get first accelerometer in- Returns:
Accelerometer object (or None if there are no accelerometers in the model)
- Return type:
Accelerometer
Example
To get the first accelerometer in model m:
a = Oasys.PRIMER.Accelerometer.First(m)
- classmethod Accelerometer.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free accelerometer label in the model. Also see
Accelerometer.LastFreeLabel()
,Accelerometer.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
Accelerometer label
- Return type:
int
Example
To get the first free accelerometer label in model m:
label = Oasys.PRIMER.Accelerometer.FirstFreeLabel(m)
- classmethod Accelerometer.FlagAll(model, flag)¶
Flags all of the accelerometers in the model with a defined flag
- Parameters:
model (Model) –
Model
that all accelerometers will be flagged inflag (Flag) – Flag to set on the accelerometers
- Returns:
No return value
- Return type:
None
Example
To flag all of the accelerometers with flag f in model m:
Oasys.PRIMER.Accelerometer.FlagAll(m, f)
- classmethod Accelerometer.GetAll(model)¶
Returns a list of Accelerometer objects for all of the accelerometers in a model in PRIMER
- Parameters:
model (Model) –
Model
to get accelerometers from- Returns:
List of Accelerometer objects
- Return type:
list
Example
To make a list of Accelerometer objects for all of the accelerometers in model m
a = Oasys.PRIMER.Accelerometer.GetAll(m)
- classmethod Accelerometer.GetFlagged(model, flag)¶
Returns a list of Accelerometer objects for all of the flagged accelerometers in a model in PRIMER
- Parameters:
model (Model) –
Model
to get accelerometers fromflag (Flag) – Flag set on the accelerometers that you want to retrieve
- Returns:
List of Accelerometer objects
- Return type:
list
Example
To make a list of Accelerometer objects for all of the accelerometers in model m flagged with f
a = Oasys.PRIMER.Accelerometer.GetFlagged(m, f)
- classmethod Accelerometer.GetFromID(model, number)¶
Returns the Accelerometer object for a accelerometer ID
- Parameters:
model (Model) –
Model
to find the accelerometer innumber (integer) – number of the accelerometer you want the Accelerometer object for
- Returns:
Accelerometer object (or None if accelerometer does not exist)
- Return type:
Accelerometer
Example
To get the Accelerometer object for accelerometer 100 in model m
a = Oasys.PRIMER.Accelerometer.GetFromID(m, 100)
- classmethod Accelerometer.Last(model)¶
Returns the last accelerometer in the model
- Parameters:
model (Model) –
Model
to get last accelerometer in- Returns:
Accelerometer object (or None if there are no accelerometers in the model)
- Return type:
Accelerometer
Example
To get the last accelerometer in model m:
a = Oasys.PRIMER.Accelerometer.Last(m)
- classmethod Accelerometer.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free accelerometer label in the model. Also see
Accelerometer.FirstFreeLabel()
,Accelerometer.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
Accelerometer label
- Return type:
int
Example
To get the last free accelerometer label in model m:
label = Oasys.PRIMER.Accelerometer.LastFreeLabel(m)
- classmethod Accelerometer.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) accelerometer label in the model. Also see
Accelerometer.FirstFreeLabel()
,Accelerometer.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
Accelerometer label
- Return type:
int
Example
To get the next free accelerometer label in model m:
label = Oasys.PRIMER.Accelerometer.NextFreeLabel(m)
- classmethod Accelerometer.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)¶
Allows the user to pick a accelerometer
- 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 accelerometers from that model can be picked. If the argument is aFlag
then only accelerometers that are flagged with limit can be selected. If omitted, or None, any accelerometers 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:
Accelerometer object (or None if not picked)
- Return type:
dict
Example
To pick a accelerometer from model m giving the prompt ‘Pick accelerometer from screen’:
a = Oasys.PRIMER.Accelerometer.Pick('Pick accelerometer from screen', m)
- classmethod Accelerometer.RenumberAll(model, start)¶
Renumbers all of the accelerometers in the model
- Parameters:
model (Model) –
Model
that all accelerometers will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the accelerometers in model m, from 1000000:
Oasys.PRIMER.Accelerometer.RenumberAll(m, 1000000)
- classmethod Accelerometer.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged accelerometers in the model
- Parameters:
model (Model) –
Model
that all the flagged accelerometers will be renumbered inflag (Flag) – Flag set on the accelerometers that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the accelerometers in model m flagged with f, from 1000000:
Oasys.PRIMER.Accelerometer.RenumberFlagged(m, f, 1000000)
- classmethod Accelerometer.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select accelerometers using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting accelerometers
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only accelerometers from that model can be selected. If the argument is aFlag
then only accelerometers that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any accelerometers 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 accelerometers selected or None if menu cancelled
- Return type:
int
Example
To select accelerometers from model m, flagging those selected with flag f, giving the prompt ‘Select accelerometers’:
Oasys.PRIMER.Accelerometer.Select(f, 'Select accelerometers', m)To select accelerometers, flagging those selected with flag f but limiting selection to accelerometers flagged with flag l, giving the prompt ‘Select accelerometers’:
Oasys.PRIMER.Accelerometer.Select(f, 'Select accelerometers', l)
- classmethod Accelerometer.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged accelerometers in the model. The accelerometers will be sketched until you either call
Accelerometer.Unsketch()
,Accelerometer.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged accelerometers will be sketched inflag (Flag) – Flag set on the accelerometers that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the accelerometers are sketched. If omitted redraw is true. If you want to sketch flagged accelerometers 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 accelerometers flagged with flag in model m:
Oasys.PRIMER.Accelerometer.SketchFlagged(m, flag)
- classmethod Accelerometer.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of accelerometers in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing accelerometers should be counted. If false or omitted referenced but undefined accelerometers will also be included in the total
- Returns:
number of accelerometers
- Return type:
int
Example
To get the total number of accelerometers in model m:
total = Oasys.PRIMER.Accelerometer.Total(m)
- classmethod Accelerometer.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the accelerometers in the model
- Parameters:
model (Model) –
Model
that all accelerometers 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 accelerometers in model m:
Oasys.PRIMER.Accelerometer.UnblankAll(m)
- classmethod Accelerometer.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unblanks all of the flagged accelerometers in the model
- Parameters:
model (Model) –
Model
that the flagged accelerometers will be unblanked inflag (Flag) – Flag set on the accelerometers 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 accelerometers in model m flagged with f:
Oasys.PRIMER.Accelerometer.UnblankFlagged(m, f)
- classmethod Accelerometer.UnflagAll(model, flag)¶
Unsets a defined flag on all of the accelerometers in the model
- Parameters:
model (Model) –
Model
that the defined flag for all accelerometers will be unset inflag (Flag) – Flag to unset on the accelerometers
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the accelerometers in model m:
Oasys.PRIMER.Accelerometer.UnflagAll(m, f)
- classmethod Accelerometer.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all accelerometers
- Parameters:
model (Model) –
Model
that all accelerometers will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the accelerometers 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 accelerometers in model m:
Oasys.PRIMER.Accelerometer.UnsketchAll(m)
- classmethod Accelerometer.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged accelerometers in the model
- Parameters:
model (Model) –
Model
that all accelerometers will be unsketched inflag (Flag) – Flag set on the accelerometers that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the accelerometers 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 accelerometers flagged with flag in model m:
Oasys.PRIMER.Accelerometer.UnsketchAll(m, flag)
Instance methods¶
- Accelerometer.AssociateComment(comment)¶
Associates a comment with a accelerometer
- Parameters:
comment (Comment) –
Comment
that will be attached to the accelerometer- Returns:
No return value
- Return type:
None
Example
To associate comment c to the accelerometer a:
a.AssociateComment(c)
- Accelerometer.Blank()¶
Blanks the accelerometer
- Returns:
No return value
- Return type:
None
Example
To blank accelerometer a:
a.Blank()
- Accelerometer.Blanked()¶
Checks if the accelerometer is blanked or not
- Returns:
True if blanked, False if not
- Return type:
bool
Example
To check if accelerometer a is blanked:
if a.Blanked(): do_something..
- Accelerometer.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 accelerometer a:
a.Browse()
- Accelerometer.ClearFlag(flag)¶
Clears a flag on the accelerometer
- Parameters:
flag (Flag) – Flag to clear on the accelerometer
- Returns:
No return value
- Return type:
None
Example
To clear flag f for accelerometer a:
a.ClearFlag(f)
- Accelerometer.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the accelerometer. The target include of the copied accelerometer 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:
Accelerometer object
- Return type:
Accelerometer
Example
To copy accelerometer a into accelerometer z:
z = a.Copy()
- Accelerometer.DetachComment(comment)¶
Detaches a comment from a accelerometer
- Parameters:
comment (Comment) –
Comment
that will be detached from the accelerometer- Returns:
No return value
- Return type:
None
Example
To detach comment c from the accelerometer a:
a.DetachComment(c)
- Accelerometer.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 accelerometer a:
a.Edit()
- Accelerometer.ExtractColour()¶
Extracts the actual colour used for accelerometer.
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 accelerometercolour
property will return the valueColour.PART
instead of the actual colour. This method will return the actual colour which is used for drawing the accelerometer
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing accelerometer a:
colour = a.ExtractColour()
- Accelerometer.Flagged(flag)¶
Checks if the accelerometer is flagged or not
- Parameters:
flag (Flag) – Flag to test on the accelerometer
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if accelerometer a has flag f set on it:
if a.Flagged(f): do_something..
- Accelerometer.GetComments()¶
Extracts the comments associated to a accelerometer
- 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 accelerometer a:
comm_list = a.GetComments()
- Accelerometer.GetParameter(prop)¶
Checks if a Accelerometer 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 theAccelerometer.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – accelerometer property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Accelerometer property a.example is a parameter:
Oasys.PRIMER.Options.property_parameter_names = True if a.GetParameter(a.example): do_something... Oasys.PRIMER.Options.property_parameter_names = FalseTo check if Accelerometer property a.example is a parameter by using the GetParameter method:
if a.ViewParameters().GetParameter(a.example): do_something..
- Accelerometer.Keyword()¶
Returns the keyword for this accelerometer (*ELEMENT_SEATBELT_ACCELEROMETER) Note that a carriage return is not added. See also
Accelerometer.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for accelerometer a:
key = a.Keyword()
- Accelerometer.KeywordCards()¶
Returns the keyword cards for the accelerometer. Note that a carriage return is not added. See also
Accelerometer.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for accelerometer a:
cards = a.KeywordCards()
- Accelerometer.Next()¶
Returns the next accelerometer in the model
- Returns:
Accelerometer object (or None if there are no more accelerometers in the model)
- Return type:
Accelerometer
Example
To get the accelerometer in model m after accelerometer a:
a = a.Next()
- Accelerometer.Previous()¶
Returns the previous accelerometer in the model
- Returns:
Accelerometer object (or None if there are no more accelerometers in the model)
- Return type:
Accelerometer
Example
To get the accelerometer in model m before accelerometer a:
a = a.Previous()
- Accelerometer.SetFlag(flag)¶
Sets a flag on the accelerometer
- Parameters:
flag (Flag) – Flag to set on the accelerometer
- Returns:
No return value
- Return type:
None
Example
To set flag f for accelerometer a:
a.SetFlag(f)
- Accelerometer.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the accelerometer. The accelerometer will be sketched until you either call
Accelerometer.Unsketch()
,Accelerometer.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the accelerometer is sketched. If omitted redraw is true. If you want to sketch several accelerometers 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 accelerometer a:
a.Sketch()
- Accelerometer.Unblank()¶
Unblanks the accelerometer
- Returns:
No return value
- Return type:
None
Example
To unblank accelerometer a:
a.Unblank()
- Accelerometer.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the accelerometer
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the accelerometer is unsketched. If omitted redraw is true. If you want to unsketch several accelerometers 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 accelerometer a:
a.Unsketch()
- Accelerometer.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:
Accelerometer object
- Return type:
dict
Example
To check if Accelerometer property a.example is a parameter by using the
Accelerometer.GetParameter()
method:if a.ViewParameters().GetParameter(a.example): do_something..
- Accelerometer.Xrefs()¶
Returns the cross references for this accelerometer
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for accelerometer a:
xrefs = a.Xrefs()