Oasys.PRIMER.Airbag class¶
Constants¶
- Airbag.ADIABATIC_GAS_MODEL¶
Airbag adiabatic gas model type
- Airbag.ADVANCED_ALE¶
Airbag advanced ALE type
- Airbag.ALE¶
Airbag ALE type
- Airbag.HYBRID¶
Airbag hybrid type
- Airbag.HYBRID_CHEMKIN¶
Airbag hybrid chemkin type
- Airbag.HYBRID_JETTING¶
Airbag hybrid jetting type
- Airbag.LINEAR_FLUID¶
Airbag linear fluid type
- Airbag.LOAD_CURVE¶
Airbag load curve type
- Airbag.PARTICLE¶
Airbag particle type
- Airbag.SIMPLE_AIRBAG_MODEL¶
Airbag simple airbag model type
- Airbag.SIMPLE_PRESSURE_VOLUME¶
Airbag simple pressure volume type
- Airbag.WANG_NEFSKE¶
Airbag Wang Nefske type
- Airbag.WANG_NEFSKE_JETTING¶
Airbag Wang Nefske jetting type
- Airbag.WANG_NEFSKE_MULTIPLE_JETTING¶
Airbag Wang Nefske multiple jetting type
Properties¶
- property Airbag.abid: integer¶
Airbag
number. Also see thelabel
property which is an alternative name for this
- property Airbag.colour: Colour¶
The colour of the airbag
- property Airbag.cols(read only): float¶
The number of columns of data the airbag has
- property Airbag.exists(read only): boolean¶
true if airbag exists, false if referred to but not defined
- property Airbag.id: boolean¶
Turns _ID on or OFF
- property Airbag.label: integer¶
Airbag
number. Also see theabid
property which is an alternative name for this
- property Airbag.properties: integer¶
The total number of properties that the airbag has
- property Airbag.rows(read only): integer¶
The number of rows of data the airbag has. This includes the _ID card if it is set
- property Airbag.type: constant¶
Airbag type. Can be
Airbag.SIMPLE_PRESSURE_VOLUME
,Airbag.SIMPLE_AIRBAG_MODEL
,Airbag.ADIABATIC_GAS_MODEL
,Airbag.WANG_NEFSKE
,Airbag.WANG_NEFSKE_JETTING
,Airbag.WANG_NEFSKE_MULTIPLE_JETTING
,Airbag.LOAD_CURVE
,Airbag.LINEAR_FLUID
,Airbag.HYBRID
,Airbag.HYBRID_JETTING
,Airbag.HYBRID_CHEMKIN
,Airbag.ALE
,Airbag.ADVANCED_ALE
orAirbag.PARTICLE
Constructor¶
- classmethod Airbag(model, type, sid, sidtyp=Oasys.gRPC.defaultArg, abid=Oasys.gRPC.defaultArg, heading=Oasys.gRPC.defaultArg)¶
Create a new
Airbag
object
- Parameters:
model (Model) –
Model
that airbag will be created intype (string) – Airbag type. Can be
Airbag.SIMPLE_PRESSURE_VOLUME
,Airbag.SIMPLE_AIRBAG_MODEL
,Airbag.ADIABATIC_GAS_MODEL
,Airbag.WANG_NEFSKE
,Airbag.WANG_NEFSKE_JETTING
,Airbag.WANG_NEFSKE_MULTIPLE_JETTING
,Airbag.LOAD_CURVE
,Airbag.LINEAR_FLUID
,Airbag.HYBRID
,Airbag.HYBRID_JETTING
,Airbag.HYBRID_CHEMKIN
,Airbag.ALE
,Airbag.ADVANCED_ALE
orAirbag.PARTICLE
sid (integer) – Set ID
sidtyp (integer) – Optional. Set type: segment/part set ID
abid (integer) – Optional.
Airbag
numberheading (string) – Optional.
Airbag
title- Returns:
Airbag object
- Return type:
dict
Example
To create a new AIRBAG_SIMPLE_PRESSURE_VOLUME in model m with set ID 10 and segment set type
a = Oasys.PRIMER.Airbag(m, Oasys.PRIMER.Airbag.SIMPLE_PRESSURE_VOLUME, 10)or
a = Oasys.PRIMER.Airbag(m, Oasys.PRIMER.Airbag.SIMPLE_PRESSURE_VOLUME, 10, 0)
Static methods¶
- classmethod Airbag.Create(model, modal=Oasys.gRPC.defaultArg)¶
Starts an interactive editing panel to create an airbag
- Parameters:
model (Model) –
Model
that the airbag 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:
Airbag object (or None if not made)
- Return type:
dict
Example
To start creating an airbag in model m:
a = Oasys.PRIMER.Airbag.Create(m)
- classmethod Airbag.First(model)¶
Returns the first airbag in the model
- Parameters:
model (Model) –
Model
to get first airbag in- Returns:
Airbag object (or None if there are no airbags in the model)
- Return type:
Airbag
Example
To get the first airbag in model m:
a = Oasys.PRIMER.Airbag.First(m)
- classmethod Airbag.FirstFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the first free airbag label in the model. Also see
Airbag.LastFreeLabel()
,Airbag.NextFreeLabel()
andModel.FirstFreeItemLabel()
- Parameters:
- Returns:
Airbag label
- Return type:
int
Example
To get the first free airbag label in model m:
label = Oasys.PRIMER.Airbag.FirstFreeLabel(m)
- classmethod Airbag.FlagAll(model, flag)¶
Flags all of the airbags in the model with a defined flag
- Parameters:
model (Model) –
Model
that all airbags will be flagged inflag (Flag) – Flag to set on the airbags
- Returns:
No return value
- Return type:
None
Example
To flag all of the airbags with flag f in model m:
Oasys.PRIMER.Airbag.FlagAll(m, f)
- classmethod Airbag.GetAll(model)¶
Returns a list of Airbag objects for all of the airbags in a model in PRIMER
- Parameters:
model (Model) –
Model
to get airbags from- Returns:
List of Airbag objects
- Return type:
list
Example
To make a list of Airbag objects for all of the airbags in model m
a = Oasys.PRIMER.Airbag.GetAll(m)
- classmethod Airbag.GetFlagged(model, flag)¶
Returns a list of Airbag objects for all of the flagged airbags in a model in PRIMER
- Parameters:
model (Model) –
Model
to get airbags fromflag (Flag) – Flag set on the airbags that you want to retrieve
- Returns:
List of Airbag objects
- Return type:
list
Example
To make a list of Airbag objects for all of the airbags in model m flagged with f
a = Oasys.PRIMER.Airbag.GetFlagged(m, f)
- classmethod Airbag.GetFromID(model, number)¶
Returns the Airbag object for a airbag ID
- Parameters:
model (Model) –
Model
to find the airbag innumber (integer) – number of the airbag you want the Airbag object for
- Returns:
Airbag object (or None if airbag does not exist)
- Return type:
Airbag
Example
To get the Airbag object for airbag 100 in model m
a = Oasys.PRIMER.Airbag.GetFromID(m, 100)
- classmethod Airbag.Last(model)¶
Returns the last airbag in the model
- Parameters:
model (Model) –
Model
to get last airbag in- Returns:
Airbag object (or None if there are no airbags in the model)
- Return type:
Airbag
Example
To get the last airbag in model m:
a = Oasys.PRIMER.Airbag.Last(m)
- classmethod Airbag.LastFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the last free airbag label in the model. Also see
Airbag.FirstFreeLabel()
,Airbag.NextFreeLabel()
and seeModel.LastFreeItemLabel()
- Parameters:
- Returns:
Airbag label
- Return type:
int
Example
To get the last free airbag label in model m:
label = Oasys.PRIMER.Airbag.LastFreeLabel(m)
- classmethod Airbag.NextFreeLabel(model, layer=Oasys.gRPC.defaultArg)¶
Returns the next free (highest+1) airbag label in the model. Also see
Airbag.FirstFreeLabel()
,Airbag.LastFreeLabel()
andModel.NextFreeItemLabel()
- Parameters:
- Returns:
Airbag label
- Return type:
int
Example
To get the next free airbag label in model m:
label = Oasys.PRIMER.Airbag.NextFreeLabel(m)
- classmethod Airbag.RenumberAll(model, start)¶
Renumbers all of the airbags in the model
- Parameters:
model (Model) –
Model
that all airbags will be renumbered instart (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the airbags in model m, from 1000000:
Oasys.PRIMER.Airbag.RenumberAll(m, 1000000)
- classmethod Airbag.RenumberFlagged(model, flag, start)¶
Renumbers all of the flagged airbags in the model
- Parameters:
model (Model) –
Model
that all the flagged airbags will be renumbered inflag (Flag) – Flag set on the airbags that you want to renumber
start (integer) – Start point for renumbering
- Returns:
No return value
- Return type:
None
Example
To renumber all of the airbags in model m flagged with f, from 1000000:
Oasys.PRIMER.Airbag.RenumberFlagged(m, f, 1000000)
- classmethod Airbag.Select(flag, prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)¶
Allows the user to select airbags using standard PRIMER object menus
- Parameters:
flag (Flag) – Flag to use when selecting airbags
prompt (string) – Text to display as a prompt to the user
limit (Model or Flag) – Optional. If the argument is a
Model
then only airbags from that model can be selected. If the argument is aFlag
then only airbags that are flagged with limit can be selected (limit should be different to flag). If omitted, or None, any airbags 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 airbags selected or None if menu cancelled
- Return type:
int
Example
To select airbags from model m, flagging those selected with flag f, giving the prompt ‘Select airbags’:
Oasys.PRIMER.Airbag.Select(f, 'Select airbags', m)To select airbags, flagging those selected with flag f but limiting selection to airbags flagged with flag l, giving the prompt ‘Select airbags’:
Oasys.PRIMER.Airbag.Select(f, 'Select airbags', l)
- classmethod Airbag.SketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Sketches all of the flagged airbags in the model. The airbags will be sketched until you either call
Airbag.Unsketch()
,Airbag.UnsketchFlagged()
,Model.UnsketchAll()
, or delete the model
- Parameters:
model (Model) –
Model
that all the flagged airbags will be sketched inflag (Flag) – Flag set on the airbags that you want to sketch
redraw (boolean) – Optional. If model should be redrawn or not after the airbags are sketched. If omitted redraw is true. If you want to sketch flagged airbags 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 airbags flagged with flag in model m:
Oasys.PRIMER.Airbag.SketchFlagged(m, flag)
- classmethod Airbag.Total(model, exists=Oasys.gRPC.defaultArg)¶
Returns the total number of airbags in the model
- Parameters:
model (Model) –
Model
to get total forexists (boolean) – Optional. true if only existing airbags should be counted. If false or omitted referenced but undefined airbags will also be included in the total
- Returns:
number of airbags
- Return type:
int
Example
To get the total number of airbags in model m:
total = Oasys.PRIMER.Airbag.Total(m)
- classmethod Airbag.UnflagAll(model, flag)¶
Unsets a defined flag on all of the airbags in the model
- Parameters:
model (Model) –
Model
that the defined flag for all airbags will be unset inflag (Flag) – Flag to unset on the airbags
- Returns:
No return value
- Return type:
None
Example
To unset the flag f on all the airbags in model m:
Oasys.PRIMER.Airbag.UnflagAll(m, f)
- classmethod Airbag.UnsketchAll(model, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all airbags
- Parameters:
model (Model) –
Model
that all airbags will be unblanked inredraw (boolean) – Optional. If model should be redrawn or not after the airbags 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 airbags in model m:
Oasys.PRIMER.Airbag.UnsketchAll(m)
- classmethod Airbag.UnsketchFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)¶
Unsketches all flagged airbags in the model
- Parameters:
model (Model) –
Model
that all airbags will be unsketched inflag (Flag) – Flag set on the airbags that you want to unsketch
redraw (boolean) – Optional. If model should be redrawn or not after the airbags 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 airbags flagged with flag in model m:
Oasys.PRIMER.Airbag.UnsketchAll(m, flag)
Instance methods¶
- Airbag.AssociateComment(comment)¶
Associates a comment with a airbag
- Parameters:
comment (Comment) –
Comment
that will be attached to the airbag- Returns:
No return value
- Return type:
None
Example
To associate comment c to the airbag a:
a.AssociateComment(c)
- Airbag.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 airbag a:
a.Browse()
- Airbag.ClearFlag(flag)¶
Clears a flag on the airbag
- Parameters:
flag (Flag) – Flag to clear on the airbag
- Returns:
No return value
- Return type:
None
Example
To clear flag f for airbag a:
a.ClearFlag(f)
- Airbag.Copy(range=Oasys.gRPC.defaultArg)¶
Copies the airbag. The target include of the copied airbag 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:
Airbag object
- Return type:
Airbag
Example
To copy airbag a into airbag z:
z = a.Copy()
- Airbag.DetachComment(comment)¶
Detaches a comment from a airbag
- Parameters:
comment (Comment) –
Comment
that will be detached from the airbag- Returns:
No return value
- Return type:
None
Example
To detach comment c from the airbag a:
a.DetachComment(c)
- Airbag.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 airbag a:
a.Edit()
- Airbag.ExtractColour()¶
Extracts the actual colour used for airbag.
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 airbagcolour
property will return the valueColour.PART
instead of the actual colour. This method will return the actual colour which is used for drawing the airbag
- Returns:
colour value (integer)
- Return type:
int
Example
To return the colour used for drawing airbag a:
colour = a.ExtractColour()
- Airbag.Flagged(flag)¶
Checks if the airbag is flagged or not
- Parameters:
flag (Flag) – Flag to test on the airbag
- Returns:
True if flagged, False if not
- Return type:
bool
Example
To check if airbag a has flag f set on it:
if a.Flagged(f): do_something..
- Airbag.GetComments()¶
Extracts the comments associated to a airbag
- 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 airbag a:
comm_list = a.GetComments()
- Airbag.GetParameter(prop)¶
Checks if a Airbag 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 theAirbag.ViewParameters()
method and ‘method chaining’ (see the examples below)
- Parameters:
prop (string) – airbag property to get parameter for
- Returns:
Parameter object if property is a parameter, None if not
- Return type:
dict
Example
To check if Airbag 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 Airbag property a.example is a parameter by using the GetParameter method:
if a.ViewParameters().GetParameter(a.example): do_something..
- Airbag.GetPropertyByIndex(index)¶
Returns the value of property at index index for this
Airbag
object or None if no property exists
- Parameters:
index (integer) – The index of the property value to retrieve. (the number of properties can be found from
properties
) Note that indices start at 0. There is no link between indices and rows/columns so adjacent fields on a line for an airbag may not have adjacent indices- Returns:
Property value (float/integer)
- Return type:
int
Example
To return the property at index 3, for airbag a:
prop = a.GetPropertyByIndex(3)
- Airbag.GetPropertyByName(acronym)¶
Returns the value of property string acronym for this
Airbag
object or None if no property exists
- Parameters:
acronym (string) – The acronym of the property value to retrieve
- Returns:
Property value (float/integer)
- Return type:
int
Example
To return the value of HCONV for airbag a:
hconv = a.GetPropertyByName("HCONV")
- Airbag.GetPropertyByRowCol(row, col)¶
Returns the value of the property for row and col for this
Airbag
object or None if no property exists. Note that columns start at 0. Rows start at 1 if the _ID option is set, at 0 otherwise
- Parameters:
row (integer) – The row of the property value to retrieve
col (integer) – The column of the property value to retrieve
- Returns:
Property value (float/integer)
- Return type:
int
Example
To return the value of the property at row 0, column 3 for airbag a:
prop = a.GetPropertyByRowCol(0, 3)
- Airbag.GetPropertyNameForIndex(index)¶
Returns the name of the property at index index for this
Airbag
object or None if there is no property
- Parameters:
index (integer) – The index of the property name to retrieve. (the number of properties can be found from
properties
) Note that indices start at 0. There is no link between indices and rows/columns so adjacent fields on a line for an airbag may not have adjacent indices- Returns:
Property name (string)
- Return type:
str
Example
To return the name of the property at index 3, for airbag a:
name = a.GetPropertyNameForIndex(3)
- Airbag.GetPropertyNameForRowCol(row, col)¶
Returns the name of the property at row and col for this
Airbag
object or None if there is no property. Note that columns start at 0. Rows start at 1 if the _ID option is set, at 0 otherwise
- Parameters:
row (integer) – The row of the property name to retrieve
col (integer) – The column of the property name to retrieve
- Returns:
Property name (string)
- Return type:
str
Example
To return the name of the property at row 0, column 1 for airbag a:
name = a.GetPropertyNameForRowCol(0, 1)
- Airbag.Keyword()¶
Returns the keyword for this airbag (e.g. *AIRBAG_SIMPLE_PRESSURE_VOLUME, *AIRBAG_SIMPLE_AIRBAG_MODEL etc). Note that a carriage return is not added. See also
Airbag.KeywordCards()
- Returns:
string containing the keyword
- Return type:
str
Example
To get the keyword for airbag a:
key = a.Keyword()
- Airbag.KeywordCards()¶
Returns the keyword cards for the airbag. Note that a carriage return is not added. See also
Airbag.Keyword()
- Returns:
string containing the cards
- Return type:
str
Example
To get the cards for airbag a:
cards = a.KeywordCards()
- Airbag.Next()¶
Returns the next airbag in the model
- Returns:
Airbag object (or None if there are no more airbags in the model)
- Return type:
Airbag
Example
To get the airbag in model m after airbag a:
a = a.Next()
- Airbag.Previous()¶
Returns the previous airbag in the model
- Returns:
Airbag object (or None if there are no more airbags in the model)
- Return type:
Airbag
Example
To get the airbag in model m before airbag a:
a = a.Previous()
- Airbag.SetFlag(flag)¶
Sets a flag on the airbag
- Parameters:
flag (Flag) – Flag to set on the airbag
- Returns:
No return value
- Return type:
None
Example
To set flag f for airbag a:
a.SetFlag(f)
- Airbag.SetPropertyByIndex(index, value)¶
Sets the value of property at index index for this
Airbag
object
- Parameters:
index (integer) – The index of the property value to set. (the number of properties can be found from
properties
) Note that indices start at 0. There is no link between indices and rows/columns so adjacent fields on a line for an airbag may not have adjacent indicesvalue (integer/float for numeric properties, string for character properties) – The value of the property to set
- Returns:
No return value
- Return type:
None
Example
To set the property at index 3, for airbag a to be 1.234:
a.SetPropertyByIndex(3, 1.234)
- Airbag.SetPropertyByName(acronym, value)¶
Sets the value of property string acronym for this
Airbag
object
- Parameters:
acronym (string) – The acronym of the property value to set
value (integer/float for numeric properties, string for character properties) – The value of the property to set
- Returns:
No return value
- Return type:
None
Example
To set the value of HCONV for airbag a to be 1.23:
a.SetPropertyByName("HCONV", 1.23)
- Airbag.SetPropertyByRowCol(row, col, value)¶
Sets the value of the property for row and col for this
Airbag
object. Note that columns start at 0. Rows start at 1 if the _ID option is set, at 0 otherwise
- Parameters:
row (integer) – The row of the property value to set
col (integer) – The column of the property value to set
value (integer/float for numeric properties, string for character properties) – The value of the property to set
- Returns:
No return value
- Return type:
None
Example
To set the value of the property at row 0, column 3 for airbag a to be 0.5:
a.SetPropertyByRowCol(0, 3, 0.5)
- Airbag.Sketch(redraw=Oasys.gRPC.defaultArg)¶
Sketches the airbag. The airbag will be sketched until you either call
Airbag.Unsketch()
,Airbag.UnsketchAll()
,Model.UnsketchAll()
, or delete the model
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the airbag is sketched. If omitted redraw is true. If you want to sketch several airbags 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 airbag a:
a.Sketch()
- Airbag.Unsketch(redraw=Oasys.gRPC.defaultArg)¶
Unsketches the airbag
- Parameters:
redraw (boolean) – Optional. If model should be redrawn or not after the airbag is unsketched. If omitted redraw is true. If you want to unsketch several airbags 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 airbag a:
a.Unsketch()
- Airbag.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:
Airbag object
- Return type:
dict
Example
To check if Airbag property a.example is a parameter by using the
Airbag.GetParameter()
method:if a.ViewParameters().GetParameter(a.example): do_something..
- Airbag.Xrefs()¶
Returns the cross references for this airbag
- Returns:
Xrefs object
- Return type:
dict
Example
To get the cross references for airbag a:
xrefs = a.Xrefs()