The SensorSwitch class gives you access to *SENSOR_SWITCH keyword 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 ID. |
| amax | real | Maximum allowable area for failed vent surface area (VA). |
| c23 | integer/real | Vent coefficient if positive or user defined load curve ID if negative. |
| exists (read only) | logical | true if *SENSOR_SWITCH exists, false if referred to but not defined. |
| filtrid | integer | Filter ID. |
| id | integer | Part set ID or Part ID. |
| id_flag | logical | Turns _TITLE/_ID ON or OFF. Used only for SensorSwitch.SWITCH_SHELL_TO_VENT. |
| include | integer | The Include file number that the *SENSOR_SWITCH is in. |
| itype | integer | 0 for Part, 1 for Part Set. |
| label | integer | SensorSwitch number. The switid property is an alternative name for this. |
| logic | string | Logic operator. |
| model (read only) | integer | The Model number that the *SENSOR_SWITCH is in. |
| nrow | integer | Number of Shell Fail Time Cards. |
| nswit (read only) | integer | Number of sensor switch IDs defined. IDs can be positive for "AND", negative ID for "OR". Applicable to SensorSwitch.SWITCH_CALC_LOGIC. |
| option | constant | SENSOR_SWITCH suffix. Can be SensorSwitch.SWITCH, SensorSwitch.SWITCH_CALC_LOGIC or SensorSwitch.SWITCH_SHELL_TO_VENT. |
| sensid | integer | ID of the sensor whose value will be compared. |
| switid | integer | SensorSwitch number. The label property is an alternative name for this. |
| timwin | real | Trigger status change when the value given by the sensor is less/greater (depending on logic) than value for duration defined by timwin. |
| title | string | SensorSwitch title. Used only for SensorSwitch.SWITCH_SHELL_TO_VENT. |
| type | string | This property is deprecated in version R9.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions. Type used for sensor. Can either be "SENSOR" or "TIME" [deprecated] |
| value | real | Critical value. |
Detailed DescriptionThe SensorSwitch class allows you to create, modify, edit and manipulate *SENSOR_SWITCH. See the documentation below for more details. |
Constructornew SensorSwitch(Option[constant], Model[Model], Switch ID[integer])DescriptionCreate a new SensorSwitch object. |
SENSOR_SWITCH suffix. Can be SensorSwitch.SWITCH, SensorSwitch.SWITCH_CALC_LOGIC or SensorSwitch.SWITCH_SHELL_TO_VENT.
Model that *SENSOR_SWITCH will be created in
SensorSwitch id. This is required for the SensorSwitch.SWITCH and SensorSwitch.SWITCH_CALC_LOGIC options and ignored for SensorSwitch.SWITCH_SHELL_TO_VENT.
ReturnsSensorSwitch object Return typeSensorSwitch |
ExampleTo create a new *SENSOR_SWITCH in model m with label 100: var sc = new SensorSwitch(SensorSwitch.SWITCH, m, 100);
|
Details of functionsAssociateComment(Comment[Comment])DescriptionAssociates a comment with a *SENSOR_SWITCH. |
Comment that will be attached to the *SENSOR_SWITCH
ReturnsNo return value |
ExampleTo associate comment c to the *SENSOR_SWITCH ss: ss.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 *SENSOR_SWITCH ss: ss.Browse();
|
ClearFlag(flag[Flag])DescriptionClears a flag on the *SENSOR_SWITCH. |
Flag to clear on the *SENSOR_SWITCH
ReturnsNo return value |
ExampleTo clear flag f for *SENSOR_SWITCH ss: ss.ClearFlag(f);
|
Copy(range (optional)[boolean])DescriptionCopies the *SENSOR_SWITCH. The target include of the copied *SENSOR_SWITCH 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().
ReturnsSensorSwitch object Return typeSensorSwitch |
ExampleTo copy *SENSOR_SWITCH ss into *SENSOR_SWITCH z: var z = ss.Copy();
|
Create(Model[Model], modal (optional)[boolean]) [static]DescriptionStarts an interactive editing panel to create a *SENSOR_SWITCH |
Model that the *SENSOR_SWITCH 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.
ReturnsSensorSwitch object (or null if not made). Return typeSensorSwitch |
ExampleTo start creating a *SENSOR_SWITCH in model m: var ss = SensorSwitch.Create(m);
|
DetachComment(Comment[Comment])DescriptionDetaches a comment from a *SENSOR_SWITCH. |
Comment that will be detached from the *SENSOR_SWITCH
ReturnsNo return value |
ExampleTo detach comment c from the *SENSOR_SWITCH ss: ss.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 *SENSOR_SWITCH ss: ss.Edit();
|
Error(message[string], details (optional)[string])DescriptionAdds an error for *SENSOR_SWITCH. 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 *SENSOR_SWITCH ss: ss.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first *SENSOR_SWITCH in the model. |
Model to get first *SENSOR_SWITCH in
ReturnsSensorSwitch object (or null if there are no *SENSOR_SWITCHs in the model). Return typeSensorSwitch |
ExampleTo get the first *SENSOR_SWITCH in model m: var ss = SensorSwitch.First(m);
|
FirstFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the first free *SENSOR_SWITCH label in the model. Also see SensorSwitch.LastFreeLabel(), SensorSwitch.NextFreeLabel() and Model.FirstFreeItemLabel(). |
Model to get first free *SENSOR_SWITCH 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).
ReturnsSensorSwitch label. Return typeNumber |
ExampleTo get the first free *SENSOR_SWITCH label in model m: var label = SensorSwitch.FirstFreeLabel(m);
|
FlagAll(Model[Model], flag[Flag]) [static]DescriptionFlags all of the *SENSOR_SWITCHs in the model with a defined flag. |
Model that all *SENSOR_SWITCHs will be flagged in
Flag to set on the *SENSOR_SWITCHs
ReturnsNo return value |
ExampleTo flag all of the *SENSOR_SWITCHs with flag f in model m: SensorSwitch.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the *SENSOR_SWITCH is flagged or not. |
Flag to test on the *SENSOR_SWITCH
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if *SENSOR_SWITCH ss has flag f set on it: if (ss.Flagged(f) ) do_something...
|
ForEach(Model[Model], func[function], extra (optional)[any]) [static]DescriptionCalls a function for each *SENSOR_SWITCH in the model. |
Model that all *SENSOR_SWITCHs are in
Function to call for each *SENSOR_SWITCH
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 SensorSwitch objects or properties for all of the *SENSOR_SWITCHs in a model in PRIMER. If the optional property argument is not given then an array of SensorSwitch objects is returned. If the property argument is given, that property value for each *SENSOR_SWITCH is returned in the array instead of a SensorSwitch object |
Model to get *SENSOR_SWITCHs from
Name for property to get for all *SENSOR_SWITCHs in the model
ReturnsArray of SensorSwitch objects or properties Return typeArray |
GetComments()DescriptionExtracts the comments associated to a *SENSOR_SWITCH. |
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 *SENSOR_SWITCH ss: var comm_array = ss.GetComments();
|
GetFlagged(Model[Model], flag[Flag], property (optional)[string]) [static]DescriptionReturns an array of SensorSwitch objects for all of the flagged *SENSOR_SWITCHs in a model in PRIMER If the optional property argument is not given then an array of SensorSwitch objects is returned. If the property argument is given, then that property value for each *SENSOR_SWITCH is returned in the array instead of a SensorSwitch object |
Model to get *SENSOR_SWITCHs from
Flag set on the *SENSOR_SWITCHs that you want to retrieve
Name for property to get for all flagged *SENSOR_SWITCHs in the model
ReturnsArray of SensorSwitch objects or properties Return typeArray |
GetFromID(Model[Model], number[integer]) [static]DescriptionReturns the SensorSwitch object for a *SENSOR_SWITCH ID. |
Model to find the *SENSOR_SWITCH in
number of the *SENSOR_SWITCH you want the SensorSwitch object for
ReturnsSensorSwitch object (or null if *SENSOR_SWITCH does not exist). Return typeSensorSwitch |
ExampleTo get the SensorSwitch object for *SENSOR_SWITCH 100 in model m var ss = SensorSwitch.GetFromID(m, 100);
|
GetParameter(prop[string])DescriptionChecks if a SensorSwitch 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 SensorSwitch.ViewParameters() method and 'method chaining' (see the examples below). |
*SENSOR_SWITCH property to get parameter for
ReturnsParameter object if property is a parameter, null if not. Return typeParameter |
GetRow(row[integer])DescriptionReturns the data for a row in the SENSOR_SWITCH_SHELL_TO_VENT. |
The row you want the data for. Note row indices start at 0.
ReturnsAn array of numbers containing the row variables SSID, FTIME and C23V. Return typeNumber |
ExampleTo get the data for the 2nd row in sensor switch ss: var data = ss.GetRow(1);
|
GetSwitch(row[integer])DescriptionReturns switch ID information for *SENSOR_SWITCH_CALC-LOGIC. |
The row you want the data for. Note row indices start at 0.
ReturnsObject containing sensor switch ID information. Return typeObject |
ExampleTo get the data for the 2nd switch in sensor switch ss: var data = ss.GetSwitch(1);
Message("Switch 2: " + data.swit);
|
Keyword()DescriptionReturns the keyword for this *SENSOR_SWITCH. Note that a carriage return is not added. See also SensorSwitch.KeywordCards() |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for SensorSwitch ss: var key = ss.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the *SENSOR_SWITCH. Note that a carriage return is not added. See also SensorSwitch.Keyword() |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for sensor switch ss: var cards = ss.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last *SENSOR_SWITCH in the model. |
Model to get last *SENSOR_SWITCH in
ReturnsSensorSwitch object (or null if there are no *SENSOR_SWITCHs in the model). Return typeSensorSwitch |
ExampleTo get the last *SENSOR_SWITCH in model m: var ss = SensorSwitch.Last(m);
|
LastFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the last free *SENSOR_SWITCH label in the model. Also see SensorSwitch.FirstFreeLabel(), SensorSwitch.NextFreeLabel() and see Model.LastFreeItemLabel() |
Model to get last free *SENSOR_SWITCH 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.
ReturnsSensorSwitch label. Return typeNumber |
ExampleTo get the last free *SENSOR_SWITCH label in model m: var label = SensorSwitch.LastFreeLabel(m);
|
Next()DescriptionReturns the next *SENSOR_SWITCH in the model. |
No arguments
ReturnsSensorSwitch object (or null if there are no more *SENSOR_SWITCHs in the model). Return typeSensorSwitch |
ExampleTo get the *SENSOR_SWITCH in model m after *SENSOR_SWITCH ss: var ss = ss.Next();
|
NextFreeLabel(Model[Model], layer (optional)[Include number]) [static]DescriptionReturns the next free (highest+1) *SENSOR_SWITCH label in the model. Also see SensorSwitch.FirstFreeLabel(), SensorSwitch.LastFreeLabel() and Model.NextFreeItemLabel() |
Model to get next free *SENSOR_SWITCH 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).
ReturnsSensorSwitch label. Return typeNumber |
ExampleTo get the next free *SENSOR_SWITCH label in model m: var label = SensorSwitch.NextFreeLabel(m);
|
Previous()DescriptionReturns the previous *SENSOR_SWITCH in the model. |
No arguments
ReturnsSensorSwitch object (or null if there are no more *SENSOR_SWITCHs in the model). Return typeSensorSwitch |
ExampleTo get the *SENSOR_SWITCH in model m before *SENSOR_SWITCH ss: var ss = ss.Previous();
|
RemoveRow(row[integer])DescriptionRemoves the data for a row in *SENSOR_SWITCH_SHELL_TO_VENT. |
The row you want to remove the data for. Note that row indices start at 0.
ReturnsNo return value. |
ExampleTo remove the second row of data for sensor switch ss: ss.RemoveRow(1);
|
RemoveSwitch(row[integer])DescriptionRemoves sensor switch ID from *SENSOR_SWITCH_CALC-LOGIC. |
The sensor switch ID that you want to remove. Note that row indices start at 0.
ReturnsNo return value. |
ExampleTo remove the second sensor switch ID for sensor switch ss: ss.RemoveSwitch(1);
|
RenumberAll(Model[Model], start[integer]) [static]DescriptionRenumbers all of the *SENSOR_SWITCHs in the model. |
Model that all *SENSOR_SWITCHs will be renumbered in
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the *SENSOR_SWITCHs in model m, from 1000000: SensorSwitch.RenumberAll(m, 1000000);
|
RenumberFlagged(Model[Model], flag[Flag], start[integer]) [static]DescriptionRenumbers all of the flagged *SENSOR_SWITCHs in the model. |
Model that all the flagged *SENSOR_SWITCHs will be renumbered in
Flag set on the *SENSOR_SWITCHs that you want to renumber
Start point for renumbering
ReturnsNo return value |
ExampleTo renumber all of the *SENSOR_SWITCHs in model m flagged with f, from 1000000: SensorSwitch.RenumberFlagged(m, f, 1000000);
|
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean]) [static]DescriptionAllows the user to select *SENSOR_SWITCHs using standard PRIMER object menus. |
Flag to use when selecting *SENSOR_SWITCHs
Text to display as a prompt to the user
If the argument is a Model then only *SENSOR_SWITCHs from that model can be selected. If the argument is a Flag then only *SENSOR_SWITCHs that are flagged with limit can be selected (limit should be different to flag). If omitted, or null, any *SENSOR_SWITCHs 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 *SENSOR_SWITCHs selected or null if menu cancelled Return typeNumber |
SetFlag(flag[Flag])DescriptionSets a flag on the *SENSOR_SWITCH. |
Flag to set on the *SENSOR_SWITCH
ReturnsNo return value |
ExampleTo set flag f for *SENSOR_SWITCH ss: ss.SetFlag(f);
|
SetRow(row[integer], data[Array of data])DescriptionSets the data for a row in *SENSOR_SWITCH_SHELL_TO_VENT. |
The row you want to set the data for. Note that row indices start at 0.
An array containing the row variables SSID, FTIME and C23V.
ReturnsNo return value. |
SetSwitch(index[integer], data[object])DescriptionSpecifies a sensor switch ID for a *SENSOR_SWITCH_CALC-LOGIC. |
The index of the *SENSOR_SWITCH_CALC-LOGIC data to set. Note that indices start at 0, not 1.
0 <= index <= nswit
Object containing sensor swith ID data.
Object has the following properties:
| Name | Type | Description |
| swit | integer | Positive or negative sensor switch id. |
ReturnsNo return value. |
Total(Model[Model], exists (optional)[boolean]) [static]DescriptionReturns the total number of *SENSOR_SWITCHs in the model. |
Model to get total for
true if only existing *SENSOR_SWITCHs should be counted. If false or omitted referenced but undefined *SENSOR_SWITCHs will also be included in the total.
Returnsnumber of *SENSOR_SWITCHs Return typeNumber |
ExampleTo get the total number of *SENSOR_SWITCHs in model m: var total = SensorSwitch.Total(m);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the *SENSOR_SWITCHs in the model. |
Model that the defined flag for all *SENSOR_SWITCHs will be unset in
Flag to unset on the *SENSOR_SWITCHs
ReturnsNo return value |
ExampleTo unset the flag f on all the *SENSOR_SWITCHs in model m: SensorSwitch.UnflagAll(m, f);
|
No arguments
ReturnsSensorSwitch object. Return typeSensorSwitch |
ExampleTo check if SensorSwitch property ss.example is a parameter by using the SensorSwitch.GetParameter() method: if (ss.ViewParameters().GetParameter(ss.example) ) do_something...
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for *SENSOR_SWITCH. 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 *SENSOR_SWITCH ss: ss.Warning("My custom warning");
|
Xrefs()DescriptionReturns the cross references for this *SENSOR_SWITCH. |
No arguments
ReturnsXrefs object. Return typeXrefs |
ExampleTo get the cross references for *SENSOR_SWITCH ss: var xrefs = ss.Xrefs();
|
toString()DescriptionCreates a string containing the sensor switch data in keyword format. Note that this contains the keyword header and the keyword cards. See also SensorSwitch.Keyword() and SensorSwitch.KeywordCards(). |
No arguments
Returnsstring Return typeString |
ExampleTo get data for sensor switch ss in keyword format var str = ss.toString();
|