The Include class allows you to access the include files in a model. 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 | Description |
| Include.COPY_INTO_CURRENT | Copied elements are put into the current layer. See also Options.copy_target_include |
| Include.COPY_INTO_SOURCE | Copied elements are put into the include of the original element. See also Options.copy_target_include |
| Include.MASTER_ONLY | Only write the master file. See also Model.Write() |
| Include.MERGE | Merge include files into the master file. See also Model.Write() |
| Include.NOT_WRITTEN | Prevent include files from being written. See also Model.Write() |
| Include.SAME_DIR | Write master and include files into the same directory. See also Model.Write() |
| Include.SELECT | Select include files to be written out. See also Model.Write() |
| Include.SUBDIR | Write include files to subdirectory. See also Model.Write() |
| Name | Description |
| Include.NATIVE | Use directory separators native to this machine when writing directory names. See also Model.Write() |
| Include.UNIX | Use unix directory separators when writing directory names. See also Model.Write() |
| Include.WINDOWS | Use windows directory separators when writing directory names. See also Model.Write() |
| Name | Description |
| Include.ABSOLUTE | Write include file with absolute pathname. See also Model.Write() |
| Include.RELATIVE | Write include file with relative pathname. See also Model.Write() |
| Name | Description |
| Include.ENDOFF | Offset applied to PRIMER post end keywords (Dummy, Mechanism etc.) |
| Include.IDDOFF | Offset to define ID (used in Include.SetTransformOffset() ) |
| Include.IDEOFF | Offset to element ID (used in Include.SetTransformOffset() ) |
| Include.IDFOFF | Offset to function and table ID (used in Include.SetTransformOffset() ) |
| Include.IDMOFF | Offset to material ID (used in Include.SetTransformOffset() ) |
| Include.IDNOFF | Offset to node ID (used in Include.SetTransformOffset() ) |
| Include.IDPOFF | Offset to part ID (used in Include.SetTransformOffset() ) |
| Include.IDROFF | Offset to other ID (used in Include.SetTransformOffset() ) |
| Include.IDSOFF | Offset to set ID (used in Include.SetTransformOffset() ) |
| Name | Type | Description |
| comments | string | Comments stored at the top of the include file. Note that this property is not supported for master include file. |
| fctchg | real | Electric charge transformation factor. Note that this property is not supported for master include file. |
| fctlen | real | Length transformation factor. Note that this property is not supported for master include file. |
| fctmas | real | Mass transformation factor. Note that this property is not supported for master include file. |
| fcttem | string | Temperature transformation factor. Note that this property is not supported for master include file. |
| fcttim | real | Time transformation factor. Note that this property is not supported for master include file. |
| file | string | The absolute filename for this include file.Note that this property is not supported for master include file. Also see the name and path properties. |
| genmax | integer | Include maximum label range value for general items |
| genmin | integer | Include minimum label range value for general items |
| iddoff (read only) | integer | Offset to define ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| ideoff (read only) | integer | Offset to element ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| idfoff (read only) | integer | Offset to function and table ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| idmoff (read only) | integer | Offset to material and equation of state ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| idnoff (read only) | integer | Offset to node ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| idpoff (read only) | integer | Offset to part, nodal rigid body and constrained node set ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| idroff (read only) | integer | Offset to other ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| idsoff (read only) | integer | Offset to set ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file. |
| incout | integer | Create file containing transformed data. Note that this property is not supported for master include file. |
| label (read only) | integer | Include number. This number is used to identify the include file. A number is required as it is possible (with include transforms) to have multiple include files with the same name so they cannot be identified by name. The master file is include file number 0. Also see the parent property. |
| model | integer | The Model number that the include is in. |
| n_locked_range | integer | Number of locked label ranges. Note that this does not include label ranges locked model-wide (ALL includes). |
| name | string | The filename for this include file excluding any path. Note that this property is not supported for master include file. Also see the file and path properties. |
| nelmax | integer | Include maximum label range value for nodes/elements/nrbc/const. spotwelds/define HWA items |
| nelmin | integer | Include minimum label range value for nodes/elements/nrbc/const. spotwelds/define HWA items |
| parent | integer | Include number for the parent include file of this include. This number is used to identify the parent include file. A number is required as it is possible (with include transforms) to have multiple include files with the same name so they cannot be identified by name. The master file is include file number 0. Also see the label property. Note that this property is not supported for master include file. |
| path | string | The path for this include file. Note that this property is not supported for master include file. Also see the file and name properties. |
| suppressed | logical | If keyout of Include file has been suppressed. Note that this property is not supported for master include file. |
| tranid | integer | Define transformation number. Note that this property is not supported for master include file. |
| transform | logical | true if this include file is an *INCLUDE_TRANSFORM, false otherwise. Note that this property is not supported for master include file. |
Detailed DescriptionThe Include class allows to create and query include files in a model. See the documentation below for more details. |
Constructornew Include(Model[Model], name[string], parent (optional)[integer])DescriptionCreate a new Include object. |
Model that include will be created in
Include filename
Parent include file number. If omitted parent will be 0 (main file).
ReturnsInclude object Return typeInclude |
ExampleTo create a new include file /path/to/include.key in model m var i = new Include(m, "/path/to/include.key");
|
Details of functionsBlankAll(Model[Model], redraw (optional)[boolean], masterInclude (optional)[boolean]) [static]DescriptionBlanks all of the includes in the model. |
Model that all includes will be blanked in
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().
If masterInclude file should be blanked or not. If omitted masterInclude is false. The master file is include file number 0.
ReturnsNo return value |
ExampleTo blank all of the includes in model m: Include.BlankAll(m);
|
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionBlanks all of the flagged include files in the model. |
Model that all the flagged includes will be blanked in
Flag set on the includes that you want to blank
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().
ReturnsNo return value |
ExampleTo blank all of the include files in model m flagged with f: Include.BlankFlagged(m, f);
|
ClearFlag(flag[Flag], clear contents (optional)[boolean])DescriptionClears a flag on the include. |
Flag to clear on the include
If true then the items in the include file will also have flag cleared. If false (default) then the include file contents are not cleared.
ReturnsNumber of item flags cleared Return typeNumber |
Error(message[string], details (optional)[string])DescriptionAdds an error for an include file. For more details on checking see the Check class. Note that this function is not supported for the master include file. |
The error message to give
An optional detailed error message
ReturnsNo return value |
ExampleTo add an error message "My custom error" for include i: i.Error("My custom error");
|
First(Model[Model]) [static]DescriptionReturns the first include file in the model. |
Model to get first include in
ReturnsInclude object (or null if there are no includes in the model). Return typeInclude |
ExampleTo get the first include in model m: var i = Include.First(m);
|
FlagAll(Model[Model], flag[Flag], masterInclude (optional)[boolean]) [static]DescriptionFlags all of the includes in the model with a defined flag. |
Model that all includes will be flagged in
Flag to set on the includes
If masterInclude file should be flagged or not. If omitted masterInclude is false. The master file is include file number 0.
ReturnsNo return value |
ExampleTo flag all of the includes with flag f in model m: Include.FlagAll(m, f);
|
Flagged(flag[Flag])DescriptionChecks if the include is flagged or not. |
Flag to test on the include
Returnstrue if flagged, false if not. Return typeBoolean |
ExampleTo check if include i has flag f set on it: if (i.Flagged(f) ) do_something...
|
GetAll(Model[Model], masterInclude (optional)[boolean]) [static]DescriptionReturns an array of Include objects for all of the includes in a model in PRIMER |
Model to get includes from
If masterInclude file should be included or not. If omitted masterInclude is false. The master file is include file number 0.
ReturnsArray of Include objects Return typeArray |
ExampleTo make an array of Include objects for all of the includes in model m var i = Include.GetAll(m);
|
GetDetailedRange(type argument[string])DescriptionGets detailed min and max label ranges for specified type from the include. |
Entity type for which ranges are returned
ReturnsAn array containing the min and max label ranges for the specified type or null if no range defined for this type. Return typeArray |
ExampleTo get node ranges for include i: var ranges = i.GetDetailedRange("NODE");
var min = ranges[0];
var max = ranges[1];
|
GetFromID(Model[Model], include number[integer]) [static]DescriptionReturns the Include object for an include label. |
Model to find the include in
number of the include you want the Include object for
ReturnsInclude object (or null if include does not exist). Return typeInclude |
ExampleTo get the Include object for include 10 in model m var i = Include.GetFromID(m, 10);
|
GetLockedLabelData(rangenum[integer])DescriptionReturns the locked label data for include files. Also see the n_locked_range property |
The range number you want the data for; includes can have multiple ranges. Note that range numbers start at 0, not 1.
ExampleTo get the locked label data for the 3rd range for include i: if (i.n_locked_range >= 3)
{
var locked_label_data = i.GetLockedLabelData(2);
}
|
IsEmpty()DescriptionReturns true if include is Empty (contains no INSTALLED static/sort/kid/include items). |
No arguments
Returnslogical Return typeBoolean |
ExampleTo see if include inc is empty if(inc.Empty())
|
Keyword()DescriptionReturns the keyword for this include (*INCLUDE, *INCLUDE_TRANSFORM). Note that a carriage return is not added. See also Include.KeywordCards(). This function is not supported for the master include file. |
No arguments
Returnsstring containing the keyword. Return typeString |
ExampleTo get the keyword for include i: var key = i.Keyword();
|
KeywordCards()DescriptionReturns the keyword cards for the include. Note that a carriage return is not added. See also Include.Keyword(). Also note that this function is not supported for the master include file. |
No arguments
Returnsstring containing the cards. Return typeString |
ExampleTo get the cards for include i: var cards = i.KeywordCards();
|
Last(Model[Model]) [static]DescriptionReturns the last include file in the model. |
Model to get last include in
ReturnsInclude object (or null if there are no includes in the model). Return typeInclude |
ExampleTo get the last include in model m: var i = Include.Last(m);
|
MakeCurrentLayer()DescriptionSets this include file to be the current layer so that any newly created items are put in this include file. Also see the Model.layer property. |
No arguments
ReturnsNo return value |
ExampleTo make include i the current layer: i.MakeCurrentLayer();
|
Modified(listing[boolean])DescriptionReturns true if include has been modified. |
false for no listing output, true for listing output
Returnslogical Return typeBoolean |
ExampleTo see if include inc is modified if(inc.Modified(false)) ... (no listing output)
|
Next()DescriptionReturns the next include in the model. Note that this function is not supported for the master include file. |
No arguments
ReturnsInclude object (or null if there are no more includes in the model). Return typeInclude |
ExampleTo get the include in model m after include i: var i = i.Next();
|
Pick(prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean], button text (optional)[string]) [static]DescriptionAllows the user to pick an include. |
Text to display as a prompt to the user
If the argument is a Model then only includes from that model can be picked. If the argument is a Flag then only includes that are flagged with limit can be selected. If omitted, or null, any includes from any model can be selected. from any model.
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.
By default the window with the prompt will have a button labelled 'Cancel' which if pressed will cancel the pick and return null. If you want to change the text on the button use this argument. If omitted 'Cancel' will be used.
ReturnsInclude object (or null if not picked) Return typeInclude |
ExampleTo pick an includee from model m giving the prompt 'Pick include from screen': var i = Include.Pick('Pick include from screen', m);
|
Previous()DescriptionReturns the previous include in the model. Note that this function is not supported for the master include file. |
No arguments
ReturnsInclude object (or null if there are no more includes in the model). Return typeInclude |
ExampleTo get the include in model m before include i: var i = i.Previous();
|
RemoveLockedLabelData(rangenum[integer])DescriptionRemoves the locked label data for a range in include files. Also see the n_locked_range property |
The locked label range you want to remove. Note that range numbers start at 0, not 1.
ReturnsNo return value. |
ExampleTo remove the locked labels for the 3rd range for include i: i.RemoveLockedLabelData(2);
|
Select(flag[Flag], prompt[string], Model (optional)[Model], modal (optional)[boolean]) [static]DescriptionAllows the user to select includes using standard PRIMER object menus. |
Flag to use when selecting includes
Text to display as a prompt to the user
Model to select from
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 items selected or null if menu cancelled Return typeNumber |
ExampleTo select an include from model m, flagging those selected with flag f, giving the prompt 'Select include': Include.Select(f, 'Select include', m);
|
SetDetailedRange(type argument[string], min label[integer], max label[integer])DescriptionSets detailed min and max label ranges for specified type on the include. |
Entity type for which ranges are to be defined
Defines the smallest label for entities of this type
Defines the largest label for entities of this type
ReturnsNo return value |
ExampleTo set node ranges for include i: i.SetDetailedRange("NODE", 50000, 60000);
|
SetFlag(flag[Flag], flag contents (optional)[boolean])DescriptionSets a flag on the include. |
Flag to set on the include
If true then the items in the include file will also be flagged. If false (default) then the include file contents are not flagged.
ReturnsNumber of items flagged Return typeNumber |
SetLockedLabelData(rangenum[integer], min[integer], max[integer], type[string], safe (optional)[boolean], all_includes (optional)[boolean])DescriptionSets the locked label data for a particular range for an include file. Also see the n_locked_range property |
The range you want to set the data for. Note that range numbers start at 0, not 1.
Start (min) label for a locked range.
End (max) label for a locked range.
Entity type code - "NODE", "SHELL" etc. Can also be "ALL" (for a list of types see Appendix I of the PRIMER manual).
Determines whether a locked range is safe (protected).
Specified range will be set model-wide (all includes). Only useful when working with the 'master' include.
ReturnsNo return value. |
ExampleTo set the locked label data for the 3rd range with min 99, max 199, for nodes for include i: i.SetLockedLabelData(3, 99, 199, "NODE");
|
The include transform offset type to change. Can be Include.IDNOFF, Include.IDEOFF, Include.IDPOFF, Include.IDMOFF, Include.IDSOFF, Include.IDFOFF, Include.IDDOFF or Include.IDROFF.
The value to change the offset to
Sometimes it may be necessary to check if changing an offset for an include will cause an error or label clash rather than actually changing it. If check only is true then PRIMER will just check to see if the new value for the offset will cause any label clashes or negative labels and not change the offset value or any item labels. If false or omitted then the offset and labels will be updated if there are no errors.
Returnslogical, true if change successful. false if the change would cause a clash of labels or negative labels, in which case the value is not changed. Return typeBoolean |
ExampleTo set idpoff for include i to 1000, checking that the change is successful: var success = i.SetTransformOffset(Include.IDPOFF, 1000);
|
Total(Model[Model]) [static]DescriptionReturns the total number of include files in the model. |
Model to get include total from
Returnsinteger Return typeNumber |
ExampleTo get the number of include files in model m: var t = Include.Total(m);
|
UnblankAll(Model[Model], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the includes in the model. |
Model that all includes will be unblanked in
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().
ReturnsNo return value |
ExampleTo unblank all of the includes in model m: Include.UnblankAll(m);
|
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean]) [static]DescriptionUnblanks all of the flagged include files in the model. |
Model that all the flagged includes will be unblanked in
Flag set on the includes that you want to unblank
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().
ReturnsNo return value |
ExampleTo unblank all of the include files in model m flagged with f: Include.UnblankFlagged(m, f);
|
UnflagAll(Model[Model], flag[Flag]) [static]DescriptionUnsets a defined flag on all of the includes in the model. |
Model that the defined flag for all includes will be unset in
Flag to unset on the includes
ReturnsNo return value |
ExampleTo unset the flag f on all of the includes in model m: Include.UnflagAll(m, f);
|
Warning(message[string], details (optional)[string])DescriptionAdds a warning for an include file. For more details on checking see the Check class. Note that this function is not supported for the master include file. |
The warning message to give
An optional detailed warning message
ReturnsNo return value |
ExampleTo add a warning message "My custom warning" for include i: i.Warning("My custom warning");
|
Write(filename[string], options (optional)[object])DescriptionWrites an include file. Note that this function is not supported for the master include file. |
Filename of the Ansys LS-DYNA keyword file you want to write
Options specifying how the file should be written out. If omitted the default values below will be used. The properties available are:
Object has the following properties:
| Name | Type | Description |
| binary (optional) | boolean | If true then the output file will be written out in binary. If false (default) then an ascii file will be written. |
| compress (optional) | boolean | If true then the output file will be compressed. If false (default) then an uncompressed file will be written. |
| compressLevel (optional) | integer | Compression level for .gz and .zip files. Must be in the range 1 to 9 with 1 being the least compression (fastest speed) to 9 being the greatest compression (slowest speed) |
| compressMode (optional) | integer | This option can be used to specify the mode of compression. Can be Include.KEEP_ORIGINAL or Include.INDIVIDUAL_GZIP or Include.INDIVIDUAL_ZIP |
| fileStartAscii (optional) | boolean | If true then the begining of the file (*CONTROL etc) file is written out in ascii. If false (default) then
the entire file is converted to binary. |
| i10 (optional) | boolean | If true then i10 format will be used to write the file. If false (default) then the normal Ansys LS-DYNA format will be used. |
| large (optional) | boolean | If true then large format will be used to write the file. If false (default) then the normal Ansys LS-DYNA format will be used. Note that large format is only available from version R7.1 and above. |
| path (optional) | integer | The method used to write include paths. Can be Include.ABSOLUTE (default) or Include.RELATIVE |
| separator (optional) | integer | The directory separator used when writing include files. Can be Include.NATIVE (default), Include.UNIX or Include.WINDOWS |
| version (optional) | string | The Ansys LS-DYNA version used to write the file. Can be "971R5", "971R4", "971R3", "970v6763" etc (see the version popup in Model->Write '>>> Ansys LS-DYNA output options' for a full list). See also Options.dyna_version |
ReturnsNo return value |
Filename of the Ansys LS-DYNA keyword file you want to write
The method used to write include paths. Can be Include.ABSOLUTE (default) or Include.RELATIVE
The directory separator used when writing include files. Can be Include.NATIVE (default), Include.UNIX or Include.WINDOWS
The Ansys LS-DYNA version used to write the file. Can be "971R5", "971R4", "971R3", "970v6763" etc. (see the version popup in Model->Write '>>> Ansys LS-DYNA output options' for a full list). See also Options.dyna_version
If true then large format will be used to write the file. If false (default) then the normal Ansys LS-DYNA format will be used. Note that large format is only available from version R7.1 and above.
ReturnsNo return value |
ExampleTo write include file i to file /data/test/file.key i.Write("/data/test/file.key");
|
toString()DescriptionCreates a string containing the include data in keyword format. Note that this contains the keyword header and the keyword cards. See also Include.Keyword() and Include.KeywordCards(). Also note that this function is not supported for the master include file. |
No arguments
Returnsstring Return typeString |
ExampleTo get data for include i in keyword format var s = i.toString();
|