The Airbag class gives you access to airbag cards in PRIMER. More...
The PRIMER JavaScript API provides many class constants, properties and methods. For Arup to
be able to extend and enhance the API in the future any constant, property or method names beginning with a lowercase
or uppercase letter are reserved.
If you need to add your own properties or methods to one of the existing classes then to avoid any potential future conflict you
should ensure that the name begins with either an underscore (_) or a dollar sign ($) or the name is prefixed with your
own unique identifier.
For example if company 'ABC' need to add a property called 'example' then to avoid any potential future conflict use one of:
| Name | Type | Description |
| abid | integer | Airbag number. Also see the label property which is an alternative name for this. |
| colour | Colour | The colour of the airbag |
| cols (read only) | real | The number of columns of data the airbag has |
| exists (read only) | logical | true if airbag exists, false if referred to but not defined. |
| id | logical | Turns _ID on or OFF |
| include | integer | The Include file number that the airbag is in. |
| label | integer | Airbag number. Also see the abid property which is an alternative name for this. |
| model (read only) | integer | The Model number that the airbag is in. |
| properties | integer | The total number of properties that the airbag has |
| rows (read only) | integer | The number of rows of data the airbag has. This includes the _ID card if it is set. |
| title | string | Airbag title |
| 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 or Airbag.PARTICLE |
Detailed DescriptionThe Airbag class allows you to create, modify, edit and manipulate airbag cards. See the documentation below for more details. |
Constructornew Airbag(Model[Model], type[string], sid[integer], sidtyp (optional)[integer], abid (optional)[integer], heading (optional)[string])DescriptionCreate a new Airbag object. |
Model that airbag will be created in
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 or Airbag.PARTICLE
Set ID
Set type: segment/part set ID
Airbag number
Airbag title
ReturnsAirbag object Return typeAirbag |
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a airbag. |
Comment that will be attached to the airbag
ReturnsNo return value |
ExampleTo associate comment c to the airbag a: a.AssociateComment(c);
|
Browse(modal (optional)[boolean])DescriptionStarts an edit panel in Browse mode. |
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.
Returnsno return value |
ExampleTo Browse airbag a: a.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the airbag. |
Flag to clear on the airbag
ReturnsNo return value |
ExampleTo clear flag f for airbag a: a.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the airbag. The target include of the copied airbag can be set using Options.copy_target_include. |
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().
ReturnsAirbag object Return typeAirbag |
ExampleTo copy airbag a into airbag z: var z = a.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a airbag |
Model that the airbag will be created in.
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.
ReturnsAirbag object (or null if not made). Return typeAirbag |
ExampleTo start creating a airbag in model m: var a = Airbag.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a airbag. |
Comment that will be detached from the airbag
ReturnsNo return value |
ExampleTo detach comment c from the airbag a: a.DetachComment(c);
|
Edit(modal (optional)[boolean])DescriptionStarts an interactive editing panel. |
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.
Returnsno return value |
ExampleTo Edit airbag a: a.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for airbag. For more details on checking see the Check class. |
The error message to give
An optional detailed error message
ReturnsNo return value |
ExampleTo add an error message "My custom error" for airbag a: a.Error("My custom error");
|
ExtractColour()DescriptionExtracts the actual colour used for airbag. |
No arguments
Returnscolour value (integer) Return typeNumber |
ExampleTo return the colour used for drawing airbag a: var colour = a.ExtractColour();
|
First(Model[Model]) [static]DescriptionReturns the first airbag in the model. |
Model to get first airbag in
ReturnsAirbag object (or null if there are no airbags in the model). Return typeAirbag |
ExampleTo get the first airbag in model m: var a = Airbag.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free airbag label in the model. Also see Airbag.LastFreeLabel(), Airbag.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free airbag label in
Include file (0 for the main file) to search for labels in (Equivalent to First free in layer in editing panels). If omitted the whole model will be used (Equivalent to First free in editing panels).
ReturnsAirbag label. Return typeNumber |
ExampleTo get the first free airbag label in model m: var label = Airbag.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the airbags in the model with a defined flag. |
Model that all airbags will be flagged in
Flag to set on the airbags
ReturnsNo return value |
ExampleTo flag all of the airbags with flag f in model m: Airbag.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the airbag is flagged or not. |
Flag to test on the airbag
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if airbag a has flag f set on it: if (a.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each airbag in the model. |
Model that all airbags are in
Function to call for each airbag
An optional extra object/array/string etc that will appended to arguments when calling the function
ReturnsNo return value |
GetAll(Model[Model], property (optional)[string]) [static]DescriptionReturns an array of Airbag objects or properties for all of the airbags in a model in PRIMER. If the optional property argument is not given then an array of Airbag objects is returned. If the property argument is given, that property value for each airbag is returned in the array instead of a Airbag object |
Model to get airbags from
Name for property to get for all airbags in the model
ReturnsArray of Airbag objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a airbag. |
No arguments
ReturnsArray of Comment objects (or null if there are no comments associated to the node). Return typeArray |
ExampleTo get the array of comments associated to the airbag a: var comm_array = a.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of Airbag objects for all of the flagged airbags in a model in PRIMER If the optional property argument is not given then an array of Airbag objects is returned. If the property argument is given, then that property value for each airbag is returned in the array instead of a Airbag object |
Model to get airbags from
Flag set on the airbags that you want to retrieve
Name for property to get for all flagged airbags in the model
ReturnsArray of Airbag objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the Airbag object for a airbag ID. |
Model to find the airbag in
number of the airbag you want the Airbag object for
ReturnsAirbag object (or null if airbag does not exist). Return typeAirbag |
ExampleTo get the Airbag object for airbag 100 in model m var a = Airbag.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks 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 the Airbag.ViewParameters() method and 'method chaining' (see the examples below). |
airbag property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
GetPropertyByIndex(index[integer])DescriptionReturns the value of property at index index for this Airbag object or null if no property exists. |
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.
ReturnsProperty value (real/integer) Return typeNumber |
ExampleTo return the property at index 3, for airbag a: var prop = a.GetPropertyByIndex(3);
|
GetPropertyByName(acronym[string])DescriptionReturns the value of property string acronym for this Airbag object or null if no property exists. |
The acronym of the property value to retrieve
ReturnsProperty value (real/integer) Return typeNumber |
ExampleTo return the value of HCONV for airbag a: var hconv = a.GetPropertyByName("HCONV");
|
GetPropertyByRowCol(row[integer], col[integer])DescriptionReturns the value of the property for row and col for this Airbag object or null if no property exists. Note that columns start at 0. Rows start at 1 if the _ID option is set, at 0 otherwise. |
The row of the property value to retrieve
The column of the property value to retrieve
ReturnsProperty value (real/integer) Return typeNumber |
ExampleTo return the value of the property at row 0, column 3 for airbag a: var prop = a.GetPropertyByRowCol(0, 3);
|
GetPropertyNameForIndex(index[integer])DescriptionReturns the name of the property at index index for this Airbag object or null if there is no property. |
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.
ReturnsProperty name (string) Return typeString |
ExampleTo return the name of the property at index 3, for airbag a: var name = a.GetPropertyNameForIndex(3);
|
GetPropertyNameForRowCol(row[integer], col[integer])DescriptionReturns the name of the property at row and col for this Airbag object or null if there is no property. Note that columns start at 0. Rows start at 1 if the _ID option is set, at 0 otherwise. |
The row of the property name to retrieve
The column of the property name to retrieve
ReturnsProperty name (string) Return typeString |
ExampleTo return the name of the property at row 0, column 1 for airbag a: var name = a.GetPropertyNameForRowCol(0, 1);
|
Keyword()DescriptionReturns 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() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for airbag a: var key = a.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the airbag. Note that a carriage return is not added. See also Airbag.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for airbag a: var cards = a.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last airbag in the model. |
Model to get last airbag in
ReturnsAirbag object (or null if there are no airbags in the model). Return typeAirbag |
ExampleTo get the last airbag in model m: var a = Airbag.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free airbag label in the model. Also see Airbag.FirstFreeLabel(), Airbag.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free airbag label in
Include file (0 for the main file) to search for labels in (Equivalent to Highest free in layer in editing panels). If omitted the whole model will be used.
ReturnsAirbag label. Return typeNumber |
ExampleTo get the last free airbag label in model m: var label = Airbag.LastFreeLabel(m);
|
Next()DescriptionReturns the next airbag in the model. |
No arguments
ReturnsAirbag object (or null if there are no more airbags in the model). Return typeAirbag |
ExampleTo get the airbag in model m after airbag a: var a = a.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) airbag label in the model. Also see Airbag.FirstFreeLabel(), Airbag.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free airbag label in
Include file (0 for the main file) to search for labels in (Equivalent to Highest+1 in layer in editing panels). If omitted the whole model will be used (Equivalent to Highest+1 in editing panels).
ReturnsAirbag label. Return typeNumber |
ExampleTo get the next free airbag label in model m: var label = Airbag.NextFreeLabel(m);
|
Previous()DescriptionReturns the previous airbag in the model. |
No arguments
ReturnsAirbag object (or null if there are no more airbags in the model). Return typeAirbag |
ExampleTo get the airbag in model m before airbag a: var a = a.Previous();
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the airbags in the model. |
Model that all airbags will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the airbags in model m, from 1000000: Airbag.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged airbags in the model. |
Model that all the flagged airbags will be renumbered in
Flag set on the airbags that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the airbags in model m flagged with f, from 1000000: Airbag.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select airbags using standard PRIMER object menus. |
Flag to use when selecting airbags
Text to display as a prompt to the user
If the argument is a Model then only airbags from that model can be selected. If the argument is a Flag then only airbags that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any airbags can be selected. from any model.
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.
ReturnsNumber of airbags selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the airbag. |
Flag to set on the airbag
ReturnsNo return value |
ExampleTo set flag f for airbag a: a.SetFlag(f);
|
SetPropertyByIndex(index[integer], value[integer/real for numeric properties, string for character properties])DescriptionSets the value of property at index index for this Airbag object |
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 indices.
The value of the property to set.
ReturnsNo return value |
ExampleTo set the property at index 3, for airbag a to be 1.234: a.SetPropertyByIndex(3, 1.234);
|
SetPropertyByName(acronym[string], value[integer/real for numeric properties, string for character properties])DescriptionSets the value of property string acronym for this Airbag object |
The acronym of the property value to set
The value of the property to set.
ReturnsNo return value |
ExampleTo set the value of HCONV for airbag a to be 1.23: a.SetPropertyByName("HCONV", 1.23);
|
SetPropertyByRowCol(row[integer], col[integer], value[integer/real for numeric properties, string for character properties])DescriptionSets 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. |
The row of the property value to set
The column of the property value to set
The value of the property to set.
ReturnsNo return value |
ExampleTo set the value of the property at row 0, column 3 for airbag a to be 0.5: a.SetPropertyByRowCol(0, 3, 0.5);
|
Sketch(redraw (optional)[boolean])DescriptionSketches the airbag. The airbag will be sketched until you either call Airbag.Unsketch(), Airbag.UnsketchAll(), Model.UnsketchAll(), or delete the model |
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().
ReturnsNo return value |
ExampleTo sketch airbag a: a.Sketch();
|
SketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionSketches 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 |
Model that all the flagged airbags will be sketched in
Flag set on the airbags that you want to sketch
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().
ReturnsNo return value |
ExampleTo sketch all airbags flagged with flag in model m: Airbag.SketchFlagged(m, flag);
|
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of airbags in the model. |
Model to get total for
true if only existing airbags should be counted. If false or omitted referenced but undefined airbags will also be included in the total.
Returnsnumber of airbags Return typeNumber |
ExampleTo get the total number of airbags in model m: var total = Airbag.Total(m);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the airbags in the model. |
Model that the defined flag for all airbags will be unset in
Flag to unset on the airbags
ReturnsNo return value |
ExampleTo unset the flag f on all the airbags in model m: Airbag.UnflagAll(m, f);
|
Unsketch(redraw (optional)[boolean])DescriptionUnsketches the airbag. |
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().
ReturnsNo return value |
ExampleTo unsketch airbag a: a.Unsketch();
|
UnsketchAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnsketches all airbags. |
Model that all airbags will be unblanked in
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().
ReturnsNo return value |
ExampleTo unsketch all airbags in model m: Airbag.UnsketchAll(m);
|
UnsketchFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnsketches all flagged airbags in the model. |
Model that all airbags will be unsketched in
Flag set on the airbags that you want to unsketch
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().
ReturnsNo return value |
ExampleTo unsketch all airbags flagged with flag in model m: Airbag.UnsketchAll(m, flag);
|
No arguments
ReturnsAirbag object. Return typeAirbag |
ExampleTo check if Airbag property a.example is a parameter by using the Airbag.GetParameter() method: if (a.ViewParameters().GetParameter(a.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for airbag. For more details on checking see the Check class. |
The warning message to give
An optional detailed warning message
ReturnsNo return value |
ExampleTo add a warning message "My custom warning" for airbag a: a.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this airbag. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for airbag a: var xrefs = a.Xrefs();
|
toString()DescriptionCreates a string containing the airbag data in keyword format. Note that this contains the keyword header and the keyword cards. See also Airbag.Keyword() and Airbag.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for airbag a in keyword format var s = a.toString();
|