The Model class gives you access to models in T/HIS. More...
The T/HIS 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:
Detailed DescriptionThe Model class contains information on filenames and directories belonging to a model. See the documentation below for more details. |
Details of functionsClearFlag(flag[Flag], entity_type[integer], item[integer], end (optional)[integer])DescriptionClears a defined flag on an internal (or external) item(s) of type of entity_type in the model. |
The flag you want to clear.
The Entity type that the defined flag will be cleared on.
If +ive: The internal item number starting from 1. If -ive: The external item label.
To unflag range of items, specify an optional end of range. Unflags items from item to range.
ReturnsTRUE if the flag is successfully cleared on the item, otherwise FALSE Return typeBoolean |
Delete()DescriptionDeletes a model |
No arguments
ReturnsTRUE if the model sucessfully deleted, otherwise FALSE Return typeBoolean |
ExampleTo delete model m: var deleted = m.Delete();
|
Exists(model number[integer]) [static]DescriptionChecks if a model exists |
The number of the model you want to check the existence of.
ReturnsTRUE if the model exists, otherwise FALSE Return typeBoolean |
ExampleTo check if a model n exists var exists = Model.Exists(n);
|
FlagAll(flag[Flag], entity_type[integer])DescriptionSets a defined flag on all of items of type of entity_type in the model. |
The flag you want to set.
The Entity type that the defined flag will be set on.
ReturnsTRUE if the flag is successfully set on all the items, otherwise FALSE Return typeBoolean |
ExampleTo set the flag f on all the nodes in model m: m.FlagAll(f, Entity.NODE);
|
Flagged(flag[Flag], entity_type[integer], item[integer])DescriptionChecks if a defined flag is set on an internal (or external) item of type of entity_type in the model. |
The flag you want to check.
The Entity type to check.
If +ive: The internal item number starting from 1. If -ive: The external item label.
ReturnsTRUE if the flag is set, FALSE if the flag is not set. Return typeBoolean |
ExampleTo check if flag f is set on the 6th node in model m: m.Flagged(f, Entity.NODE, 6); To check if flag f is set on the Node 13456 in model m: m.Flagged(f, Entity.NODE, -13456);
|
GetDataFlagged(flag[Flag], data_comp[integer], int_pnt (optional)[object | integer], extra (optional)[integer])Description
Gets curve objects for a data component for relevant items that are flagged with a specified flag in the model. |
The flag to use. For model data, use 0 to define a null "padding" argument.
The Data Component to extract.
The integration points to extract.
This argument can be either an integer or an object.
This argument is ignored when the entity type is not SOLID, SHELL, THICK_SHELL or BEAM.
An integer specifies the integration point to extract:
For SOLIDs: value between 0 for Average/Centre and 8. (Defaults to Average/Centre).
For SHELLs and THICK_SHELLs: value between 1 and # integration points, or codes
Constant.TOP,
Constant.MIDDLE,
Constant.BOTTOM.
(Defaults to MIDDLE integration point).
For integrated BEAMs: value between 1 and # integration points. (Defaults to integration point 1).
Use 0 to define a null "padding" argument, then uses the default integration point.
Object has the following properties:
| Name | Type | Description |
| ip | integer | Through thickness integration point as described above. |
| np (optional) | integer | The nodes to extrapolate to. For SOLIDs, SHELLs and THICK_SHELLs: value between 1 and # nodes on the entity. (Defaults to none). |
| op (optional) | integer | On plan integration point. For SHELLs and THICK_SHELLs: value between 0 for Average/Centre and 4. (Defaults to Average/Centre). |
The extra component id for SOLIDs, SHELLs, THICK_SHELLs or BEAMs.
ReturnsArray of Curve objects. Return typeArray |
GetFromID(model number[integer]) [static]DescriptionReturns the Model object for a model ID or null if model does not exist. |
number of the model you want the Model object for
ReturnsModel object (or null if model does not exist). Return typeModel |
ExampleTo get the model n var model = Model.GetFromID(n);
|
GetInternalID(entity_type[integer], item[integer])DescriptionGets the internal ID of external item of type entity_type in the model. |
The Entity type of the item.
The external item number.
ReturnsInteger internal ID (starting from 1) with reference to the entity_type code. Returns integer internal ID of 0 if item cannot be found. Return typeNumber |
ExampleTo get the internal ID of Airbag 300 in model m: var x = m.GetInternalID(Entity.AIRBAG, 300);
|
GetLabel(entity_type[integer], item[integer])DescriptionGets the external label of internal item of type entity_type in the model. |
The Entity type of the item.
The internal item number starting from 1.
ReturnsInteger external ID (or 0 if there is an error, or the internal ID if there are no external IDs). Return typeNumber |
ExampleTo get the external ID of the 2nd airbag in model m: var x = m.GetLabel(Entity.AIRBAG, 2);
|
The Entity type of the item.
The name of the item. If only the first part of the name is given, it must be unambiguous.
ReturnsInteger external ID of the first matching name (or 0 if there is an error). Return typeNumber |
ExampleTo get the external label the of Contact named "Rear Bolt" in database history: var name = m.GetLabelFromName(Entity.CONTACT, "Rear Bolt");
|
GetModelUnits()DescriptionReturns the Model units of a particular model |
No arguments
ReturnsString indicating the model unit system of the model Return typeString |
ExampleTo get the model units of model m var units = m.GetModelUnits();
|
GetName(entity_type[integer], item[integer])DescriptionGets the database history name of an internal (or external) item of type entity_type in the model. |
The Entity type of the item.
If +ive: The internal item number starting from 1. If -ive: The external item label.
ReturnsString containing the database history name (or null if not available). Return typeString |
GetNumberFlagged(flag[Flag], entity_type (optional)[integer])DescriptionGets the number of entities flagged with a requested flag in the model. |
The flag you want to check.
If specified, the Entity type to look at. If not specified, all types are looked at.
ReturnsInteger number Return typeNumber |
ExampleTo get the number of airbag parts flagged with flag f in model m: var num = m.GetNumberFlagged(f, Entity.AIRBAG_PART_DATA);
|
GetNumberOf(entity_type[integer])DescriptionGets the number of entities of a requested type in the model. |
The Entity type that you want to know the number of.
ReturnsInteger number Return typeNumber |
ExampleTo get the number of airbags in model m: var num = m.GetNumberOf(Entity.AIRBAG);
|
HighestID() [static]DescriptionReturns the ID of the highest model currently being used |
No arguments
ReturnsID of highest model currently being used. Return typeNumber |
ExampleTo get the highest model ID var id= Model.HighestID();
|
QueryDataPresent(data_comp[integer], entity_type (optional)[integer], int_pnt (optional)[object | integer], extra (optional)[integer])DescriptionChecks if a data component data_comp for a given entity is present in a model's database. For SOLIDs, SHELLs, THICK_SHELLs and BEAMs the integration point and extra component ID can also be checked. This will show if curves for any flagged items of this type will be returned for GetDataFlagged(). Note, it does not check if the data component is valid, for example a specific shell may have fewer integration points than MAX_INT for all shells, so curves returned for GetDataFlagged() may still be "null" with no x-y data. |
The Data Component to check.
The Entity type to check. This argument can only be omitted when checking for global model data.
The integration points to check.
This argument can be either an integer or an object.
This argument is ignored if the entity type is not SOLID, SHELL, THICK_SHELL or BEAM.
An integer specifies the integration point to check:
For SOLIDs: value between 0 for Average/Centre and 8. (Defaults to Average/Centre).
For SHELLs and THICK_SHELLs: value between 1 and # integration points, or codes
Constant.TOP,
Constant.MIDDLE,
Constant.BOTTOM.
(Defaults to MIDDLE integration point).
For integrated BEAMs: value between 1 and # integration points. (Defaults to integration point 1).
Use 0 to define a null "padding" argument, then checks the default integration point.
Object has the following properties:
| Name | Type | Description |
| ip | integer | Through thickness integration point as described above. |
| np (optional) | integer | The nodes to extrapolate to. For SOLIDs, SHELLs and THICK_SHELLs: value between 1 and # nodes on the entity. (Defaults to none). |
| op (optional) | integer | On plan integration point. For SHELLs and THICK_SHELLs: value between 0 for Average/Centre and 4. (Defaults to Average/Centre). |
The extra component id for SOLIDs, SHELLs, THICK_SHELLs or BEAMs.
Returnstrue if data is present, otherwise false. Return typeBoolean |
Read(filename[string], filetype (optional)[integer]) [static]DescriptionReads in a new model. |
Filename you want to read.
Filetypes you want to read. Can be bitwise OR of Model.THF, Model.XTF, Model.LSDA, Model.ASCII, Model.ZTF and Model.ALL_FILES. If omitted all available files will be read.
ReturnsModel object (or null if error). Return typeModel |
SetFlag(flag[Flag], entity_type[integer], item[integer], end (optional)[integer])DescriptionSets a defined flag on an internal (or external) item(s) of type of entity_type in the model. |
The flag you want to set.
The Entity type that the defined flag will be set on.
If +ive: The internal item number starting from 1. If -ive: The external item label.
To flag range of items, specify an optional end of range. Flags items from item to range.
ReturnsTRUE if the flag is successfully set on the item, otherwise FALSE Return typeBoolean |
SetModelUnits(unit system[String])DescriptionSet the model units of a model to the units provided by the user |
The unit system you want to set the model units of model to
ReturnsTRUE if the Model units are set successfully else FALSE Return typeBoolean |
ExampleTo set the model units of model m to "U2" m.SetModelUnits("U2");
|
Total() [static]DescriptionReturns the total number of models. |
No arguments
Returnsinteger Return typeNumber |
ExampleTo find how many models there are in T/HIS: var num = Model.Total();
|
UnflagAll(flag[Flag], entity_type[integer])DescriptionUnsets a defined flag flag on all of items of type of entity_type in the model. |
The flag you want to unset.
The Entity type that the defined flag will be unset on.
ReturnsTRUE if the flag is successfully unset on all the items, otherwise FALSE Return typeBoolean |
ExampleTo unset the flag f on all the nodes in model m: m.UnflagAll(f, Entity.NODE);
|