Primer Js API 13
Primer Js API 13
UK
Arup Group Ltd
The Arup Campus
Blythe Gate
Blythe Valley Park
Solihull
West Midlands
B90 8AE
United Kingdom
Tel:
+44 (0) 121 213 3399
Fax:
+44 (0) 121 213 3302
Email: dyna.support@arup.com
Web: www.oasys-software.com/dyna
China
Arup
39/F-41/F
Huai Hai Plaza
Huai Hai Road (M)
Shanghai
China 200031
Tel:
+86 21 3118 8875
Fax:
+86 21 3118 8882
Email: china.support@arup.com
Web: www.oasys-software.com/dyna/cn
India
Arup
Plot 39, Ananth Info Park
Opp. Oracle Campus
HiTec City
Madhapur Phase II
Hyderabad 500081
India
Tel:
+91 40 4436 9797/98
Email: india.support@arup.com
Web: www.oasys-software.com/dyna
or contact your local Oasys Ltd distributor
LS-DYNA, LS-OPT and LS-PrePost are registered trademarks of Livermore Software Technology Corporation
global 1
Keywords 1
Keywords 1
Keywords 61
Keywords 153
Keywords 312
Keywords 337
Keywords 373
Keywords 374
Keywords 440
Keywords 581
Keywords 909
Keywords 924
Keywords 939
Keywords 1020
Keywords 1052
Keywords 1120
Keywords 1144
Keywords 1166
Keywords 1172
Keywords 1197
Keywords 1218
Keywords 1245
1
5
25
27
29
57
76
92
110
119
144
147
168
191
194
195
198
202
218
220
233
235
238
global class
Keywords
Airbag
Boundary
Constrained
Contact
Control
Damping
Database
Define
Element
Hourglass
Include
Initial
Integration
Load
Material
Node
Parameter
Part
Rigidwall
Section
Set
Attached class
Belt class
Check class
Colour class
Conx class
Dummy class
File class
GeometrySurface class
Graphics class
Group class
Image class
Mechanism class
Model class
Options class
PopupWindow class
Utils class
View class
Widget class
WidgetItem class
Window class
XMLParser class
Xrefs class
Zip class
March 2016
Page i
Page ii
March 2016
global class
global class
The global class is the main JavaScript class. More...
Class functions
AllocateFlag()
BatchMode()
DialogueInput(string_1, (string_2 ... string_n)[One or more Javascript strings])
DialogueInputNoEcho(string_1, (string_2 ... string_n)[One or more Javascript strings])
ErrorMessage(string[Any valid javascript type])
Exit()
GetCurrentDirectory()
GetPreferenceValue(program[string], name[string])
GetStartInDirectory()
Getenv(name[string])
Labels(type[string], state[boolean])
MacroFunction(name[function])
Message(string[Any valid javascript type])
MilliSleep(time[integer])
NumberToString(number[integer/float], width[integer])
PlayMacro(filename[string], pick (optional)[boolean], view (optional)[boolean], delay (optional)[integer],
variables (optional)[object], terminate (optional)[boolean])
Print(string[Any valid javascript type])
Println(string[Any valid javascript type])
Requires(build[integer])
ReturnFlag(flag[Flag])
RunScript(filename[string], separate (optional)[boolean])
SetPreferenceValue(program[string], name[string], value[string])
Sleep(time[integer])
System(string[Any valid javascript type])
Unix()
Use(filename[string])
UuidCreate()
Visibility(type[string], state[boolean])
WarningMessage(string[Any valid javascript type])
Windows()
Detailed Description
The global class declares the global object in JavaScript that contains the global properties and methods. As well as the
core JavaScript methods, PRIMER also defines other additional ones. e.g. Message(), Print() etc. See the documentation
below for more details.
Details of functions
AllocateFlag() [static]
Description
Allocate a flag for use in the script. See also ReturnFlag() and Model.PropagateFlag(). Once allocated the flag is
automatically cleared for all the models currently in PRIMER.
Arguments
No arguments
Return type
Flag
Example
To allocate a flag
var flag = AllocateFlag();
March 2016
global 1
global class
BatchMode() [static]
Description
Check if PRIMER is running in batch mode (i.e. menus are not active)
Arguments
No arguments
Return type
true if in batch mode, false if not
Example
To test if PRIMER is in batch mode
var batch_mode = BatchMode();
Arguments
Name
Type
Description
Return type
0: No errors/warnings.
> 0: This number of errors occurred.
< 0: Absolute number is the number of warnings that occurred.
Example
To read two models:
DialogueInput("/re dk model_1.key 1", "/re dk model_2.key 2");
Note that each call to DialogueInput starts afresh at the top of the PRIMER command line "tree", so where multiple
commands need to be given at sub-menu levels they need to be included in a single call. For example to restrain
degrees of a mechanism assembly, and then move it by some amount:
DialogueInput("/mech assy " + assy_number, "fix 123", "done", "point " + point_
name, delta_x + " * *", "accept");
NOT:
DialogueInput("/mech assy " + assy_number);
DialogueInput("fix 123");
etc
global 2
March 2016
global class
Arguments
Name
Type
Description
Return type
0: No errors/warnings.
> 0: This number of errors occurred.
< 0: Absolute number is the number of warnings that occurred.
Example
To read two models:
DialogueInputNoEcho("/re dk model_1.key 1", "/re dk model_2.key 2");
As with DialogueInput above each call starts at the top of the PRIMER command tree structure, so any commands
destined for sub-menus must all be arguments to a single call.
Arguments
Name Type
Description
string Any valid javascript type The string/item that you want to print
Return type
No return value
Example
To print the title of model object m as an error to the dialogue box
ErrorMessage("The title is " + m.title);
Exit() [static]
Description
Exit script
Arguments
No arguments
Return type
No return value
March 2016
global 3
global class
Example
Exit with
Exit();
GetCurrentDirectory() [static]
Description
Get the current working directory
Arguments
No arguments
Return type
String containing current working directory
Example
To get the current directory:
var cwd = GetCurrentDirectory();
Arguments
Name
Type Description
program string The program name string : Valid values are All, D3Plot, Primer, Reporter, Shell, T/His
name
Return type
: String containing preference value or null if preference string is not present in any oa_pref. Also if none of the above
environment variables are not present, then API simply returns null. While returning preference value, locked
preference value in admin and then install oa_pref takes precedence over home oa_pref. If preference is not locked in
any of these oa_pref, preference in home directory oa_pref is returned.
Example
To get the preference value:
var pref_list = GetPreferenceValue(All, "font_size");
GetStartInDirectory() [static]
Description
Get the directory passed to Primer by the -start_in command line argument
Arguments
No arguments
global 4
March 2016
global class
Return type
String containing start_in directory or NULL if not set
Example
To get the start_in directory:
var start_in = GetStartInDirectory();
Getenv(name[string]) [static]
Description
Get the value of an environment variable
Arguments
Name Type Description
name string The environment variable name
Return type
String containing variable value or null if variable does not exist
Example
To get the value for environment variable HOME
var home = Getenv("HOME");
Arguments
Name Type
Description
type
string
The type of the item (for a list of types see Appendix I of the PRIMER manual). Additionally, to
change the visibility of attached or unattached nodes you can use the types "ATTACHED_NODE"
and "UNATTACHED_NODE".
state
Return type
No return value
Example
To turn on beam labels
Labels("BEAM", true);
March 2016
global 5
global class
MacroFunction(name[function]) [static]
Description
Set the function for macro callback. This function can be used to make PRIMER return the macro command that would
be recorded if macro recording was active for every button press etc. This may be useful for you to know if a particular
action has been done by the user.
The function will be called with 1 argument which is a string containing the macro command. To remove the macro
function use MacroFunction(null).
Arguments
Name Type
Description
name function The name of the function (or null to remove a function)
Return type
No return value
Example
To set function MyMacroFunction as the macro function:
MacroFunction(MyMacroFunction);
Arguments
Name Type
Description
The string/item that you want to print. If \r is added to the end of the string then instead of
automatically adding a carriage return in the dialogue box, the next message will overwrite the
current one. This may be useful for giving feedback to the dialogue box when doing an
operation.
Return type
No return value
Example
To print the title of model object m as a message to the dialogue box
Message("The title is " + m.title);
MilliSleep(time[integer]) [static]
Description
Pause execution of the script for time milliseconds. See also Sleep()
Arguments
Name Type
time
global 6
Description
March 2016
global class
Return type
No return value
Example
To pause for 500 milliseconds
MilliSleep(500);
Arguments
Name
Type
Description
integer
The width of the string you want to format it to (must be less than 80).
Return type
String containing the number
Example
To write the number 1.2345e+6 to a string 10 characters wide
var str = NumberToString(1.2345e+6, 10);
Arguments
Name
Type
Description
filename
string
pick (optional)
boolean If picks/drags from the macro file should be replayed. If omitted the current value from
macro window will be used.
view (optional)
boolean If views encoded in the macro file for picks/drags should be replayed. If omitted the
current value from macro window will be used.
delay (optional) integer Delay in ms between commands when replaying. If omitted the current value from macro
window will be used.
variables
(optional)
object
Object containing names and values for variables in the macro. If null or omitted no
variables are used.
terminate
(optional)
boolean If the script should be terminated if an error occurs when playing the macro. If omitted the
script will be terminated.
Return type
true if an error occured during playback, false otherwise.
March 2016
global 7
global class
Example
To play macro file /data/test/example.prm using the default options for picking/dragging and the default delay
PlayMacro("/data/test/example.prm");
To play macro file /data/test/example.prm, defining values for variables A, B and C in the macro
var variables = new Object();
variables.A = 10.0;
variables.B = 0;
variables.C = "Example";
PlayMacro("/data/test/example.prm", true, true, 0, variables);
Arguments
Name Type
Description
string Any valid javascript type The string/item that you want to print
Return type
No return value
Example
To print string "Hello, world!"
Print("Hello, world!");
To print the title of model object m with a carriage return
print("The title is " + m.title + "\n");
Arguments
Name Type
Description
string Any valid javascript type The string/item that you want to print
Return type
No return value
Example
To print string "Hello, world!" automatically adding a carriage return
Println("Hello, world!");
To print the title of model object m, automatically adding a carriage return
Println("The title is " + m.title);
global 8
March 2016
global class
Requires(build[integer]) [static]
Description
Checks to see if the build number of PRIMER is high enough to run this script. If your script requires features that are
only present in builds of PRIMER greater than a certain value Require can test this and only run the script if the build is
high enough.
Arguments
Name Type
build
Description
Return type
No return value (if the build is not high enough the script will terminate)
Example
To only allow a script to run if the build is >= 2000
Requires(2000);
ReturnFlag(flag[Flag]) [static]
Description
Return a flag used in the script. See also AllocateFlag() and Model.PropagateFlag().
Arguments
Name Type Description
flag
Return type
No return value.
Example
To return flag f:
ReturnFlag(f);
March 2016
global 9
global class
Arguments
Name
Type
Description
filename
string
The name of the script file to run. If the filename is relative then the file will be searched for
relative to this script. If not found then the script_directory preference will be used.
separate
(optional)
boolean If the script will use separate memory from the current script. If it uses separate memory (true)
then the child script is completely separated from this script and knows nothing about variables
in this script. If it does not use separate memory (false) then the child script will have access to
all of the variables in the current script and hence variables must not clash. It is strongly
recommended that you use namespaces to stop variable names from clashing. If omitted the
script will use separate memory.
Return type
No return value
Example
To run script /data/test/child.js using separate memory for the child script
RunScript("/data/test/child.js");
Arguments
Name
Type Description
program string The program name string : Valid values are All, D3Plot, Primer, Reporter, Shell, T/His
name
value
string The preference value string. If "value" is of zero length, then the option is simply removed from the
file if present, and no new entry is made.This argument cannot be null.
Return type
Returns 0 if the preference is saved succesfully or 1 if unsuccessful
Example
To save the preference value:
var ierr = SetPreferenceValue( All, "font_size", Default);
Sleep(time[integer]) [static]
Description
Pause execution of the script for time seconds. See also MilliSleep()
Arguments
Name Type
time
Description
global 10
March 2016
global class
Return type
No return value
Example
To pause for 2 seconds
Sleep(2);
Arguments
Name Type
Description
string Any valid javascript type The system command that you want to do
Return type
integer (probably zero if command successful but is implementation-dependant)
Example
To make the directory "example"
System("mkdir example");
Unix() [static]
Description
Test whether script is running on a Unix/Linux operating system. See also Windows()
Arguments
No arguments
Return type
true if Unix/Linux, false if not
Example
To test if the OS is Unix
if ( Unix() )
Use(filename[string]) [static]
Description
Use script from a separate file
March 2016
global 11
global class
Arguments
Name
Type Description
filename string Use allows you to include a script from a separate file. This may be useful if your script is very large
and you want to split it up to help with maintenance. Alternatively you may have a library of
common functions which you always want to include in your scripts. Including the library with Use
means that any changes only have to be done in one place. Primer will look for the file in the same
directory as the main script. If that fails then it will look in $OA_INSTALL/primer_library/scripts
directory and the script directory specified by the primer*script_directory preference.
Note that the file is included when the script is compiled, NOT at runtime.
Return type
No return value
Example
To include script from file library.js
Use("library.js");
UuidCreate() [static]
Description
Create a UUID (Universally unique ID)
Arguments
No arguments
Return type
string
Example
To create a UUID:
var uuid = UuidCreate();
Arguments
Name Type
Description
type
string
The type of the item (for a list of types see Appendix I of the PRIMER manual). Additionally, to
change the visibility of attached or unattached nodes you can use the types "ATTACHED_NODE"
and "UNATTACHED_NODE".
state
Return type
No return value
global 12
March 2016
global class
Example
To make beams visible
Visibility("BEAM", true);
Arguments
Name Type
Description
string Any valid javascript type The string/item that you want to print
Return type
No return value
Example
To print the title of model object m as a warning to the dialogue box
WarningMessage("The title is " + m.title);
Windows() [static]
Description
Test whether script is running on a Windows operating system. See also Unix()
Arguments
No arguments
Return type
true if Windows, false if not
Example
To test if the OS is Windows
if ( Windows() )
March 2016
global 13
global class
global 14
March 2016
Airbag
Airbag class
Airbag class
The Airbag class gives you access to airbag cards in PRIMER. More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[airbag property])
GetPropertyByIndex(index[integer])
GetPropertyByName(acronym[string])
GetPropertyByRowCol(row[integer], col[integer])
GetPropertyNameForIndex(index[integer])
GetPropertyNameForRowCol(row[integer], col[integer])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
SetPropertyByIndex(index[integer], value[integer/float for numeric properties, string for character properties])
SetPropertyByName(acronym[string], value[integer/float for numeric properties, string for character
properties])
SetPropertyByRowCol(row[integer], col[integer], value[integer/float for numeric properties, string for
character properties])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Airbag constants
Name
Description
Airbag.ADIABATIC_GAS_MODEL
Airbag.ADVANCED_ALE
Airbag.ALE
Keywords 1
Airbag class
Airbag
Airbag.HYBRID
Airbag.HYBRID_CHEMKIN
Airbag.HYBRID_JETTING
Airbag.LINEAR_FLUID
Airbag.LOAD_CURVE
Airbag.PARTICLE
Airbag.SIMPLE_AIRBAG_MODEL
Airbag.SIMPLE_PRESSURE_VOLUME
Airbag.WANG_NEFSKE
Airbag.WANG_NEFSKE_JETTING
Airbag properties
Name
Type
Description
abid
integer
Airbag number. Also see the label property which is an alternative name for this.
cols
float
exists
logical
true if airbag exists, false if referred to but not defined. (read only)
id
logical
include
integer
label
integer
Airbag number. Also see the abid property which is an alternative name for this.
model
integer
properties integer
rows
integer
The number of rows of data the airbag has (read only). This includes the _ID card if it is set.
title
string
Airbag title
type
Detailed Description
The Airbag class allows you to create, modify, edit and manipulate airbag cards. See the documentation below for more
details.
Constructor
new Airbag(Model[Model], type[string], sid[integer], sidtyp (optional)[integer],
abid (optional)[integer], heading (optional)[string])
Description
Create a new Airbag object.
Keywords 2
March 2016
Airbag
Airbag class
Arguments
Name
Type
Description
Model
type
string
sid
integer Set ID
sidtyp
(optional)
abid
(optional)
heading
(optional)
string
Airbag title
Return type
Airbag object
Example
To create a new AIRBAG_SIMPLE_PRESSURE_VOLUME in model m with set ID 10 and segment set type
var a = new Airbag(m, Airbag.SIMPLE_PRESSURE_VOLUME, 10);
or
var a = new Airbag(m, Airbag.SIMPLE_PRESSURE_VOLUME, 10, 0);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse airbag a:
a.Browse();
March 2016
Keywords 3
Airbag class
Airbag
ClearFlag(flag[Flag])
Description
Clears a flag on the airbag.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for airbag a:
a.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the airbag.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy airbag a into airbag z:
var z = a.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Airbag object (or null if not made)
Keywords 4
March 2016
Airbag
Airbag class
Example
To start creating an airbag in model m:
var a = Airbag.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit airbag a:
a.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for airbag a:
a.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first airbag in the model.
March 2016
Keywords 5
Airbag class
Airbag
Arguments
Name Type
Description
Return type
Airbag object (or null if there are no airbags in the model).
Example
To get the first airbag in model m:
var a = Airbag.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Airbag label.
Example
To get the first free airbag label in model m:
var label = Airbag.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 6
March 2016
Airbag
Airbag class
Example
To flag all of the airbags with flag f in model m:
Airbag.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the airbag is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if airbag a has flag f set on it:
if (a.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 7
Airbag class
Airbag
Example
To call function test for all of the airbags in model m:
Airbag.ForEach(m, test);
function test(a)
{
// a is Airbag object
}
To call function test for all of the airbags in model m with optional object:
var data = { x:0, y:0 };
Airbag.ForEach(m, test, data);
function test(a, extra)
{
// a is Airbag object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Airbag objects for all of the airbags in a model in Primer
Arguments
Name Type
Description
Return type
Array of Airbag objects
Example
To make an array of Airbag objects for all of the airbags in model m
var a = Airbag.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Airbag objects
Example
To make an array of Airbag objects for all of the airbags in model m flagged with f
var a = Airbag.GetFlagged(m, f);
Keywords 8
March 2016
Airbag
Airbag class
Arguments
Name
Type
Description
Model
number integer number of the airbag you want the Airbag object for
Return type
Airbag object (or null if airbag does not exist).
Example
To get the Airbag object for airbag 100 in model m
var a = Airbag.GetFromID(m, 100);
GetParameter(prop[airbag property])
Description
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 the Airbag.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Airbag property a.example is a parameter:
Options.property_parameter_names = true;
if (a.GetParameter(a.example) ) do_something...
Options.property_parameter_names = false;
To check if Airbag property a.example is a parameter by using the GetParameter method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
GetPropertyByIndex(index[integer])
Description
Returns the value of property at index index for this Airbag object or null if no property exists.
March 2016
Keywords 9
Airbag class
Airbag
Arguments
Name Type
Description
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.
Return type
Property value (float/integer)
Example
To return the property at index 3, for airbag a:
var prop = a.GetPropertyByIndex(3);
GetPropertyByName(acronym[string])
Description
Returns the value of property string acronym for this Airbag object or null if no property exists.
Arguments
Name
Type Description
Return type
Property value (float/integer)
Example
To return the value of HCONV for airbag a:
var hconv = a.GetPropertyByName("HCONV");
GetPropertyByRowCol(row[integer], col[integer])
Description
Returns 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.
Arguments
Name Type
Description
row
col
Return type
Property value (float/integer)
Example
To return the value of the property at row 0, column 3 for airbag a:
var prop = a.GetPropertyByRowCol(0, 3);
Keywords 10
March 2016
Airbag
Airbag class
GetPropertyNameForIndex(index[integer])
Description
Returns the name of the property at index index for this Airbag object or null if there is no property.
Arguments
Name Type
Description
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.
Return type
Property name (string)
Example
To return the name of the property at index 3, for airbag a:
var name = a.GetPropertyNameForIndex(3);
GetPropertyNameForRowCol(row[integer], col[integer])
Description
Returns 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.
Arguments
Name Type
Description
row
col
Return type
Property name (string)
Example
To return the name of the property at row 0, column 1 for airbag a:
var name = a.GetPropertyNameForRowCol(0, 1);
Keyword()
Description
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()
Arguments
No arguments
Return type
string containing the keyword.
March 2016
Keywords 11
Airbag class
Airbag
Example
To get the keyword for airbag a:
var key = a.Keyword();
KeywordCards()
Description
Returns the keyword cards for the airbag. Note that a carriage return is not added. See also Airbag.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for airbag a:
var cards = a.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last airbag in the model.
Arguments
Name Type
Description
Return type
Airbag object (or null if there are no airbags in the model).
Example
To get the last airbag in model m:
var a = Airbag.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Keywords 12
March 2016
Airbag
Airbag class
Return type
Airbag label.
Example
To get the last free airbag label in model m:
var label = Airbag.LastFreeLabel(m);
Next()
Description
Returns the next airbag in the model.
Arguments
No arguments
Return type
Airbag object (or null if there are no more airbags in the model).
Example
To get the airbag in model m after airbag a:
var a = a.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Airbag label.
Example
To get the next free airbag label in model m:
var label = Airbag.NextFreeLabel(m);
Previous()
Description
Returns the previous airbag in the model.
March 2016
Keywords 13
Airbag class
Airbag
Arguments
No arguments
Return type
Airbag object (or null if there are no more airbags in the model).
Example
To get the airbag in model m before airbag a:
var a = a.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the airbags in model m, from 1000000:
Airbag.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged airbags will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the airbags in model m flagged with f, from 1000000:
Airbag.RenumberFlagged(m, f, 1000000);
Keywords 14
March 2016
Airbag
Airbag class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only airbags from that model can be selected. If the argument
Flag
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.
modal
(optional)
boolean
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.
Return type
Number of airbags selected or null if menu cancelled
Example
To select airbags from model m, flagging those selected with flag f, giving the prompt Select airbags:
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:
Airbag.Select(f, Select airbags, l);
SetFlag(flag[Flag])
Description
Sets a flag on the airbag.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for airbag a:
a.SetFlag(f);
March 2016
Keywords 15
Airbag class
Airbag
Arguments
Name Type
Description
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
indices.
Return type
No return value
Example
To set the property at index 3, for airbag a to be 1.234:
a.SetPropertyByIndex(3, 1.234);
Arguments
Name
Type
Description
acronym string
value
integer/float for numeric properties, string for character properties The value of the property to set.
Return type
No return value
Example
To set the value of HCONV for airbag a to be 1.23:
a.SetPropertyByName("HCONV", 1.23);
Keywords 16
March 2016
Airbag
Airbag class
Arguments
Name Type
Description
row
integer
col
integer
value integer/float for numeric properties, string for character properties The value of the property to set.
Return type
No return value
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);
Sketch(redraw (optional)[boolean])
Description
Sketches the airbag. The airbag will be sketched until you either call Airbag.Unsketch(), Airbag.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean 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().
Return type
No return value
Example
To sketch airbag a:
a.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing airbags should be counted. If false or omitted referenced but undefined
airbags will also be included in the total.
Return type
number of airbags
March 2016
Keywords 17
Airbag class
Airbag
Example
To get the total number of airbags in model m:
var total = Airbag.Total(m);
Unblank()
Description
Unblanks the airbag
Arguments
No arguments
Return type
No return value
Example
To unblank airbag a:
a.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the airbags in model m:
Airbag.UnblankAll(m);
Keywords 18
March 2016
Airbag
Airbag class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the airbags in model m flagged with f:
Airbag.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all airbags will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the airbags in model m:
Airbag.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the airbag.
Arguments
Name
Type
Description
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
Keywords 19
Airbag class
Airbag
Example
To unsketch airbag a:
a.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unsketch all airbags in model m:
Airbag.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Airbag object.
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...
Keywords 20
March 2016
Airbag
Airbag class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for airbag a:
a.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this airbag.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for airbag a:
var xrefs = a.Xrefs();
toString()
Description
Creates 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().
Arguments
No arguments
Return type
string
Example
To get data for airbag a in keyword format
var s = a.toString();
March 2016
Keywords 21
ReferenceGeometry class
Airbag
ReferenceGeometry class
The ReferenceGeometry class gives you access to define airbag reference geometry cards in PRIMER. More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetNode(nid[integer])
GetParameter(prop[airbag reference geometry property])
Keyword()
KeywordCards()
Next()
Previous()
RemoveNode(nid[integer])
SetFlag(flag[Flag])
SetNode(nid[integer], x[real], y[real], z[real])
Sketch(redraw (optional)[boolean])
Spool()
StartSpool()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
ReferenceGeometry properties
Name
Type
aid
integer ReferenceGeometry number. Also see the label property which is an alternative name for this.
birth
birth_time float
Description
Birth time
exists
logical true if airbag reference geometry exists, false if referred to but not defined. (read only)
id
Keywords 22
March 2016
Airbag
ReferenceGeometry class
include
integer The Include file number that the airbag reference geometry is in.
label
integer ReferenceGeometry number. Also see the label property which is an alternative name for this.
model
integer The Model number that the airbag reference geometry is in.
nido
rdt
sx
float
sy
float
sz
float
Detailed Description
The ReferenceGeometry class allows you to create, modify, edit and manipulate airbag reference geometry cards. See
the documentation below for more details.
Constructor
new ReferenceGeometry(Model[Model], aid (optional)[integer])
Description
Create a new ReferenceGeometry object.
Arguments
Name
Type
Description
Model
Return type
ReferenceGeometry object
Example
To create a new ReferenceGeometry in model m
var a = new ReferenceGeometry(m);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
March 2016
Keywords 23
ReferenceGeometry class
Airbag
Example
To Browse airbag reference geometry a:
a.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the airbag reference geometry.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for airbag reference geometry a:
a.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the airbag reference geometry.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy airbag reference geometry a into airbag reference geometry z:
var z = a.Copy();
Keywords 24
March 2016
Airbag
ReferenceGeometry class
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
ReferenceGeometry object (or null if not made)
Example
To start creating an ardt in model m:
var m = ReferenceGeometry.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit airbag reference geometry a:
a.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for airbag reference geometry a:
a.Error("My custom error");
March 2016
Keywords 25
ReferenceGeometry class
Airbag
First(Model[Model]) [static]
Description
Returns the first airbag reference geometry in the model.
Arguments
Name Type
Description
Return type
ReferenceGeometry object (or null if there are no airbag reference geometrys in the model).
Example
To get the first airbag reference geometry in model m:
var a = ReferenceGeometry.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ReferenceGeometry label.
Example
To get the first free airbag reference geometry label in model m:
var label = ReferenceGeometry.FirstFreeLabel(m);
Arguments
Name Type
Description
Model Model Model that all airbag reference geometrys will be flagged in
flag
Flag
Keywords 26
March 2016
Airbag
ReferenceGeometry class
Return type
No return value
Example
To flag all of the airbag reference geometrys with flag f in model m:
ReferenceGeometry.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the airbag reference geometry is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if airbag reference geometry a has flag f set on it:
if (a.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 27
ReferenceGeometry class
Airbag
Example
To call function test for all of the airbag reference geometrys in model m:
ReferenceGeometry.ForEach(m, test);
function test(a)
{
// a is ReferenceGeometry object
}
To call function test for all of the airbag reference geometrys in model m with optional object:
var data = { x:0, y:0 };
ReferenceGeometry.ForEach(m, test, data);
function test(a, extra)
{
// a is ReferenceGeometry object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of ReferenceGeometry objects for all of the airbag reference geometrys in a model in Primer
Arguments
Name Type
Description
Return type
Array of ReferenceGeometry objects
Example
To make an array of ReferenceGeometry objects for all of the airbag reference geometrys in model m
var a = ReferenceGeometry.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the airbag reference geometrys that you want to retrieve
Return type
Array of ReferenceGeometry objects
Example
To make an array of ReferenceGeometry objects for all of the airbag reference geometrys in model m flagged with f
var a = ReferenceGeometry.GetFlagged(m, f);
Keywords 28
March 2016
Airbag
ReferenceGeometry class
Arguments
Name
Type
Description
Model
number integer number of the airbag reference geometry you want the ReferenceGeometry object for
Return type
ReferenceGeometry object (or null if airbag reference geometry does not exist).
Example
To get the ReferenceGeometry object for airbag reference geometry 100 in model m
var a = ReferenceGeometry.GetFromID(m, 100);
GetNode(nid[integer])
Description
Returns the reference geometry coordinates for the node
Arguments
Name Type
nid
Description
integer Node ID
Return type
An array containing the three reference coordinates (or null if the node is not on the reference geometry)
Example
To get the reference coordinates of node number nid on reference geometry a
var coords = a.GetNode(nid);
Arguments
Name Type
prop
Description
airbag reference geometry property airbag reference geometry property to get parameter for
March 2016
Keywords 29
ReferenceGeometry class
Airbag
Return type
Parameter object if property is a parameter, null if not.
Example
To check if ReferenceGeometry property a.example is a parameter:
Options.property_parameter_names = true;
if (a.GetParameter(a.example) ) do_something...
Options.property_parameter_names = false;
To check if ReferenceGeometry property a.example is a parameter by using the GetParameter method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
Keyword()
Description
Returns the keyword for this reference_geometry (*AIRBAG_REFERENCE_GEOMETRY). Note that a carriage
return is not added. See also ReferenceGeometry.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for reference_geometry m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the reference_geometry. Note that a carriage return is not added. See also
ReferenceGeometry.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for airbag reference geometry a:
var cards = b.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last airbag reference geometry in the model.
Keywords 30
March 2016
Airbag
ReferenceGeometry class
Arguments
Name Type
Description
Return type
ReferenceGeometry object (or null if there are no airbag reference geometrys in the model).
Example
To get the last airbag reference geometry in model m:
var a = ReferenceGeometry.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
ReferenceGeometry label.
Example
To get the last free airbag reference geometry label in model m:
var label = ReferenceGeometry.LastFreeLabel(m);
Next()
Description
Returns the next airbag reference geometry in the model.
Arguments
No arguments
Return type
ReferenceGeometry object (or null if there are no more airbag reference geometrys in the model).
Example
To get the airbag reference geometry in model m after airbag reference geometry a:
var a = a.Next();
March 2016
Keywords 31
ReferenceGeometry class
Airbag
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ReferenceGeometry label.
Example
To get the next free airbag reference geometry label in model m:
var label = ReferenceGeometry.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the ReferenceGeometry can be picked from any
model.
modal
(optional)
boolean 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.
Return type
ReferenceGeometry object (or null if not picked)
Example
To pick a ReferenceGeometry from model m giving the prompt Pick ReferenceGeometry from screen:
var rdt = ReferenceGeometry.Pick(Pick ReferenceGeometry from screen, m);
Previous()
Description
Returns the previous airbag reference geometry in the model.
Arguments
No arguments
Keywords 32
March 2016
Airbag
ReferenceGeometry class
Return type
ReferenceGeometry object (or null if there are no more airbag reference geometrys in the model).
Example
To get the airbag reference geometry in model m before airbag reference geometry a:
var a = a.Previous();
RemoveNode(nid[integer])
Description
Removes a node from the reference geometry if it is on it
Arguments
Name Type
nid
Description
integer Node ID
Return type
No return value.
Example
To remove node 11 from reference geometry a:
a.RemoveNode(11);
Arguments
Name Type
Description
Model Model Model that all airbag reference geometrys will be renumbered in
start
Return type
No return value
Example
To renumber all of the airbag reference geometrys in model m, from 1000000:
ReferenceGeometry.RenumberAll(m, 1000000);
March 2016
Keywords 33
ReferenceGeometry class
Airbag
Arguments
Name Type
Description
Model Model Model that all the flagged airbag reference geometrys will be renumbered in
flag
Flag
Flag set on the airbag reference geometrys that you want to renumber
start
Return type
No return value
Example
To renumber all of the airbag reference geometrys in model m flagged with f, from 1000000:
ReferenceGeometry.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only airbag reference geometrys from that model can be
Flag
selected. If the argument is a Flag then only airbag reference geometrys that are flagged with
limit can be selected (limit should be different to flag). If omitted, or null, any airbag reference
geometrys can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of airbag reference geometrys selected or null if menu cancelled
Example
To select airbag reference geometrys from model m, flagging those selected with flag f, giving the prompt Select airbag
reference geometrys:
ReferenceGeometry.Select(f, Select airbag reference geometrys, m);
To select airbag reference geometrys, flagging those selected with flag f but limiting selection to airbag reference
geometrys flagged with flag l, giving the prompt Select airbag reference geometrys:
ReferenceGeometry.Select(f, Select airbag reference geometrys, l);
SetFlag(flag[Flag])
Description
Sets a flag on the airbag reference geometry.
Keywords 34
March 2016
Airbag
ReferenceGeometry class
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for airbag reference geometry a:
a.SetFlag(f);
Arguments
Name Type
Description
nid
integer Node ID
real
X reference coordinate
real
Y reference coordinate
real
Z reference coordinate
Return type
No return value.
Example
To add node 11 to reference geometry a with coordinates 12.0, 13.0, 14.0
a.SetNode(11, 12.0, 13.0, 14.0);
Sketch(redraw (optional)[boolean])
Description
Sketches the airbag reference geometry. The airbag reference geometry will be sketched until you either call
ReferenceGeometry.Unsketch(), ReferenceGeometry.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the airbag reference geometry is sketched. If omitted
redraw is true. If you want to sketch several airbag reference geometrys and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
March 2016
Keywords 35
ReferenceGeometry class
Airbag
Example
To sketch airbag reference geometry a:
a.Sketch();
Spool()
Description
Spools a reference geometry, entry by entry. See also ReferenceGeometry.StartSpool
Arguments
No arguments
Return type
Returns an array containing the node ID and the three coordinates. Returns 0 if no more items
Example
To spool reference geometry a:
var array;
a.StartSpool();
while (array = a.Spool() )
{
do something...
}
StartSpool()
Description
Starts a reference geometry spooling operation. See also ReferenceGeometry.Spool
Arguments
No arguments
Return type
No return value
Example
To start spooling reference geometry a:
a.StartSpool();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing airbag reference geometrys should be counted. If false or omitted
referenced but undefined airbag reference geometrys will also be included in the total.
Keywords 36
March 2016
Airbag
ReferenceGeometry class
Return type
number of airbag reference geometrys
Example
To get the total number of airbag reference geometrys in model m:
var total = ReferenceGeometry.Total(m);
Unblank()
Description
Unblanks the airbag reference geometry
Arguments
No arguments
Return type
No return value
Example
To unblank airbag reference geometry a:
a.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the airbag reference geometrys in model m:
ReferenceGeometry.UnblankAll(m);
March 2016
Keywords 37
ReferenceGeometry class
Airbag
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the airbag reference geometrys that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the airbag reference geometrys in model m flagged with f:
ReferenceGeometry.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all airbag reference geometrys will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the airbag reference geometrys in model m:
ReferenceGeometry.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the airbag reference geometry.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the airbag reference geometry is unsketched. If omitted
redraw is true. If you want to unsketch several airbag reference geometrys and only redraw
after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Keywords 38
March 2016
Airbag
ReferenceGeometry class
Example
To unsketch airbag reference geometry a:
a.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the airbag reference geometrys 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().
Return type
No return value
Example
To unsketch all airbag reference geometrys in model m:
ReferenceGeometry.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
ReferenceGeometry object.
Example
To check if ReferenceGeometry property a.example is a parameter by using the ReferenceGeometry.GetParameter()
method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
March 2016
Keywords 39
ReferenceGeometry class
Airbag
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for airbag reference geometry a:
a.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this airbag reference geometry.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for airbag reference geometry a:
var xrefs = a.Xrefs();
toString()
Description
Creates a string containing the ReferenceGeometry data in keyword format. Note that this contains the keyword header
and the keyword cards. See also ReferenceGeometry.Keyword() and ReferenceGeometry.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for ReferenceGeometry rdt in keyword format
var s = rdt.toString();
Keywords 40
March 2016
Airbag
ShellReferenceGeometry class
ShellReferenceGeometry class
The ShellReferenceGeometry class gives you access to define airbag shell reference geometry cards in PRIMER.
More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[airbag shell reference geometry property])
GetShell(eid[integer])
Keyword()
KeywordCards()
Next()
Previous()
RemoveShell(eid[integer])
SetFlag(flag[Flag])
SetShell(eid[integer], n1[integer], n2[integer], n3[integer], n4[integer])
Sketch(redraw (optional)[boolean])
Spool()
StartSpool()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
ShellReferenceGeometry properties
Name
Type
Description
aid
integer ShellReferenceGeometry number. Also see the label property which is an alternative name for this.
exists
logical true if airbag shell reference geometry exists, false if referred to but not defined. (read only)
id
include integer The Include file number that the airbag shell reference geometry is in.
label
integer ShellReferenceGeometry number. Also see the label property which is an alternative name for this.
March 2016
Keywords 41
ShellReferenceGeometry class
Airbag
model
integer The Model number that the airbag shell reference geometry is in.
nid
rdt
sx
float
sy
float
sz
float
Detailed Description
The ShellReferenceGeometry class allows you to create, modify, edit and manipulate airbag shell reference geometry
cards. See the documentation below for more details.
Constructor
new ShellReferenceGeometry(Model[Model], aid (optional)[integer])
Description
Create a new ShellReferenceGeometry object.
Arguments
Name
Type
Description
Model
Return type
ShellReferenceGeometry object
Example
To create a new ShellReferenceGeometry in model m
var a = new ShellReferenceGeometry(m);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Keywords 42
March 2016
Airbag
ShellReferenceGeometry class
Example
To Browse airbag shell reference geometry a:
a.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the airbag shell reference geometry.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for airbag shell reference geometry a:
a.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the airbag shell reference geometry.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy airbag shell reference geometry a into airbag shell reference geometry z:
var z = a.Copy();
March 2016
Keywords 43
ShellReferenceGeometry class
Airbag
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
ShellReferenceGeometry object (or null if not made)
Example
To start creating an asrg in model m:
var m = ShellReferenceGeometry.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit airbag shell reference geometry a:
a.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for airbag shell reference geometry a:
a.Error("My custom error");
Keywords 44
March 2016
Airbag
ShellReferenceGeometry class
First(Model[Model]) [static]
Description
Returns the first airbag shell reference geometry in the model.
Arguments
Name Type
Description
Return type
ShellReferenceGeometry object (or null if there are no airbag shell reference geometrys in the model).
Example
To get the first airbag shell reference geometry in model m:
var a = ShellReferenceGeometry.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ShellReferenceGeometry label.
Example
To get the first free airbag shell reference geometry label in model m:
var label = ShellReferenceGeometry.FirstFreeLabel(m);
Arguments
Name Type
Description
Model Model Model that all airbag shell reference geometrys will be flagged in
flag
Flag
March 2016
Keywords 45
ShellReferenceGeometry class
Airbag
Return type
No return value
Example
To flag all of the airbag shell reference geometrys with flag f in model m:
ShellReferenceGeometry.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the airbag shell reference geometry is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if airbag shell reference geometry a has flag f set on it:
if (a.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Keywords 46
March 2016
Airbag
ShellReferenceGeometry class
Example
To call function test for all of the airbag shell reference geometrys in model m:
ShellReferenceGeometry.ForEach(m, test);
function test(a)
{
// a is ShellReferenceGeometry object
}
To call function test for all of the airbag shell reference geometrys in model m with optional object:
var data = { x:0, y:0 };
ShellReferenceGeometry.ForEach(m, test, data);
function test(a, extra)
{
// a is ShellReferenceGeometry object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of ShellReferenceGeometry objects for all of the airbag shell reference geometrys in a model in Primer
Arguments
Name Type
Description
Return type
Array of ShellReferenceGeometry objects
Example
To make an array of ShellReferenceGeometry objects for all of the airbag shell reference geometrys in model m
var a = ShellReferenceGeometry.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the airbag shell reference geometrys that you want to retrieve
Return type
Array of ShellReferenceGeometry objects
March 2016
Keywords 47
ShellReferenceGeometry class
Airbag
Example
To make an array of ShellReferenceGeometry objects for all of the airbag shell reference geometrys in model m flagged
with f
var a = ShellReferenceGeometry.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the airbag shell reference geometry you want the ShellReferenceGeometry object for
Return type
ShellReferenceGeometry object (or null if airbag shell reference geometry does not exist).
Example
To get the ShellReferenceGeometry object for airbag shell reference geometry 100 in model m
var a = ShellReferenceGeometry.GetFromID(m, 100);
Arguments
Name Type
prop
Description
airbag shell reference geometry property airbag shell reference geometry property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if ShellReferenceGeometry property a.example is a parameter:
Options.property_parameter_names = true;
if (a.GetParameter(a.example) ) do_something...
Options.property_parameter_names = false;
To check if ShellReferenceGeometry property a.example is a parameter by using the GetParameter method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
Keywords 48
March 2016
Airbag
ShellReferenceGeometry class
GetShell(eid[integer])
Description
Returns the shell reference geometry nodes for the shell
Arguments
Name Type
eid
Description
Return type
An array containing the four reference node labels (or null if the shell is not on the shell reference geometry)
Example
To get the nodal points of shell number eid on shell reference geometry a
var coords = a.GetShell(eid);
Keyword()
Description
Returns the keyword for this shell_reference_geometry (*AIRBAG_SHELL_REFERENCE_GEOMETRY). Note that
a carriage return is not added. See also ShellReferenceGeometry.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for shell_reference_geometry a:
var key = a.Keyword();
KeywordCards()
Description
Returns the keyword cards for the shell_reference_geometry. Note that a carriage return is not added. See also
ShellReferenceGeometry.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for airbag shell reference geometry a:
var cards = b.KeywordCards();
March 2016
Keywords 49
ShellReferenceGeometry class
Airbag
Last(Model[Model]) [static]
Description
Returns the last airbag shell reference geometry in the model.
Arguments
Name Type
Description
Return type
ShellReferenceGeometry object (or null if there are no airbag shell reference geometrys in the model).
Example
To get the last airbag shell reference geometry in model m:
var a = ShellReferenceGeometry.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
ShellReferenceGeometry label.
Example
To get the last free airbag shell reference geometry label in model m:
var label = ShellReferenceGeometry.LastFreeLabel(m);
Next()
Description
Returns the next airbag shell reference geometry in the model.
Arguments
No arguments
Return type
ShellReferenceGeometry object (or null if there are no more airbag shell reference geometrys in the model).
Keywords 50
March 2016
Airbag
ShellReferenceGeometry class
Example
To get the airbag shell reference geometry in model m after airbag shell reference geometry a:
var a = a.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ShellReferenceGeometry label.
Example
To get the next free airbag shell reference geometry label in model m:
var label = ShellReferenceGeometry.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the ShellReferenceGeometry can be picked
from any model.
modal
(optional)
boolean 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.
Return type
ShellReferenceGeometry object (or null if not picked)
Example
To pick a ShellReferenceGeometry from model m giving the prompt Pick ShellReferenceGeometry from screen:
var rgs = ShellReferenceGeometry.Pick(Pick ShellReferenceGeometry from screen,
m);
March 2016
Keywords 51
ShellReferenceGeometry class
Airbag
Previous()
Description
Returns the previous airbag shell reference geometry in the model.
Arguments
No arguments
Return type
ShellReferenceGeometry object (or null if there are no more airbag shell reference geometrys in the model).
Example
To get the airbag shell reference geometry in model m before airbag shell reference geometry a:
var a = a.Previous();
RemoveShell(eid[integer])
Description
Removes a shell from the shell reference geometry if it is on it
Arguments
Name Type
eid
Description
integer Element ID
Return type
No return value.
Example
To remove shell 11 from shell reference geometry a:
a.RemoveShell(11);
Arguments
Name Type
Description
Model Model Model that all airbag shell reference geometrys will be renumbered in
start
Return type
No return value
Example
To renumber all of the airbag shell reference geometrys in model m, from 1000000:
ShellReferenceGeometry.RenumberAll(m, 1000000);
Keywords 52
March 2016
Airbag
ShellReferenceGeometry class
Arguments
Name Type
Description
Model Model Model that all the flagged airbag shell reference geometrys will be renumbered in
flag
Flag
Flag set on the airbag shell reference geometrys that you want to renumber
start
Return type
No return value
Example
To renumber all of the airbag shell reference geometrys in model m flagged with f, from 1000000:
ShellReferenceGeometry.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only airbag shell reference geometrys from that model can be
Flag
selected. If the argument is a Flag then only airbag shell reference geometrys that are flagged
with limit can be selected (limit should be different to flag). If omitted, or null, any airbag
shell reference geometrys can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of airbag shell reference geometrys selected or null if menu cancelled
Example
To select airbag shell reference geometrys from model m, flagging those selected with flag f, giving the prompt Select
airbag shell reference geometrys:
ShellReferenceGeometry.Select(f, Select airbag shell reference geometrys, m);
To select airbag shell reference geometrys, flagging those selected with flag f but limiting selection to airbag shell
reference geometrys flagged with flag l, giving the prompt Select airbag shell reference geometrys:
ShellReferenceGeometry.Select(f, Select airbag shell reference geometrys, l);
March 2016
Keywords 53
ShellReferenceGeometry class
Airbag
SetFlag(flag[Flag])
Description
Sets a flag on the airbag shell reference geometry.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for airbag shell reference geometry a:
a.SetFlag(f);
Arguments
Name Type
Description
eid
integer Element ID
n1
n2
n3
n4
Return type
No return value.
Example
To add shell 11 to shell reference geometry a with nodal points 12, 13, 14, 15:
a.SetShell(11, 12, 13, 14, 15);
Sketch(redraw (optional)[boolean])
Description
Sketches the airbag shell reference geometry. The airbag shell reference geometry will be sketched until you either call
ShellReferenceGeometry.Unsketch(), ShellReferenceGeometry.UnsketchAll(), Model.UnsketchAll(), or delete the
model
Keywords 54
March 2016
Airbag
ShellReferenceGeometry class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the airbag shell reference geometry is sketched. If
omitted redraw is true. If you want to sketch several airbag shell reference geometrys and only
redraw after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch airbag shell reference geometry a:
a.Sketch();
Spool()
Description
Spools a shell reference geometry, entry by entry. See also ShellReferenceGeometry.StartSpool
Arguments
No arguments
Return type
Returns an array containing the shell ID and the four nodal point labels. Returns 0 if no more items
Example
To spool shell reference geometry a:
var array;
a.StartSpool();
while (array = a.Spool() )
{
do something...
}
StartSpool()
Description
Starts a shell reference geometry spooling operation. See also ShellReferenceGeometry.Spool
Arguments
No arguments
Return type
No return value
Example
To start spooling shell reference geometry a:
a.StartSpool();
March 2016
Keywords 55
ShellReferenceGeometry class
Airbag
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing airbag shell reference geometrys should be counted. If false or omitted
referenced but undefined airbag shell reference geometrys will also be included in the total.
Return type
number of airbag shell reference geometrys
Example
To get the total number of airbag shell reference geometrys in model m:
var total = ShellReferenceGeometry.Total(m);
Unblank()
Description
Unblanks the airbag shell reference geometry
Arguments
No arguments
Return type
No return value
Example
To unblank airbag shell reference geometry a:
a.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Keywords 56
March 2016
Airbag
ShellReferenceGeometry class
Example
To unblank all of the airbag shell reference geometrys in model m:
ShellReferenceGeometry.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that the flagged airbag shell reference geometrys will be unblanked in
flag
Flag
Flag set on the airbag shell reference geometrys that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the airbag shell reference geometrys in model m flagged with f:
ShellReferenceGeometry.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all airbag shell reference geometrys will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the airbag shell reference geometrys in model m:
ShellReferenceGeometry.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the airbag shell reference geometry.
March 2016
Keywords 57
ShellReferenceGeometry class
Airbag
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the airbag shell reference geometry is unsketched. If
omitted redraw is true. If you want to unsketch several airbag shell reference geometrys and
only redraw after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch airbag shell reference geometry a:
a.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the airbag shell reference geometrys 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().
Return type
No return value
Example
To unsketch all airbag shell reference geometrys in model m:
ShellReferenceGeometry.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
ShellReferenceGeometry object.
Keywords 58
March 2016
Airbag
ShellReferenceGeometry class
Example
To check if ShellReferenceGeometry property a.example is a parameter by using the
ShellReferenceGeometry.GetParameter() method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for airbag shell reference geometry a:
a.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this airbag shell reference geometry.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for airbag shell reference geometry a:
var xrefs = a.Xrefs();
toString()
Description
Creates a string containing the ShellReferenceGeometry data in keyword format. Note that this contains the keyword
header and the keyword cards. See also ShellReferenceGeometry.Keyword() and
ShellReferenceGeometry.KeywordCards().
Arguments
No arguments
March 2016
Keywords 59
ShellReferenceGeometry class
Airbag
Return type
string
Example
To get data for ShellReferenceGeometry rdt in keyword format
var s = rdt.toString();
Keywords 60
March 2016
Boundary
PrescribedAccelerometerRigid class
PrescribedAccelerometerRigid class
The PrescribedAccelerometerRigid class gives you access to define *BOUNDARY_PRESCRIBED_
ACCELEROMETER_RIGID cards in PRIMER. More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[prescribed accelerometer rigid property])
GetRow(row[integer])
Keyword()
KeywordCards()
Next()
Previous()
RemoveRow(row[integer])
SetFlag(flag[Flag])
SetRow(row[integer], data[array])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
PrescribedAccelerometerRigid properties
Name
Type
Description
exists
logical true if prescribed accelerometer rigid exists, false if referred to but not defined. (read only)
include integer The Include file number that the prescribed accelerometer rigid is in.
model
integer The Model number that the prescribed accelerometer rigid is in.
nrow
pid
solv
Detailed Description
The PrescribedAccelerometerRigid class allows you to create, modify, edit and manipulate boundary prescribed
accelerometer rigid cards. See the documentation below for more details.
March 2016
Keywords 61
PrescribedAccelerometerRigid class
Boundary
Constructor
new PrescribedAccelerometerRigid(Model[Model], pid[integer], solv
(optional)[integer])
Description
Create a new PrescribedAccelerometerRigid object.
Arguments
Name
Type
Description
Model
pid
Return type
PrescribedAccelerometerRigid object
Example
To create a new prescribed accelerometer rigid in model m with part ID 10 and solver type 2 (linear regression):
var par = new PrescribedAccelerometerRigid(m, 10, 2);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse prescribed accelerometer rigid par:
par.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the prescribed accelerometer rigid.
Keywords 62
March 2016
Boundary
PrescribedAccelerometerRigid class
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for prescribed accelerometer rigid par:
par.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the prescribed accelerometer rigid.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy prescribed accelerometer rigid par into prescribed accelerometer rigid z:
var z = par.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
PrescribedAccelerometerRigid object (or null if not made)
Example
To start creating a boundary prescribed accelerometer rigid definition in model m:
var par = PrescribedAccelerometerRigid.Create(m);
March 2016
Keywords 63
PrescribedAccelerometerRigid class
Boundary
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit prescribed accelerometer rigid par:
par.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for prescribed accelerometer rigid par:
par.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first prescribed accelerometer rigid in the model.
Arguments
Name Type
Description
Return type
PrescribedAccelerometerRigid object (or null if there are no prescribed accelerometer rigids in the model).
Keywords 64
March 2016
Boundary
PrescribedAccelerometerRigid class
Example
To get the first prescribed accelerometer rigid in model m:
var par = PrescribedAccelerometerRigid.First(m);
Arguments
Name Type
Description
Model Model Model that all prescribed accelerometer rigids will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the prescribed accelerometer rigids with flag f in model m:
PrescribedAccelerometerRigid.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the prescribed accelerometer rigid is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if prescribed accelerometer rigid par has flag f set on it:
if (par.Flagged(f) ) do_something...
March 2016
Keywords 65
PrescribedAccelerometerRigid class
Boundary
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the prescribed accelerometer rigids in model m:
PrescribedAccelerometerRigid.ForEach(m, test);
function test(par)
{
// par is PrescribedAccelerometerRigid object
}
To call function test for all of the prescribed accelerometer rigids in model m with optional object:
var data = { x:0, y:0 };
PrescribedAccelerometerRigid.ForEach(m, test, data);
function test(par, extra)
{
// par is PrescribedAccelerometerRigid object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of PrescribedAccelerometerRigid objects for all of the prescribed accelerometer rigids in a model in
Primer
Arguments
Name Type
Description
Return type
Array of PrescribedAccelerometerRigid objects
Example
To make an array of PrescribedAccelerometerRigid objects for all of the prescribed accelerometer rigids in model m
var par = PrescribedAccelerometerRigid.GetAll(m);
Keywords 66
March 2016
Boundary
PrescribedAccelerometerRigid class
Arguments
Name Type
Description
Flag
Flag set on the prescribed accelerometer rigids that you want to retrieve
Return type
Array of PrescribedAccelerometerRigid objects
Example
To make an array of PrescribedAccelerometerRigid objects for all of the prescribed accelerometer rigids in model m
flagged with f
var par = PrescribedAccelerometerRigid.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the prescribed accelerometer rigid you want the PrescribedAccelerometerRigid object for
Return type
PrescribedAccelerometerRigid object (or null if prescribed accelerometer rigid does not exist).
Example
To get the PrescribedAccelerometerRigid object for prescribed accelerometer rigid 100 in model m
var par = PrescribedAccelerometerRigid.GetFromID(m, 100);
Arguments
Name Type
prop
Description
prescribed accelerometer rigid property prescribed accelerometer rigid property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
March 2016
Keywords 67
PrescribedAccelerometerRigid class
Boundary
Example
To check if PrescribedAccelerometerRigid property par.example is a parameter:
Options.property_parameter_names = true;
if (par.GetParameter(par.example) ) do_something...
Options.property_parameter_names = false;
To check if PrescribedAccelerometerRigid property par.example is a parameter by using the GetParameter method:
if (par.ViewParameters().GetParameter(par.example) ) do_something...
GetRow(row[integer])
Description
Returns the data for a row in the prescribed accelerometer rigid.
Arguments
Name Type
row
Description
integer The row you want the data for. Note row indices start at 0.
Return type
An array containing the row variables NID, CID, LCIDX, LCIDY and LCIDZ.
Example
To get the data for the 2nd row in prescribed accelerometer rigid par:
var data = par.GetRow(1);
Keyword()
Description
Returns the keyword for this prescribed accelerometer rigid. Note that a carriage return is not added. See also
PrescribedAccelerometerRigid.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for prescribed accelerometer rigid par:
var key = par.Keyword();
KeywordCards()
Description
Returns the keyword cards for the prescribed accelerometer rigid. Note that a carriage return is not added. See also
PrescribedAccelerometerRigid.Keyword()
Arguments
No arguments
Keywords 68
March 2016
Boundary
PrescribedAccelerometerRigid class
Return type
string containing the cards.
Example
To get the cards for prescribed accelerometer rigid par:
var cards = par.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last prescribed accelerometer rigid in the model.
Arguments
Name Type
Description
Return type
PrescribedAccelerometerRigid object (or null if there are no prescribed accelerometer rigids in the model).
Example
To get the last prescribed accelerometer rigid in model m:
var par = PrescribedAccelerometerRigid.Last(m);
Next()
Description
Returns the next prescribed accelerometer rigid in the model.
Arguments
No arguments
Return type
PrescribedAccelerometerRigid object (or null if there are no more prescribed accelerometer rigids in the model).
Example
To get the prescribed accelerometer rigid in model m after prescribed accelerometer rigid par:
var par = par.Next();
Previous()
Description
Returns the previous prescribed accelerometer rigid in the model.
Arguments
No arguments
Return type
PrescribedAccelerometerRigid object (or null if there are no more prescribed accelerometer rigids in the model).
March 2016
Keywords 69
PrescribedAccelerometerRigid class
Boundary
Example
To get the prescribed accelerometer rigid in model m before prescribed accelerometer rigid par:
var par = par.Previous();
RemoveRow(row[integer])
Description
Removes the data for a row in *BOUNDARY_PRESCRIBED_ACCELEROMETER_RIGID.
Arguments
Name Type
row
Description
integer The row you want to remove the data for. Note that row indices start at 0.
Return type
No return value.
Example
To remove the second row of data for prescribed accelerometer rigid par:
par.RemoveRow(1);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only prescribed accelerometer rigids from that model can be
Flag
selected. If the argument is a Flag then only prescribed accelerometer rigids that are flagged
with limit can be selected (limit should be different to flag). If omitted, or null, any prescribed
accelerometer rigids can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of prescribed accelerometer rigids selected or null if menu cancelled
Keywords 70
March 2016
Boundary
PrescribedAccelerometerRigid class
Example
To select prescribed accelerometer rigids from model m, flagging those selected with flag f, giving the prompt Select
prescribed accelerometer rigids:
PrescribedAccelerometerRigid.Select(f, Select prescribed accelerometer rigids,
m);
To select prescribed accelerometer rigids, flagging those selected with flag f but limiting selection to prescribed
accelerometer rigids flagged with flag l, giving the prompt Select prescribed accelerometer rigids:
PrescribedAccelerometerRigid.Select(f, Select prescribed accelerometer rigids,
l);
SetFlag(flag[Flag])
Description
Sets a flag on the prescribed accelerometer rigid.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for prescribed accelerometer rigid par:
par.SetFlag(f);
SetRow(row[integer], data[array])
Description
Sets the data for a row in *BOUNDARY_PRESCRIBED_ACCELEROMETER_RIGID.
Arguments
Name Type
Description
row
integer The row you want to set the data for. Note that row indices start at 0.
data
array
Return type
No return value.
Example
To set the second row of data for prescribed accelerometer rigid par to be node 11, coordinate system 12, and load
curves 13, 14, 15:
var array = [11, 12, 13, 14, 15];
par.SetRow(1, array);
To append a new row of data (using the same array of values):
par.SetRow(par.nrow, array);
March 2016
Keywords 71
PrescribedAccelerometerRigid class
Boundary
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing prescribed accelerometer rigids should be counted. If false or omitted
referenced but undefined prescribed accelerometer rigids will also be included in the total.
Return type
number of prescribed accelerometer rigids
Example
To get the total number of prescribed accelerometer rigids in model m:
var total = PrescribedAccelerometerRigid.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all prescribed accelerometer rigids will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the prescribed accelerometer rigids in model m:
PrescribedAccelerometerRigid.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
PrescribedAccelerometerRigid object.
Keywords 72
March 2016
Boundary
PrescribedAccelerometerRigid class
Example
To check if PrescribedAccelerometerRigid property par.example is a parameter by using the
PrescribedAccelerometerRigid.GetParameter() method:
if (par.ViewParameters().GetParameter(par.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for prescribed accelerometer rigid par:
par.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this prescribed accelerometer rigid.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for prescribed accelerometer rigid par:
var xrefs = par.Xrefs();
toString()
Description
Creates a string containing the prescribed accelerometer rigid data in keyword format. Note that this contains the
keyword header and the keyword cards. See also PrescribedAccelerometerRigid.Keyword() and
PrescribedAccelerometerRigid.KeywordCards().
Arguments
No arguments
March 2016
Keywords 73
PrescribedAccelerometerRigid class
Boundary
Return type
string
Example
To get data for prescribed accelerometer rigid par in keyword format
var s = par.toString();
Keywords 74
March 2016
Boundary
PrescribedOrientationRigid class
PrescribedOrientationRigid class
The PrescribedOrientationRigid class gives you access to define *BOUNDARY_PRESCRIBED_ORIENTATION_
RIGID cards in PRIMER. More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[prescribed orientation rigid property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
PrescribedOrientationRigid constants
Name
Description
PrescribedOrientationRigid properties
Name
Type
Description
birth
real
Time prior to which the body moves freely under the action of other agents.
body
integer
Reference axes: 0 for rotations about axes fixed in PIDA or 1 for those fixed in PIDB.
March 2016
Keywords 75
PrescribedOrientationRigid class
Boundary
death
real
exists
logical
true if prescribed orientation rigid exists, false if referred to but not defined. (read only)
include integer
The Include file number that the prescribed orientation rigid is in.
intrp
integer
intrp
integer
iseq
integer
ishft
integer
Angle shift: 1 for unaltered angle curves or 2 for angle data shift in LCIDQi curves eliminating
discontinuities.
lcidc11 integer
lcidc12 integer
lcidc13 integer
lcidc21 integer
lcidc22 integer
lcidc23 integer
lcidc31 integer
lcidc32 integer
lcidc33 integer
lcide1
integer
lcide2
integer
lcide3
integer
lcide4
integer
lcidq1
integer
lcidq2
integer
lcidq3
integer
lcids
integer
Load curve ID specifying spin speed of PIDB about axis parallel to vector.
lcidv1
integer
lcidv2
integer
lcidv3
integer
model
integer
option constant The Boundary Prescribed Orientation Rigid option. Can be PrescribedOrientationRigid.DIRCOS,
PrescribedOrientationRigid.ANGLES, PrescribedOrientationRigid.EULERP or
PrescribedOrientationRigid.VECTOR.
pida
integer
pidb
integer
valspin real
Constant value for spin speed of PIDB about axis parallel to vector. Used when LCIDS is 0.
Detailed Description
The PrescribedOrientationRigid class allows you to create, modify, edit and manipulate boundary prescribed orientation
rigid cards. See the documentation below for more details.
Keywords 76
March 2016
Boundary
PrescribedOrientationRigid class
Constructor
new PrescribedOrientationRigid(Model[Model], option[constant], pidb[integer])
Description
Create a new PrescribedOrientationRigid object.
Arguments
Name Type
Description
Model Model
option constant Suffix for boundary prescribed orientation rigid. Can be PrescribedOrientationRigid.DIRCOS
PrescribedOrientationRigid.ANGLES PrescribedOrientationRigid.EULERP
PrescribedOrientationRigid.VECTOR
pidb
integer
Return type
PrescribedOrientationRigid object
Example
To create a new prescribed orientation rigid in model m with part ID 10 and suffix _DIRCOS:
var por = new PrescribedOrientationRigid(m, PrescribedOrientationRigid.DIRCOS,
10);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse prescribed orientation rigid por:
por.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the prescribed orientation rigid.
March 2016
Keywords 77
PrescribedOrientationRigid class
Boundary
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for prescribed orientation rigid por:
por.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the prescribed orientation rigid.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy prescribed orientation rigid por into prescribed orientation rigid z:
var z = por.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
PrescribedOrientationRigid object (or null if not made)
Example
To start creating a boundary prescribed orientation rigid definition in model m:
var por = PrescribedOrientationRigid.Create(m);
Keywords 78
March 2016
Boundary
PrescribedOrientationRigid class
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit prescribed orientation rigid por:
por.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for prescribed orientation rigid por:
por.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first prescribed orientation rigid in the model.
Arguments
Name Type
Description
Return type
PrescribedOrientationRigid object (or null if there are no prescribed orientation rigids in the model).
March 2016
Keywords 79
PrescribedOrientationRigid class
Boundary
Example
To get the first prescribed orientation rigid in model m:
var por = PrescribedOrientationRigid.First(m);
Arguments
Name Type
Description
Model Model Model that all prescribed orientation rigids will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the prescribed orientation rigids with flag f in model m:
PrescribedOrientationRigid.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the prescribed orientation rigid is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if prescribed orientation rigid por has flag f set on it:
if (por.Flagged(f) ) do_something...
Keywords 80
March 2016
Boundary
PrescribedOrientationRigid class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the prescribed orientation rigids in model m:
PrescribedOrientationRigid.ForEach(m, test);
function test(por)
{
// por is PrescribedOrientationRigid object
}
To call function test for all of the prescribed orientation rigids in model m with optional object:
var data = { x:0, y:0 };
PrescribedOrientationRigid.ForEach(m, test, data);
function test(por, extra)
{
// por is PrescribedOrientationRigid object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of PrescribedOrientationRigid objects for all of the prescribed orientation rigids in a model in Primer
Arguments
Name Type
Description
Return type
Array of PrescribedOrientationRigid objects
Example
To make an array of PrescribedOrientationRigid objects for all of the prescribed orientation rigids in model m
var por = PrescribedOrientationRigid.GetAll(m);
March 2016
Keywords 81
PrescribedOrientationRigid class
Boundary
Arguments
Name Type
Description
Flag
Flag set on the prescribed orientation rigids that you want to retrieve
Return type
Array of PrescribedOrientationRigid objects
Example
To make an array of PrescribedOrientationRigid objects for all of the prescribed orientation rigids in model m flagged
with f
var por = PrescribedOrientationRigid.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the prescribed orientation rigid you want the PrescribedOrientationRigid object for
Return type
PrescribedOrientationRigid object (or null if prescribed orientation rigid does not exist).
Example
To get the PrescribedOrientationRigid object for prescribed orientation rigid 100 in model m
var por = PrescribedOrientationRigid.GetFromID(m, 100);
Arguments
Name Type
prop
Description
prescribed orientation rigid property prescribed orientation rigid property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Keywords 82
March 2016
Boundary
PrescribedOrientationRigid class
Example
To check if PrescribedOrientationRigid property por.example is a parameter:
Options.property_parameter_names = true;
if (por.GetParameter(por.example) ) do_something...
Options.property_parameter_names = false;
To check if PrescribedOrientationRigid property por.example is a parameter by using the GetParameter method:
if (por.ViewParameters().GetParameter(por.example) ) do_something...
Keyword()
Description
Returns the keyword for this prescribed orientation rigid. Note that a carriage return is not added. See also
PrescribedOrientationRigid.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for prescribed orientation rigid por:
var key = por.Keyword();
KeywordCards()
Description
Returns the keyword cards for the prescribed orientation rigid. Note that a carriage return is not added. See also
PrescribedOrientationRigid.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for prescribed orientation rigid por:
var cards = por.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last prescribed orientation rigid in the model.
Arguments
Name Type
Description
March 2016
Keywords 83
PrescribedOrientationRigid class
Boundary
Return type
PrescribedOrientationRigid object (or null if there are no prescribed orientation rigids in the model).
Example
To get the last prescribed orientation rigid in model m:
var por = PrescribedOrientationRigid.Last(m);
Next()
Description
Returns the next prescribed orientation rigid in the model.
Arguments
No arguments
Return type
PrescribedOrientationRigid object (or null if there are no more prescribed orientation rigids in the model).
Example
To get the prescribed orientation rigid in model m after prescribed orientation rigid por:
var por = por.Next();
Previous()
Description
Returns the previous prescribed orientation rigid in the model.
Arguments
No arguments
Return type
PrescribedOrientationRigid object (or null if there are no more prescribed orientation rigids in the model).
Example
To get the prescribed orientation rigid in model m before prescribed orientation rigid por:
var por = por.Previous();
Keywords 84
March 2016
Boundary
PrescribedOrientationRigid class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only prescribed orientation rigids from that model can be
Flag
selected. If the argument is a Flag then only prescribed orientation rigids that are flagged with
limit can be selected (limit should be different to flag). If omitted, or null, any prescribed
orientation rigids can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of prescribed orientation rigids selected or null if menu cancelled
Example
To select prescribed orientation rigids from model m, flagging those selected with flag f, giving the prompt Select
prescribed orientation rigids:
PrescribedOrientationRigid.Select(f, Select prescribed orientation rigids, m);
To select prescribed orientation rigids, flagging those selected with flag f but limiting selection to prescribed orientation
rigids flagged with flag l, giving the prompt Select prescribed orientation rigids:
PrescribedOrientationRigid.Select(f, Select prescribed orientation rigids, l);
SetFlag(flag[Flag])
Description
Sets a flag on the prescribed orientation rigid.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for prescribed orientation rigid por:
por.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the prescribed orientation rigid. The prescribed orientation rigid will be sketched until you either call
PrescribedOrientationRigid.Unsketch(), PrescribedOrientationRigid.UnsketchAll(), Model.UnsketchAll(), or delete the
model
March 2016
Keywords 85
PrescribedOrientationRigid class
Boundary
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the prescribed orientation rigid is sketched. If omitted
redraw is true. If you want to sketch several prescribed orientation rigids and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch prescribed orientation rigid por:
por.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing prescribed orientation rigids should be counted. If false or omitted
referenced but undefined prescribed orientation rigids will also be included in the total.
Return type
number of prescribed orientation rigids
Example
To get the total number of prescribed orientation rigids in model m:
var total = PrescribedOrientationRigid.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all prescribed orientation rigids will be unset in
flag
Flag
Return type
No return value
Keywords 86
March 2016
Boundary
PrescribedOrientationRigid class
Example
To unset the flag f on all the prescribed orientation rigids in model m:
PrescribedOrientationRigid.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the prescribed orientation rigid.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the prescribed orientation rigid is unsketched. If
omitted redraw is true. If you want to unsketch several prescribed orientation rigids and only
redraw after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch prescribed orientation rigid por:
por.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the prescribed orientation rigids 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().
Return type
No return value
Example
To unsketch all prescribed orientation rigids in model m:
PrescribedOrientationRigid.UnsketchAll(m);
ViewParameters()
Description
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.
March 2016
Keywords 87
PrescribedOrientationRigid class
Boundary
Arguments
No arguments
Return type
PrescribedOrientationRigid object.
Example
To check if PrescribedOrientationRigid property por.example is a parameter by using the
PrescribedOrientationRigid.GetParameter() method:
if (por.ViewParameters().GetParameter(por.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for prescribed orientation rigid por:
por.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this prescribed orientation rigid.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for prescribed orientation rigid por:
var xrefs = por.Xrefs();
Keywords 88
March 2016
Boundary
PrescribedOrientationRigid class
toString()
Description
Creates a string containing the prescribed orientation rigid data in keyword format. Note that this contains the keyword
header and the keyword cards. See also PrescribedOrientationRigid.Keyword() and
PrescribedOrientationRigid.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for prescribed orientation rigid por in keyword format
var s = por.toString();
March 2016
Keywords 89
PrescribedFinalGeometry class
Boundary
PrescribedFinalGeometry class
The PrescribedFinalGeometry class gives you access to define boundary prescribed final_geometry cards in PRIMER.
More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetData(index[integer])
GetParameter(prop[boundary prescribed final geometry property])
Keyword()
KeywordCards()
Next()
Previous()
RemoveData(index[Integer])
SetData(index[Integer], nid[integer], x[float], y[float], z[float], lcid (optional)[integer], death (optional)[float])
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
PrescribedFinalGeometry properties
Name
Type
Description
deathd
float
exists
logical true if boundary prescribed final_geometry exists, false if referred to but not defined. (read
only)
id
integer PrescribedFinalGeometry number. Also see the label property which is an alternative name
for this.
Keywords 90
March 2016
Boundary
PrescribedFinalGeometry class
include
integer The Include file number that the boundary prescribed final_geometry is in.
label
integer PrescribedFinalGeometry number. Also see the bpfgid property which is an alternative name
for this.
lcidf
lines (read
only)
model
integer The Model number that the boundary prescribed final geometry is in.
Detailed Description
The PrescribedFinalGeometry class allows you to create, modify, edit and boundary prescribed final_geometry cards.
See the documentation below for more details.
Constructor
new PrescribedFinalGeometry(Model[Model],
bpfgid[PrescribedFinalGeometry])
Description
Create a new PrescribedFinalGeometry object.
Arguments
Name Type
Description
Model Model
Return type
PrescribedFinalGeometry object
Example
To create a new final geometry 99 in model m
var b = new PrescribedFinalGeometry(m, 99);
Details of functions
Blank()
Description
Blanks the boundary prescribed final geometry
Arguments
No arguments
Return type
No return value
Example
To blank boundary prescribed final geometry b:
b.Blank();
March 2016
Keywords 91
PrescribedFinalGeometry class
Boundary
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boundary prescribed final geometrys in model m:
PrescribedFinalGeometry.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged boundary prescribed final geometrys will be blanked in
flag
Flag
Flag set on the boundary prescribed final geometrys that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boundary prescribed final geometrys in model m flagged with f:
PrescribedFinalGeometry.BlankFlagged(m, f);
Blanked()
Description
Checks if the boundary prescribed final geometry is blanked or not.
Arguments
No arguments
Keywords 92
March 2016
Boundary
PrescribedFinalGeometry class
Return type
true if blanked, false if not.
Example
To check if boundary prescribed final geometry b is blanked:
if (b.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse boundary prescribed final geometry b:
b.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the boundary prescribed final geometry.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for boundary prescribed final geometry b:
b.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the boundary prescribed final geometry.
March 2016
Keywords 93
PrescribedFinalGeometry class
Boundary
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy boundary prescribed final geometry b into boundary prescribed final geometry z:
var z = b.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
PrescribedFinalGeometry object (or null if not made)
Example
To start creating a bpfg n in model m:
var n = PrescribedFinalGeometry.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit boundary prescribed final geometry b:
b.Edit();
Keywords 94
March 2016
Boundary
PrescribedFinalGeometry class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for boundary prescribed final geometry b:
b.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first boundary prescribed final geometry in the model.
Arguments
Name Type
Description
Return type
PrescribedFinalGeometry object (or null if there are no boundary prescribed final geometrys in the model).
Example
To get the first boundary prescribed final geometry in model m:
var b = PrescribedFinalGeometry.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
March 2016
Keywords 95
PrescribedFinalGeometry class
Boundary
Return type
PrescribedFinalGeometry label.
Example
To get the first free boundary prescribed final geometry label in model m:
var label = PrescribedFinalGeometry.FirstFreeLabel(m);
Arguments
Name Type
Description
Model Model Model that all boundary prescribed final geometrys will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the boundary prescribed final geometrys with flag f in model m:
PrescribedFinalGeometry.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the boundary prescribed final geometry is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if boundary prescribed final geometry b has flag f set on it:
if (b.Flagged(f) ) do_something...
Keywords 96
March 2016
Boundary
PrescribedFinalGeometry class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the boundary prescribed final geometrys in model m:
PrescribedFinalGeometry.ForEach(m, test);
function test(b)
{
// b is PrescribedFinalGeometry object
}
To call function test for all of the boundary prescribed final geometrys in model m with optional object:
var data = { x:0, y:0 };
PrescribedFinalGeometry.ForEach(m, test, data);
function test(b, extra)
{
// b is PrescribedFinalGeometry object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of PrescribedFinalGeometry objects for all of the boundary prescribed final geometrys in a model in
Primer
Arguments
Name Type
Description
Return type
Array of PrescribedFinalGeometry objects
March 2016
Keywords 97
PrescribedFinalGeometry class
Boundary
Example
To make an array of PrescribedFinalGeometry objects for all of the boundary prescribed final geometrys in model m
var b = PrescribedFinalGeometry.GetAll(m);
GetData(index[integer])
Description
Returns data for open-ended cards for a given row number in *BOUNDARY_PRESCRIBED_FINAL_GEOMETRY.
Arguments
Name Type
Description
index integer Index of open-ended card you want the data for. Note that indices start at 0, not 1.
0 <= index < lines
Return type
An array containing data (NID, X, Y, Z, LCID, DEATH).
Example
To get the data for the 3rd open-ended row for boundary prescribed final geometry b:
var data = b.GetData(2);
Arguments
Name Type
Description
Flag
Flag set on the boundary prescribed final geometrys that you want to retrieve
Return type
Array of PrescribedFinalGeometry objects
Example
To make an array of PrescribedFinalGeometry objects for all of the boundary prescribed final geometrys in model m
flagged with f
var b = PrescribedFinalGeometry.GetFlagged(m, f);
Keywords 98
March 2016
Boundary
PrescribedFinalGeometry class
Arguments
Name
Type
Description
Model
number integer number of the boundary prescribed final geometry you want the PrescribedFinalGeometry object for
Return type
PrescribedFinalGeometry object (or null if boundary prescribed final geometry does not exist).
Example
To get the PrescribedFinalGeometry object for boundary prescribed final geometry 100 in model m
var b = PrescribedFinalGeometry.GetFromID(m, 100);
Arguments
Name Type
Description
prop
Return type
Parameter object if property is a parameter, null if not.
Example
To check if PrescribedFinalGeometry property b.example is a parameter:
Options.property_parameter_names = true;
if (b.GetParameter(b.example) ) do_something...
Options.property_parameter_names = false;
To check if PrescribedFinalGeometry property b.example is a parameter by using the GetParameter method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Keyword()
Description
Returns the keyword for this PrescribedFinalGeometry (*BOUNDARY_PRESCRIBED_FINAL_GEOMETRY). Note
that a carriage return is not added. See also PrescribedFinalGeometry.KeywordCards()
Arguments
No arguments
March 2016
Keywords 99
PrescribedFinalGeometry class
Boundary
Return type
string containing the keyword.
Example
To get the keyword for PrescribedFinalGeometry bfg:
var key = bfg.Keyword();
KeywordCards()
Description
Returns the keyword cards for the PrescribedFinalGeometry. Note that a carriage return is not added. See also
PrescribedFinalGeometry.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for PrescribedFinalGeometry bfg:
var cards = bfg.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last boundary prescribed final geometry in the model.
Arguments
Name Type
Description
Return type
PrescribedFinalGeometry object (or null if there are no boundary prescribed final geometrys in the model).
Example
To get the last boundary prescribed final geometry in model m:
var b = PrescribedFinalGeometry.Last(m);
Keywords 100
March 2016
Boundary
PrescribedFinalGeometry class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
PrescribedFinalGeometry label.
Example
To get the last free boundary prescribed final geometry label in model m:
var label = PrescribedFinalGeometry.LastFreeLabel(m);
Next()
Description
Returns the next boundary prescribed final geometry in the model.
Arguments
No arguments
Return type
PrescribedFinalGeometry object (or null if there are no more boundary prescribed final geometrys in the model).
Example
To get the boundary prescribed final geometry in model m after boundary prescribed final geometry b:
var b = b.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
PrescribedFinalGeometry label.
Example
To get the next free boundary prescribed final geometry label in model m:
var label = PrescribedFinalGeometry.NextFreeLabel(m);
March 2016
Keywords 101
PrescribedFinalGeometry class
Boundary
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the PrescribedFinalGeometry can be picked
from any model.
modal
(optional)
boolean 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.
Return type
PrescribedFinalGeometry object (or null if not picked)
Example
To pick a PrescribedFinalGeometry from model m giving the prompt Pick PrescribedFinalGeometry from screen:
var bfg = PrescribedFinalGeometry.Pick(Pick PrescribedFinalGeometry from
screen, m);
Previous()
Description
Returns the previous boundary prescribed final geometry in the model.
Arguments
No arguments
Return type
PrescribedFinalGeometry object (or null if there are no more boundary prescribed final geometrys in the model).
Example
To get the boundary prescribed final geometry in model m before boundary prescribed final geometry b:
var b = b.Previous();
RemoveData(index[Integer])
Description
Removes a line of data for a *BOUNDARY_PRESCRIBED_FINAL_GEOMETRY.
Arguments
Name Type
Description
index Integer The index of the *BOUNDARY_PRESCRIBED_FINAL_GEOMETRY data to remove. Note that
indices start at 0, not 1.
0 <= index < lines
Keywords 102
March 2016
Boundary
PrescribedFinalGeometry class
Return type
No return value.
Example
To remove row 2 (indices start with 0) of open-ended cards for *BOUNDARY_PRESCRIBED_FINAL_GEOMETRY
b:
b.RemoveData(1);
Arguments
Name Type
Description
Model Model Model that all boundary prescribed final geometrys will be renumbered in
start
Return type
No return value
Example
To renumber all of the boundary prescribed final geometrys in model m, from 1000000:
PrescribedFinalGeometry.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged boundary prescribed final geometrys will be renumbered in
flag
Flag
Flag set on the boundary prescribed final geometrys that you want to renumber
start
Return type
No return value
Example
To renumber all of the boundary prescribed final geometrys in model m flagged with f, from 1000000:
PrescribedFinalGeometry.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 103
PrescribedFinalGeometry class
Boundary
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only boundary prescribed final geometrys from that model can
Flag
be selected. If the argument is a Flag then only boundary prescribed final geometrys that are
flagged with limit can be selected (limit should be different to flag). If omitted, or null, any
boundary prescribed final geometrys can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of boundary prescribed final geometrys selected or null if menu cancelled
Example
To select boundary prescribed final geometrys from model m, flagging those selected with flag f, giving the prompt
Select boundary prescribed final geometrys:
PrescribedFinalGeometry.Select(f, Select boundary prescribed final geometrys,
m);
To select boundary prescribed final geometrys, flagging those selected with flag f but limiting selection to boundary
prescribed final geometrys flagged with flag l, giving the prompt Select boundary prescribed final geometrys:
PrescribedFinalGeometry.Select(f, Select boundary prescribed final geometrys,
l);
Arguments
Name
Type
Description
index
nid
float
float
float
Keywords 104
float
Death time.
March 2016
Boundary
PrescribedFinalGeometry class
Return type
No return value.
Example
To set values for row 2 (indices start with 0) of open-ended cards for *BOUNDARY_PRESCRIBED_FINAL_
GEOMETRY b with the following specification: nid, x, y, z, lcid, death are 99, 0.1, 0.2, 0.3, 88, 100.0 respectively
b.SetData(1, 99, 0.1, 0.2, 0.3, 88, 100.0);
To append a new line of data (using the same example values):
b.SetData(b.lines, 99, 0.1, 0.2, 0.3, 88, 100.0);
SetFlag(flag[Flag])
Description
Sets a flag on the boundary prescribed final geometry.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for boundary prescribed final geometry b:
b.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the boundary prescribed final geometry. The boundary prescribed final geometry will be sketched until you
either call PrescribedFinalGeometry.Unsketch(), PrescribedFinalGeometry.UnsketchAll(), Model.UnsketchAll(), or
delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the boundary prescribed final geometry is sketched. If
omitted redraw is true. If you want to sketch several boundary prescribed final geometrys and
only redraw after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch boundary prescribed final geometry b:
b.Sketch();
March 2016
Keywords 105
PrescribedFinalGeometry class
Boundary
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing boundary prescribed final geometrys should be counted. If false or omitted
referenced but undefined boundary prescribed final geometrys will also be included in the
total.
Return type
number of boundary prescribed final geometrys
Example
To get the total number of boundary prescribed final geometrys in model m:
var total = PrescribedFinalGeometry.Total(m);
Unblank()
Description
Unblanks the boundary prescribed final geometry
Arguments
No arguments
Return type
No return value
Example
To unblank boundary prescribed final geometry b:
b.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Keywords 106
March 2016
Boundary
PrescribedFinalGeometry class
Example
To unblank all of the boundary prescribed final geometrys in model m:
PrescribedFinalGeometry.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that the flagged boundary prescribed final geometrys will be unblanked in
flag
Flag
Flag set on the boundary prescribed final geometrys that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boundary prescribed final geometrys in model m flagged with f:
PrescribedFinalGeometry.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all boundary prescribed final geometrys will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the boundary prescribed final geometrys in model m:
PrescribedFinalGeometry.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the boundary prescribed final geometry.
March 2016
Keywords 107
PrescribedFinalGeometry class
Boundary
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the boundary prescribed final geometry is unsketched.
If omitted redraw is true. If you want to unsketch several boundary prescribed final geometrys
and only redraw after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch boundary prescribed final geometry b:
b.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the boundary prescribed final geometrys 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().
Return type
No return value
Example
To unsketch all boundary prescribed final geometrys in model m:
PrescribedFinalGeometry.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
PrescribedFinalGeometry object.
Keywords 108
March 2016
Boundary
PrescribedFinalGeometry class
Example
To check if PrescribedFinalGeometry property b.example is a parameter by using the
PrescribedFinalGeometry.GetParameter() method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for boundary prescribed final geometry b:
b.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this boundary prescribed final geometry.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for boundary prescribed final geometry b:
var xrefs = b.Xrefs();
toString()
Description
Creates a string containing the PrescribedFinalGeometry data in keyword format. Note that this contains the keyword
header and the keyword cards. See also PrescribedFinalGeometry.Keyword() and
PrescribedFinalGeometry.KeywordCards().
Arguments
No arguments
March 2016
Keywords 109
PrescribedFinalGeometry class
Boundary
Return type
string
Example
To get data for PrescribedFinalGeometry bfg in keyword format
var s = bfg.toString();
Keywords 110
March 2016
Boundary
PrescribedMotion class
PrescribedMotion class
The PrescribedMotion class gives you access to define boundary prescribed motion cards in PRIMER. More...
Class functions
AnimationBackward()
AnimationBegin(Model[Model], flag[Flag])
AnimationFinish()
AnimationForward()
AnimationGetData()
AnimationPause()
AnimationPlay()
AnimationSetData(data[Object])
AnimationToEnd()
AnimationToStart()
AnimationToTime()
BlankAll(Model[Model], redraw (optional)[boolean])
BlankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean])
First(Model[Model])
FirstFreeLabel(Model[Model], layer (optional)[Include number])
FlagAll(Model[Model], flag[Flag])
ForEach(Model[Model], func[function], extra (optional)[any])
GetAll(Model[Model])
GetFlagged(Model[Model], flag[Flag])
GetFromID(Model[Model], number[integer])
Last(Model[Model])
LastFreeLabel(Model[Model], layer (optional)[Include number])
NextFreeLabel(Model[Model], layer (optional)[Include number])
Pick(prompt[string], Model (optional)[Model], modal (optional)[boolean])
RenumberAll(Model[Model], start[integer])
RenumberFlagged(Model[Model], flag[Flag], start[integer])
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean])
Total(Model[Model], exists (optional)[boolean])
UnblankAll(Model[Model], redraw (optional)[boolean])
UnblankFlagged(Model[Model], flag[Flag], redraw (optional)[boolean])
UnflagAll(Model[Model], flag[Flag])
UnsketchAll(Model[Model], redraw (optional)[boolean])
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[boundary prescribed motion property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
PrescribedMotion constants
Name
Description
PrescribedMotion.NODE
March 2016
Keywords 111
PrescribedMotion class
Boundary
PrescribedMotion.NRBC
PrescribedMotion.NRBC_
LOCAL
PrescribedMotion.RIGID
PrescribedMotion.RIGID_
LOCAL
PrescribedMotion.SET
PrescribedMotion properties
Name
Type
Description
birth
real
Birth time
death
real
Death time
dof
integer
Degree of freedom
exists
logical
true if boundary prescribed motion exists, false if referred to but not defined. (read only)
heading string
PrescribedMotion heading
id
logical
include integer
The Include file number that the boundary prescribed motion is in.
label
integer
PrescribedMotion number.
lcid
integer
model
integer
mrb
integer
node1
integer
node2
integer
offset1 real
offset2 real
sf
real
type
typeid
integer
vad
integer
Velocity/acceleration/displacement flag
vid
integer
Vector ID
Detailed Description
The PrescribedMotion class allows you to create, modify, edit and boundary prescribed motion cards. See the
documentation below for more details.
Keywords 112
March 2016
Boundary
PrescribedMotion class
Constructor
new PrescribedMotion(Model[Model], typeid[integer], dof[integer],
vad[integer], lcid[integer], type[constant], id (optional)[integer], heading
(optional)[string])
Description
Create a new PrescribedMotion object.
Arguments
Name
Type
Description
Model
Model
typeid
integer
dof
integer
Degree of freedom
vad
integer
Velocity/acceleration/displacement flag
lcid
integer
type
id (optional) integer
PrescribedMotion number
heading
(optional)
string
Return type
PrescribedMotion object
Example
To create a new displacement for node 100 in x using loadcurve 10 model m with label 200, of type SET
var b = new PrescribedMotion(m, 100, 1, 2, 10, PrescribedMotion.SET, 200);
Details of functions
AnimationBackward() [static]
Description
Moves backward one frame of a PrescribedMotion animation (pausing animation first if required). Also see the
PrescribedMotion.AnimationBegin() method which MUST be called before you start animating and the
PrescribedMotion.AnimationFinish() method which MUST be called after you have finished animating.
Arguments
No arguments
Return type
No return value
Example
To move backward one frame of an animation:
PrescribedMotion.AnimationBackward();
March 2016
Keywords 113
PrescribedMotion class
Boundary
Arguments
Name Type
Description
Flag
Return type
Object containing animation properties (properties start, end, frames, frame, time, rate, repeat)
Example
To begin an animation of the PrescribedMotions in model m flagged with f:
var aprops = PrescribedMotion.AnimationBegin(m, f);
AnimationFinish() [static]
Description
Finishes a PrescribedMotion animation. This MUST be called to finish animating. This will restore nodal coordinates
but will not perform a graphics update. Also see the PrescribedMotion.AnimationBegin() method which MUST be
called before you start animating.
Arguments
No arguments
Return type
No return value
Example
To finish animating:
PrescribedMotion.AnimationFinish();
AnimationForward() [static]
Description
Moves forward one frame of a PrescribedMotion animation (pausing animation first if required). Also see the
PrescribedMotion.AnimationBegin() method which MUST be called before you start animating and the
PrescribedMotion.AnimationFinish() method which MUST be called after you have finished animating.
Arguments
No arguments
Return type
No return value
Keywords 114
March 2016
Boundary
PrescribedMotion class
Example
To move forward one frame of an animation:
PrescribedMotion.AnimationForward();
AnimationGetData() [static]
Description
Returns the animation data (pausing animation first if required). Also see the PrescribedMotion.AnimationBegin()
method which MUST be called before you start animating and the PrescribedMotion.AnimationFinish() method which
MUST be called after you have finished animating.
Arguments
No arguments
Return type
Object containing animation data (properties start, end, frames, frame, rate, repeat)
Example
To get the current animation data:
PrescribedMotion.AnimationGetData();
AnimationPause() [static]
Description
Pauses playback of a PrescribedMotion animation. Also see the PrescribedMotion.AnimationBegin() method which
MUST be called before you start animating and the PrescribedMotion.AnimationFinish() method which MUST be
called after you have finished animating.
Arguments
No arguments
Return type
No return value
Example
To pause playback of an animation:
PrescribedMotion.AnimationPause();
AnimationPlay() [static]
Description
Starts playback of a PrescribedMotion animation. Also see the PrescribedMotion.AnimationBegin() method which
MUST be called before you start animating and the PrescribedMotion.AnimationFinish() method which MUST be
called after you have finished animating.
This method should only be used from a script which implements a user interface so you can actually stop the
animation! Dont forget to add a pause/stop button that calls PrescribedMotion.AnimationPause()!
Arguments
No arguments
March 2016
Keywords 115
PrescribedMotion class
Boundary
Return type
No return value
Example
To start playback of an animation:
PrescribedMotion.AnimationPlay();
AnimationSetData(data[Object]) [static]
Description
Sets the current animation data (pausing animation first if required). Also see the PrescribedMotion.AnimationBegin()
method which MUST be called before you start animating and the PrescribedMotion.AnimationFinish() method which
MUST be called after you have finished animating.
Arguments
Name Type
data
Description
Return type
No return value
Example
To set the animation frame rate to 10 frames/sec:
data = PrescribedMotion.AnimationGetData();
data.rate = 10;
PrescribedMotion.AnimationSetData(data);
AnimationToEnd() [static]
Description
Moves to the end of a PrescribedMotion animation (pausing animation first if required). Also see the
PrescribedMotion.AnimationBegin() method which MUST be called before you start animating and the
PrescribedMotion.AnimationFinish() method which MUST be called after you have finished animating.
Arguments
No arguments
Return type
No return value
Example
To move to the end of an animation:
PrescribedMotion.AnimationToEnd();
AnimationToStart() [static]
Description
Moves to the start of a PrescribedMotion animation (pausing animation first if required). Also see the
PrescribedMotion.AnimationBegin() method which MUST be called before you start animating and the
PrescribedMotion.AnimationFinish() method which MUST be called after you have finished animating.
Keywords 116
March 2016
Boundary
PrescribedMotion class
Arguments
No arguments
Return type
No return value
Example
To move to the start of an animation:
PrescribedMotion.AnimationToStart();
AnimationToTime() [static]
Description
Moves to a specific time in a PrescribedMotion animation (pausing animation first if required). Also see the
PrescribedMotion.AnimationBegin() method which MUST be called before you start animating and the
PrescribedMotion.AnimationFinish() method which MUST be called after you have finished animating.
Arguments
No arguments
Return type
No return value
Example
To move to time 28.0 in an animation:
PrescribedMotion.AnimationToTime(28.0);
Blank()
Description
Blanks the boundary prescribed motion
Arguments
No arguments
Return type
No return value
Example
To blank boundary prescribed motion b:
b.Blank();
March 2016
Keywords 117
PrescribedMotion class
Boundary
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boundary prescribed motions in model m:
PrescribedMotion.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged boundary prescribed motions will be blanked in
flag
Flag
Flag set on the boundary prescribed motions that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boundary prescribed motions in model m flagged with f:
PrescribedMotion.BlankFlagged(m, f);
Blanked()
Description
Checks if the boundary prescribed motion is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Keywords 118
March 2016
Boundary
PrescribedMotion class
Example
To check if boundary prescribed motion b is blanked:
if (b.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the boundary prescribed motion.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for boundary prescribed motion b:
b.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the boundary prescribed motion.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy boundary prescribed motion b into boundary prescribed motion z:
var z = b.Copy();
March 2016
Keywords 119
PrescribedMotion class
Boundary
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for boundary prescribed motion b:
b.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first boundary prescribed motion in the model.
Arguments
Name Type
Description
Return type
PrescribedMotion object (or null if there are no boundary prescribed motions in the model).
Example
To get the first boundary prescribed motion in model m:
var b = PrescribedMotion.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
PrescribedMotion label.
Keywords 120
March 2016
Boundary
PrescribedMotion class
Example
To get the first free boundary prescribed motion label in model m:
var label = PrescribedMotion.FirstFreeLabel(m);
Arguments
Name Type
Description
Model Model Model that all boundary prescribed motions will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the boundary prescribed motions with flag f in model m:
PrescribedMotion.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the boundary prescribed motion is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if boundary prescribed motion b has flag f set on it:
if (b.Flagged(f) ) do_something...
March 2016
Keywords 121
PrescribedMotion class
Boundary
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the boundary prescribed motions in model m:
PrescribedMotion.ForEach(m, test);
function test(b)
{
// b is PrescribedMotion object
}
To call function test for all of the boundary prescribed motions in model m with optional object:
var data = { x:0, y:0 };
PrescribedMotion.ForEach(m, test, data);
function test(b, extra)
{
// b is PrescribedMotion object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of PrescribedMotion objects for all of the boundary prescribed motions in a model in Primer
Arguments
Name Type
Description
Return type
Array of PrescribedMotion objects
Example
To make an array of PrescribedMotion objects for all of the boundary prescribed motions in model m
var b = PrescribedMotion.GetAll(m);
Keywords 122
March 2016
Boundary
PrescribedMotion class
Arguments
Name Type
Description
Flag
Flag set on the boundary prescribed motions that you want to retrieve
Return type
Array of PrescribedMotion objects
Example
To make an array of PrescribedMotion objects for all of the boundary prescribed motions in model m flagged with f
var b = PrescribedMotion.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the boundary prescribed motion you want the PrescribedMotion object for
Return type
PrescribedMotion object (or null if boundary prescribed motion does not exist).
Example
To get the PrescribedMotion object for boundary prescribed motion 100 in model m
var b = PrescribedMotion.GetFromID(m, 100);
Arguments
Name Type
prop
Description
boundary prescribed motion property boundary prescribed motion property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
March 2016
Keywords 123
PrescribedMotion class
Boundary
Example
To check if PrescribedMotion property b.example is a parameter:
Options.property_parameter_names = true;
if (b.GetParameter(b.example) ) do_something...
Options.property_parameter_names = false;
To check if PrescribedMotion property b.example is a parameter by using the GetParameter method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Keyword()
Description
Returns the keyword for this PrescribedMotion (*BOUNDARY_PRESCRIBED_MOTION_xxxx). Note that a
carriage return is not added. See also PrescribedMotion.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for PrescribedMotion pm:
var key = pm.Keyword();
KeywordCards()
Description
Returns the keyword cards for the PrescribedMotion. Note that a carriage return is not added. See also
PrescribedMotion.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for PrescribedMotion pm:
var cards = pm.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last boundary prescribed motion in the model.
Arguments
Name Type
Description
March 2016
Boundary
PrescribedMotion class
Return type
PrescribedMotion object (or null if there are no boundary prescribed motions in the model).
Example
To get the last boundary prescribed motion in model m:
var b = PrescribedMotion.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
PrescribedMotion label.
Example
To get the last free boundary prescribed motion label in model m:
var label = PrescribedMotion.LastFreeLabel(m);
Next()
Description
Returns the next boundary prescribed motion in the model.
Arguments
No arguments
Return type
PrescribedMotion object (or null if there are no more boundary prescribed motions in the model).
Example
To get the boundary prescribed motion in model m after boundary prescribed motion b:
var b = b.Next();
March 2016
Keywords 125
PrescribedMotion class
Boundary
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
PrescribedMotion label.
Example
To get the next free boundary prescribed motion label in model m:
var label = PrescribedMotion.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the PrescribedMotion can be picked from any
model.
modal
(optional)
boolean 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.
Return type
PrescribedMotion object (or null if not picked)
Example
To pick a PrescribedMotion from model m giving the prompt Pick PrescribedMotion from screen:
var pm = PrescribedMotion.Pick(Pick PrescribedMotion from screen, m);
Previous()
Description
Returns the previous boundary prescribed motion in the model.
Arguments
No arguments
Return type
PrescribedMotion object (or null if there are no more boundary prescribed motions in the model).
Keywords 126
March 2016
Boundary
PrescribedMotion class
Example
To get the boundary prescribed motion in model m before boundary prescribed motion b:
var b = b.Previous();
Arguments
Name Type
Description
Model Model Model that all boundary prescribed motions will be renumbered in
start
Return type
No return value
Example
To renumber all of the boundary prescribed motions in model m, from 1000000:
PrescribedMotion.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged boundary prescribed motions will be renumbered in
flag
Flag
Flag set on the boundary prescribed motions that you want to renumber
start
Return type
No return value
Example
To renumber all of the boundary prescribed motions in model m flagged with f, from 1000000:
PrescribedMotion.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 127
PrescribedMotion class
Boundary
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only boundary prescribed motions from that model can be
Flag
selected. If the argument is a Flag then only boundary prescribed motions that are flagged
with limit can be selected (limit should be different to flag). If omitted, or null, any boundary
prescribed motions can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of boundary prescribed motions selected or null if menu cancelled
Example
To select boundary prescribed motions from model m, flagging those selected with flag f, giving the prompt Select
boundary prescribed motions:
PrescribedMotion.Select(f, Select boundary prescribed motions, m);
To select boundary prescribed motions, flagging those selected with flag f but limiting selection to boundary prescribed
motions flagged with flag l, giving the prompt Select boundary prescribed motions:
PrescribedMotion.Select(f, Select boundary prescribed motions, l);
SetFlag(flag[Flag])
Description
Sets a flag on the boundary prescribed motion.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for boundary prescribed motion b:
b.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the boundary prescribed motion. The boundary prescribed motion will be sketched until you either call
PrescribedMotion.Unsketch(), PrescribedMotion.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 128
March 2016
Boundary
PrescribedMotion class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the boundary prescribed motion is sketched. If omitted
redraw is true. If you want to sketch several boundary prescribed motions and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch boundary prescribed motion b:
b.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing boundary prescribed motions should be counted. If false or omitted
referenced but undefined boundary prescribed motions will also be included in the total.
Return type
number of boundary prescribed motions
Example
To get the total number of boundary prescribed motions in model m:
var total = PrescribedMotion.Total(m);
Unblank()
Description
Unblanks the boundary prescribed motion
Arguments
No arguments
Return type
No return value
Example
To unblank boundary prescribed motion b:
b.Unblank();
March 2016
Keywords 129
PrescribedMotion class
Boundary
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boundary prescribed motions in model m:
PrescribedMotion.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the boundary prescribed motions that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boundary prescribed motions in model m flagged with f:
PrescribedMotion.UnblankFlagged(m, f);
Keywords 130
March 2016
Boundary
PrescribedMotion class
Arguments
Name Type
Description
Model Model Model that the defined flag for all boundary prescribed motions will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the boundary prescribed motions in model m:
PrescribedMotion.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the boundary prescribed motion.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the boundary prescribed motion is unsketched. If
omitted redraw is true. If you want to unsketch several boundary prescribed motions and only
redraw after the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch boundary prescribed motion b:
b.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the boundary prescribed motions 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().
Return type
No return value
March 2016
Keywords 131
PrescribedMotion class
Boundary
Example
To unsketch all boundary prescribed motions in model m:
PrescribedMotion.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
PrescribedMotion object.
Example
To check if PrescribedMotion property b.example is a parameter by using the PrescribedMotion.GetParameter()
method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for boundary prescribed motion b:
b.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this boundary prescribed motion.
Arguments
No arguments
Keywords 132
March 2016
Boundary
PrescribedMotion class
Return type
Xrefs object.
Example
To get the cross references for boundary prescribed motion b:
var xrefs = b.Xrefs();
toString()
Description
Creates a string containing the PrescribedMotion data in keyword format. Note that this contains the keyword header
and the keyword cards. See also PrescribedMotion.Keyword() and PrescribedMotion.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for PrescribedMotion pm in keyword format
var s = pm.toString();
March 2016
Keywords 133
Spc class
Boundary
Spc class
The Spc class gives you access to define spc cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[boundary SPC property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(type[integer])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Spc constants
Name
Description
SPC is *BOUNDARY_SPC_SET.
Spc properties
Name
Type
Description
cid
integer
Coordinate system ID
dofrx
integer
Keywords 134
March 2016
Boundary
dofry
integer
dofrz
integer
dofx
integer
dofy
integer
dofz
integer
exists
logical
true if spc exists, false if referred to but not defined. (read only)
heading string
Spc heading
id
logical
include integer
label
integer
Spc number.
model
integer
nid
integer
type
Spc class
Type
Description
float
death
float
Detailed Description
The Spc class allows you to create, modify, edit and manipulate spc cards. See the documentation below for more
details.
Constructor
new Spc(Model[Model], nid[integer], cid[integer], dofx[integer], dofy[integer],
dofz[integer], dofrx[integer], dofry[integer], dofrz[integer], type[constant], id
(optional)[integer], heading (optional)[string])
Description
Create a new Spc object.
March 2016
Keywords 135
Spc class
Boundary
Arguments
Name
Type
Description
Model
Model
nid
integer
cid
integer
Coordinate system ID
dofx
integer
dofy
integer
dofz
integer
dofrx
integer
dofry
integer
dofrz
integer
type
id (optional)
integer
Spc number
Title for the spc
Return type
Spc object
Example
To create a new boundary spc in model m with label 200, of type SET
var b = new Spc(m, 200, 0, 1, 0, 0, 1, 0, 0, Spc.SET, 200);
Details of functions
Blank()
Description
Blanks the boundary SPC
Arguments
No arguments
Return type
No return value
Example
To blank boundary SPC s:
s.Blank();
Keywords 136
March 2016
Boundary
Spc class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boundary SPCs in model m:
Spc.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boundary SPCs in model m flagged with f:
Spc.BlankFlagged(m, f);
Blanked()
Description
Checks if the boundary SPC is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
March 2016
Keywords 137
Spc class
Boundary
Example
To check if boundary SPC s is blanked:
if (s.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the boundary SPC.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for boundary SPC s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the boundary SPC.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy boundary SPC s into boundary SPC z:
var z = s.Copy();
Keywords 138
March 2016
Boundary
Spc class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for boundary SPC s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first boundary SPC in the model.
Arguments
Name Type
Description
Return type
Spc object (or null if there are no boundary SPCs in the model).
Example
To get the first boundary SPC in model m:
var s = Spc.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Spc label.
March 2016
Keywords 139
Spc class
Boundary
Example
To get the first free boundary SPC label in model m:
var label = Spc.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the boundary SPCs with flag f in model m:
Spc.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the boundary SPC is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if boundary SPC s has flag f set on it:
if (s.Flagged(f) ) do_something...
Keywords 140
March 2016
Boundary
Spc class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the boundary SPCs in model m:
Spc.ForEach(m, test);
function test(s)
{
// s is Spc object
}
To call function test for all of the boundary SPCs in model m with optional object:
var data = { x:0, y:0 };
Spc.ForEach(m, test, data);
function test(s, extra)
{
// s is Spc object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Spc objects for all of the boundary SPCs in a model in Primer
Arguments
Name Type
Description
Return type
Array of Spc objects
Example
To make an array of Spc objects for all of the boundary SPCs in model m
var s = Spc.GetAll(m);
March 2016
Keywords 141
Spc class
Boundary
Arguments
Name Type
Description
Flag
Return type
Array of Spc objects
Example
To make an array of Spc objects for all of the boundary SPCs in model m flagged with f
var s = Spc.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the boundary SPC you want the Spc object for
Return type
Spc object (or null if boundary SPC does not exist).
Example
To get the Spc object for boundary SPC 100 in model m
var s = Spc.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Keywords 142
March 2016
Boundary
Spc class
Example
To check if Spc property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Spc property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this spc (*BOUNDARY_SPC_xxxx). Note that a carriage return is not added. See also
Spc.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for spc s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the spc. Note that a carriage return is not added. See also Spc.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for spc s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last boundary SPC in the model.
Arguments
Name Type
Description
March 2016
Keywords 143
Spc class
Boundary
Return type
Spc object (or null if there are no boundary SPCs in the model).
Example
To get the last boundary SPC in model m:
var s = Spc.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Spc label.
Example
To get the last free boundary SPC label in model m:
var label = Spc.LastFreeLabel(m);
Next()
Description
Returns the next boundary SPC in the model.
Arguments
No arguments
Return type
Spc object (or null if there are no more boundary SPCs in the model).
Example
To get the boundary SPC in model m after boundary SPC s:
var s = s.Next();
Keywords 144
March 2016
Boundary
Spc class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Spc label.
Example
To get the next free boundary SPC label in model m:
var label = Spc.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the spc can be picked from any model.
modal
(optional)
boolean 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.
Return type
Spc object (or null if not picked)
Example
To pick a spc from model m giving the prompt Pick spc from screen:
var spc = Spc.Pick(Pick spc from screen, m);
Previous()
Description
Returns the previous boundary SPC in the model.
Arguments
No arguments
Return type
Spc object (or null if there are no more boundary SPCs in the model).
March 2016
Keywords 145
Spc class
Boundary
Example
To get the boundary SPC in model m before boundary SPC s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the boundary SPCs in model m, from 1000000:
Spc.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged boundary SPCs will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the boundary SPCs in model m flagged with f, from 1000000:
Spc.RenumberFlagged(m, f, 1000000);
Keywords 146
March 2016
Boundary
Spc class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only boundary SPCs from that model can be selected. If the
Flag
argument is a Flag then only boundary SPCs that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any boundary SPCs can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of boundary SPCs selected or null if menu cancelled
Example
To select boundary SPCs from model m, flagging those selected with flag f, giving the prompt Select boundary SPCs:
Spc.Select(f, Select boundary SPCs, m);
To select boundary SPCs, flagging those selected with flag f but limiting selection to boundary SPCs flagged with flag
l, giving the prompt Select boundary SPCs:
Spc.Select(f, Select boundary SPCs, l);
SetFlag(flag[Flag])
Description
Sets a flag on the boundary SPC.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for boundary SPC s:
s.SetFlag(f);
Sketch(type[integer])
Description
Sketches the Boundary SPC. The SPC will be sketched until you do a graphics update or delete the model
Arguments
Name Type
type
Description
March 2016
Keywords 147
Spc class
Boundary
Return type
No return value
Example
To sketch SPC s - Translational constraint
s.Sketch(1);
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing boundary SPCs should be counted. If false or omitted referenced but
undefined boundary SPCs will also be included in the total.
Return type
number of boundary SPCs
Example
To get the total number of boundary SPCs in model m:
var total = Spc.Total(m);
Unblank()
Description
Unblanks the boundary SPC
Arguments
No arguments
Return type
No return value
Example
To unblank boundary SPC s:
s.Unblank();
Keywords 148
March 2016
Boundary
Spc class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boundary SPCs in model m:
Spc.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boundary SPCs in model m flagged with f:
Spc.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all boundary SPCs will be unset in
flag
Flag
Return type
No return value
March 2016
Keywords 149
Spc class
Boundary
Example
To unset the flag f on all the boundary SPCs in model m:
Spc.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the Spc.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the boundary SPC is unsketched. If omitted redraw is
true. If you want to unsketch several boundary SPCs and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch SPC s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the SPCs 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().
Return type
No return value
Example
To unsketch all boundary SPCs in model m:
SPC.UnsketchAll(m);
ViewParameters()
Description
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.
Keywords 150
March 2016
Boundary
Spc class
Arguments
No arguments
Return type
Spc object.
Example
To check if Spc property s.example is a parameter by using the Spc.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for boundary SPC s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this boundary SPC.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for boundary SPC s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the spc data in keyword format. Note that this contains the keyword header and the keyword
cards. See also Spc.Keyword() and Spc.KeywordCards().
March 2016
Keywords 151
Spc class
Boundary
Arguments
No arguments
Return type
string
Example
To get data for spc s in keyword format
var str = s.toString();
Keywords 152
March 2016
Constrained
ExtraNodes class
ExtraNodes class
The ExtraNodes class gives you access to constrained extra nodes cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[constrained extra node property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
ExtraNodes constants
Name
Description
CNST is *CONSTRAINED_EXTRA_NODES_SET.
ExtraNodes properties
Name
Type
Description
exists
logical
true if constrained extra nodes exists, false if referred to but not defined (read only)
id
integer
iflag
logical
March 2016
Keywords 153
ExtraNodes class
Constrained
include integer
The Include file number that the constrained extra nodes is in.
label
integer
The label the constrained extra nodes has in PRIMER (read only)
model
integer
option constant The Constrained Extra Nodes option. Can be ExtraNodes.NODE or ExtraNodes.SET.
pid
integer
Detailed Description
The ExtraNodes class allows you to create, modify, edit and manipulate constrained extra nodes cards. See the
documentation below for more details.
Constructor
new ExtraNodes(Model[Model], option[constant], pid[integer], id[integer],
iflag[boolean])
Description
Create a new ExtraNodes object.
Arguments
Name Type
Description
Model Model
option constant Specify the type of constrained extra nodes. Can be ExtraNodes.NODE or ExtraNodes.SET)
pid
integer
id
integer
iflag
Return type
ExtraNodes object
Example
To create a new constrained extra nodes in model m, of type SET, with part 9, node set 18 and iflag 0
var e = new ExtraNodes(m, ExtraNodes.SET, 9, 18, 0);
Details of functions
Blank()
Description
Blanks the constrained extra node
Arguments
No arguments
Return type
No return value
Keywords 154
March 2016
Constrained
ExtraNodes class
Example
To blank constrained extra node en:
en.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the constrained extra nodes in model m:
ExtraNodes.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged constrained extra nodes will be blanked in
flag
Flag
Flag set on the constrained extra nodes that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the constrained extra nodes in model m flagged with f:
ExtraNodes.BlankFlagged(m, f);
Blanked()
Description
Checks if the constrained extra node is blanked or not.
March 2016
Keywords 155
ExtraNodes class
Constrained
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if constrained extra node en is blanked:
if (en.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse constrained extra node en:
en.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the constrained extra node.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for constrained extra node en:
en.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the constrained extra node.
Keywords 156
March 2016
Constrained
ExtraNodes class
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy constrained extra node en into constrained extra node z:
var z = en.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
ExtraNodes object (or null if not made)
Example
To start creating a constrained extra nodes card in model m:
var e = ExtraNodes.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit constrained extra node en:
en.Edit();
March 2016
Keywords 157
ExtraNodes class
Constrained
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for constrained extra node en:
en.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first constrained extra node in the model.
Arguments
Name Type
Description
Return type
ExtraNodes object (or null if there are no constrained extra nodes in the model).
Example
To get the first constrained extra node in model m:
var en = ExtraNodes.First(m);
Arguments
Name Type
Description
Model Model Model that all constrained extra nodes will be flagged in
flag
Flag
Return type
No return value
Keywords 158
March 2016
Constrained
ExtraNodes class
Example
To flag all of the constrained extra nodes with flag f in model m:
ExtraNodes.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the constrained extra node is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if constrained extra node en has flag f set on it:
if (en.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 159
ExtraNodes class
Constrained
Example
To call function test for all of the constrained extra nodes in model m:
ExtraNodes.ForEach(m, test);
function test(en)
{
// en is ExtraNodes object
}
To call function test for all of the constrained extra nodes in model m with optional object:
var data = { x:0, y:0 };
ExtraNodes.ForEach(m, test, data);
function test(en, extra)
{
// en is ExtraNodes object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of ExtraNodes objects for all of the constrained extra nodes in a model in Primer
Arguments
Name Type
Description
Return type
Array of ExtraNodes objects
Example
To make an array of ExtraNodes objects for all of the constrained extra nodes in model m
var en = ExtraNodes.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the constrained extra nodes that you want to retrieve
Return type
Array of ExtraNodes objects
Example
To make an array of ExtraNodes objects for all of the constrained extra nodes in model m flagged with f
var en = ExtraNodes.GetFlagged(m, f);
Keywords 160
March 2016
Constrained
ExtraNodes class
Arguments
Name
Type
Description
Model
number integer number of the constrained extra node you want the ExtraNodes object for
Return type
ExtraNodes object (or null if constrained extra node does not exist).
Example
To get the ExtraNodes object for constrained extra node 100 in model m
var en = ExtraNodes.GetFromID(m, 100);
Arguments
Name Type
prop
Description
constrained extra node property constrained extra node property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if ExtraNodes property en.example is a parameter:
Options.property_parameter_names = true;
if (en.GetParameter(en.example) ) do_something...
Options.property_parameter_names = false;
To check if ExtraNodes property en.example is a parameter by using the GetParameter method:
if (en.ViewParameters().GetParameter(en.example) ) do_something...
Keyword()
Description
Returns the keyword for this constrained extra nodes (*CONSTRAINED_EXTRA_NODES). Note that a carriage
return is not added. See also ExtraNodes.KeywordCards()
March 2016
Keywords 161
ExtraNodes class
Constrained
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for constrained extra nodes e:
var key = e.Keyword();
KeywordCards()
Description
Returns the keyword cards for the constrained extra nodes. Note that a carriage return is not added. See also
ExtraNodes.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for constrained extra nodes e:
var cards = e.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last constrained extra node in the model.
Arguments
Name Type
Description
Return type
ExtraNodes object (or null if there are no constrained extra nodes in the model).
Example
To get the last constrained extra node in model m:
var en = ExtraNodes.Last(m);
Next()
Description
Returns the next constrained extra node in the model.
Keywords 162
March 2016
Constrained
ExtraNodes class
Arguments
No arguments
Return type
ExtraNodes object (or null if there are no more constrained extra nodes in the model).
Example
To get the constrained extra node in model m after constrained extra node en:
var en = en.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the constrained extra nodes can be picked from
any model.
modal
(optional)
boolean 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.
Return type
ExtraNodes object (or null if not picked)
Example
To pick a constrained extra nodes from model m giving the prompt Pick constrained extra nodes from screen:
var extra_nodes = ExtraNodes.Pick(Pick constrained extra nodes from screen,
m);
Previous()
Description
Returns the previous constrained extra node in the model.
Arguments
No arguments
Return type
ExtraNodes object (or null if there are no more constrained extra nodes in the model).
Example
To get the constrained extra node in model m before constrained extra node en:
var en = en.Previous();
March 2016
Keywords 163
ExtraNodes class
Constrained
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only constrained extra nodes from that model can be selected.
Flag
If the argument is a Flag then only constrained extra nodes that are flagged with limit can be
selected (limit should be different to flag). If omitted, or null, any constrained extra nodes can
be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of constrained extra nodes selected or null if menu cancelled
Example
To select constrained extra nodes from model m, flagging those selected with flag f, giving the prompt Select
constrained extra nodes:
ExtraNodes.Select(f, Select constrained extra nodes, m);
To select constrained extra nodes, flagging those selected with flag f but limiting selection to constrained extra nodes
flagged with flag l, giving the prompt Select constrained extra nodes:
ExtraNodes.Select(f, Select constrained extra nodes, l);
SetFlag(flag[Flag])
Description
Sets a flag on the constrained extra node.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for constrained extra node en:
en.SetFlag(f);
Keywords 164
March 2016
Constrained
ExtraNodes class
Sketch(redraw (optional)[boolean])
Description
Sketches the constrained extra node. The constrained extra node will be sketched until you either call
ExtraNodes.Unsketch(), ExtraNodes.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the constrained extra node is sketched. If omitted
redraw is true. If you want to sketch several constrained extra nodes and only redraw after the
last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch constrained extra node en:
en.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing constrained extra nodes should be counted. If false or omitted referenced
but undefined constrained extra nodes will also be included in the total.
Return type
number of constrained extra nodes
Example
To get the total number of constrained extra nodes in model m:
var total = ExtraNodes.Total(m);
Unblank()
Description
Unblanks the constrained extra node
Arguments
No arguments
Return type
No return value
March 2016
Keywords 165
ExtraNodes class
Constrained
Example
To unblank constrained extra node en:
en.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the constrained extra nodes in model m:
ExtraNodes.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the constrained extra nodes that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the constrained extra nodes in model m flagged with f:
ExtraNodes.UnblankFlagged(m, f);
Keywords 166
March 2016
Constrained
ExtraNodes class
Arguments
Name Type
Description
Model Model Model that the defined flag for all constrained extra nodes will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the constrained extra nodes in model m:
ExtraNodes.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the constrained extra node.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the constrained extra node is unsketched. If omitted
redraw is true. If you want to unsketch several constrained extra nodes and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch constrained extra node en:
en.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the constrained extra nodes 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().
Return type
No return value
March 2016
Keywords 167
ExtraNodes class
Constrained
Example
To unsketch all constrained extra nodes in model m:
ExtraNodes.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
ExtraNodes object.
Example
To check if ExtraNodes property en.example is a parameter by using the ExtraNodes.GetParameter() method:
if (en.ViewParameters().GetParameter(en.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for constrained extra node en:
en.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this constrained extra node.
Arguments
No arguments
Keywords 168
March 2016
Constrained
ExtraNodes class
Return type
Xrefs object.
Example
To get the cross references for constrained extra node en:
var xrefs = en.Xrefs();
toString()
Description
Creates a string containing the constrained extra nodes data in keyword format. Note that this contains the keyword
header and the keyword cards. See also ExtraNodes.Keyword() and ExtraNodes.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for constrained extra nodes e in keyword format
var s = e.toString();
March 2016
Keywords 169
Constrained
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetCombinedData(index[integer])
GetCrossFilletData(index[integer])
GetFailureData() [deprecated]
GetNodalPair() [deprecated]
GetParameter(prop[generalized weld property])
Keyword()
KeywordCards()
Next()
Previous()
SetCombinedData(index[integer], data[array])
SetCrossFilletData(index[integer], data[array])
SetFailureData() [deprecated]
SetFlag(flag[Flag])
SetNodalPair() [deprecated]
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
GeneralizedWeld constants
Name
Description
GeneralizedWeld.BUTT
GeneralizedWeld is *CONSTRAINED_GENERALIZED_WELD_BUTT.
Keywords 170
March 2016
Constrained
GeneralizedWeld.COMBINED
GeneralizedWeld is *CONSTRAINED_GENERALIZED_WELD_COMBINED.
GeneralizedWeld.CROSS_
FILLET
GeneralizedWeld is *CONSTRAINED_GENERALIZED_WELD_CROSS_
FILLET.
GeneralizedWeld.FILLET
GeneralizedWeld is *CONSTRAINED_GENERALIZED_WELD_FILLET.
GeneralizedWeld.SPOT
GeneralizedWeld is *CONSTRAINED_GENERALIZED_WELD_SPOT.
GeneralizedWeld properties
Name
Type
Description
float
alpha
float
beta
float
cid
integer
float
epsf
float
exists
logical
true if gwld exists, false if referred to but not defined. (read only)
filter
integer
id
logical
include integer
float
label
integer
lt
float
float
model
integer
float
npr
integer
nprt
integer
Printout option.
nsid
integer
option
sigf
float
sigy
float
sn
float
ss
float
tfail
float
float
wid
integer
window float
Keywords 171
Constrained
Detailed Description
The GeneralizedWeld class allows you to create, modify, edit and manipulate generalized weld cards. See the
documentation below for more details.
For convenience "Gwld" can also be used as the class name instead of "GeneralizedWeld".
Constructor
new GeneralizedWeld(Model[Model], option[constant], nsid[integer], cid
(optional)[integer], filter (optional)[integer], window (optional)[float], npr
(optional)[integer], nprt (optional)[integer], wid (optional)[integer])
Description
Create a new GeneralizedWeld object.
Arguments
Name
Type
Description
Model
Model
option
nsid
integer
cid (optional)
integer
filter (optional)
integer
npr (optional)
integer
nprt (optional)
integer
Printout option.
wid (optional)
integer
Return type
GeneralizedWeld object
Example
To create a new gwld 1000 of type SPOT in model m with specifiction: nsid, cid, filter, window, nprt are 91, 92, 81,
0.5, 82 respectively
var w = new GeneralizedWeld(m, GeneralizedWeld.SPOT, 91, 92, 81, 0.5, 82, 1000);
Details of functions
Blank()
Description
Blanks the generalized weld
Arguments
No arguments
Return type
No return value
Keywords 172
March 2016
Constrained
Example
To blank generalized weld gw:
gw.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the generalized welds in model m:
GeneralizedWeld.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the generalized welds in model m flagged with f:
GeneralizedWeld.BlankFlagged(m, f);
Blanked()
Description
Checks if the generalized weld is blanked or not.
March 2016
Keywords 173
Constrained
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if generalized weld gw is blanked:
if (gw.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse generalized weld gw:
gw.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the generalized weld.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for generalized weld gw:
gw.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the generalized weld.
Keywords 174
March 2016
Constrained
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy generalized weld gw into generalized weld z:
var z = gw.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
GeneralizedWeld object (or null if not made)
Example
To start creating a generalized weld in model m:
var gw = GeneralizedWeld.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit generalized weld gw:
gw.Edit();
March 2016
Keywords 175
Constrained
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for generalized weld gw:
gw.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first generalized weld in the model.
Arguments
Name Type
Description
Return type
GeneralizedWeld object (or null if there are no generalized welds in the model).
Example
To get the first generalized weld in model m:
var gw = GeneralizedWeld.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Keywords 176
March 2016
Constrained
Return type
GeneralizedWeld label.
Example
To get the first free generalized weld label in model m:
var label = GeneralizedWeld.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the generalized welds with flag f in model m:
GeneralizedWeld.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the generalized weld is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if generalized weld gw has flag f set on it:
if (gw.Flagged(f) ) do_something...
March 2016
Keywords 177
Constrained
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the generalized welds in model m:
GeneralizedWeld.ForEach(m, test);
function test(gw)
{
// gw is GeneralizedWeld object
}
To call function test for all of the generalized welds in model m with optional object:
var data = { x:0, y:0 };
GeneralizedWeld.ForEach(m, test, data);
function test(gw, extra)
{
// gw is GeneralizedWeld object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of GeneralizedWeld objects for all of the generalized welds in a model in Primer
Arguments
Name Type
Description
Return type
Array of GeneralizedWeld objects
Example
To make an array of GeneralizedWeld objects for all of the generalized welds in model m
var gw = GeneralizedWeld.GetAll(m);
Keywords 178
March 2016
Constrained
GetCombinedData(index[integer])
Description
Returns the combined data for a specific nodal pair as an array.
Arguments
Name Type
Description
index integer Index you want the data for. Note that indices start at 0.
Return type
An array containing the data (tfail, epsf, sigy, beta, l, w, a, alpha, nodea, nodeb, ncid, wtyp).
Example
To get the data for the 3rd node pair for generalized weld gw:
var data = gw.GetCombinedData(2);
GetCrossFilletData(index[integer])
Description
Returns the cross fillet data for a specific nodal pair as an array.
Arguments
Name Type
Description
index integer Index you want the data for. Note that indices start at 0.
Return type
An array containing the data (nodea, nodeb, ncid).
Example
To get the data for the 3rd node pair for generalized weld gw:
var data = gw.GetCrossFilletData(2);
GetFailureData() [deprecated]
This function is deprecated in version 11.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.
Access the properties directly or use GeneralizedWeld.GetCombinedData() for GeneralizedWeld.COMBINED instead.
March 2016
Keywords 179
Constrained
Arguments
Name Type
Description
Flag
Return type
Array of GeneralizedWeld objects
Example
To make an array of GeneralizedWeld objects for all of the generalized welds in model m flagged with f
var gw = GeneralizedWeld.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the generalized weld you want the GeneralizedWeld object for
Return type
GeneralizedWeld object (or null if generalized weld does not exist).
Example
To get the GeneralizedWeld object for generalized weld 100 in model m
var gw = GeneralizedWeld.GetFromID(m, 100);
GetNodalPair() [deprecated]
This function is deprecated in version 11.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.
Use GeneralizedWeld.GetCombinedData() for GeneralizedWeld.COMBINED or
GeneralizedWeld.GetCrossFilletData() for GeneralizedWeld.CROSS_FILLET instead.
Keywords 180
March 2016
Constrained
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if GeneralizedWeld property gw.example is a parameter:
Options.property_parameter_names = true;
if (gw.GetParameter(gw.example) ) do_something...
Options.property_parameter_names = false;
To check if GeneralizedWeld property gw.example is a parameter by using the GetParameter method:
if (gw.ViewParameters().GetParameter(gw.example) ) do_something...
Keyword()
Description
Returns the keyword for this gwld (*CONSTRAINED_GENERALIZED_WELD_xxxx). Note that a carriage return
is not added. See also GeneralizedWeld.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for generalized weld gw:
var key = gw.Keyword();
KeywordCards()
Description
Returns the keyword cards for the gwld. Note that a carriage return is not added. See also
GeneralizedWeld.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for generalized weld gw:
var cards = gw.KeywordCards();
March 2016
Keywords 181
Constrained
Last(Model[Model]) [static]
Description
Returns the last generalized weld in the model.
Arguments
Name Type
Description
Return type
GeneralizedWeld object (or null if there are no generalized welds in the model).
Example
To get the last generalized weld in model m:
var gw = GeneralizedWeld.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
GeneralizedWeld label.
Example
To get the last free generalized weld label in model m:
var label = GeneralizedWeld.LastFreeLabel(m);
Next()
Description
Returns the next generalized weld in the model.
Arguments
No arguments
Return type
GeneralizedWeld object (or null if there are no more generalized welds in the model).
Keywords 182
March 2016
Constrained
Example
To get the generalized weld in model m after generalized weld gw:
var gw = gw.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
GeneralizedWeld label.
Example
To get the next free generalized weld label in model m:
var label = GeneralizedWeld.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the gwld can be picked from any model.
modal
(optional)
boolean 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.
Return type
GeneralizedWeld object (or null if not picked)
Example
To pick a generalized weld from model m giving the prompt Pick gwld from screen:
var gwld = GeneralizedWeld.Pick(Pick gwld from screen, m);
March 2016
Keywords 183
Constrained
Previous()
Description
Returns the previous generalized weld in the model.
Arguments
No arguments
Return type
GeneralizedWeld object (or null if there are no more generalized welds in the model).
Example
To get the generalized weld in model m before generalized weld gw:
var gw = gw.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the generalized welds in model m, from 1000000:
GeneralizedWeld.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged generalized welds will be renumbered in
flag
Flag
start
Return type
No return value
Keywords 184
March 2016
Constrained
Example
To renumber all of the generalized welds in model m flagged with f, from 1000000:
GeneralizedWeld.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only generalized welds from that model can be selected. If the
Flag
argument is a Flag then only generalized welds that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any generalized welds can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of generalized welds selected or null if menu cancelled
Example
To select generalized welds from model m, flagging those selected with flag f, giving the prompt Select generalized
welds:
GeneralizedWeld.Select(f, Select generalized welds, m);
To select generalized welds, flagging those selected with flag f but limiting selection to generalized welds flagged with
flag l, giving the prompt Select generalized welds:
GeneralizedWeld.Select(f, Select generalized welds, l);
SetCombinedData(index[integer], data[array])
Description
Sets the combined data for a specific nodal pair.
Arguments
Name Type
Description
index integer Index you want to set the data for. Note that indices start at 0.
data
array
Array containing the data. The array length should be 12 (tfail, epsf, sigy, beta, l, w, a, alpha, nodea,
nodeb, ncid, wtyp)
Return type
No return value.
March 2016
Keywords 185
Constrained
Example
To set the data for the 3rd nodal pair for generalized weld gw to the values in array adata:
gw.SetCombinedData(2, adata);
SetCrossFilletData(index[integer], data[array])
Description
Sets the cross fillet data for a specific nodal pair.
Arguments
Name Type
Description
index integer Index you want to set the data for. Note that indices start at 0.
data
array
Array containing the data. The array length should be 3 (nodea, nodeb, ncid)
Return type
No return value.
Example
To set the data for the 3rd nodal pair for generalized weld gw to the values in array adata:
gw.SetCrossFilletData(2, adata);
SetFailureData() [deprecated]
This function is deprecated in version 11.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.
Access the properties directly or use GeneralizedWeld.SetCombinedData() for GeneralizedWeld.COMBINED instead.
SetFlag(flag[Flag])
Description
Sets a flag on the generalized weld.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for generalized weld gw:
gw.SetFlag(f);
Keywords 186
March 2016
Constrained
SetNodalPair() [deprecated]
This function is deprecated in version 11.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.
Use GeneralizedWeld.SetCombinedData() for GeneralizedWeld.COMBINED or GeneralizedWeld.SetCrossFilletData()
for GeneralizedWeld.CROSS_FILLET instead.
Sketch(redraw (optional)[boolean])
Description
Sketches the generalized weld. The generalized weld will be sketched until you either call GeneralizedWeld.Unsketch(),
GeneralizedWeld.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the generalized weld is sketched. If omitted redraw is
true. If you want to sketch several generalized welds and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch generalized weld gw:
gw.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing generalized welds should be counted. If false or omitted referenced but
undefined generalized welds will also be included in the total.
Return type
number of generalized welds
Example
To get the total number of generalized welds in model m:
var total = GeneralizedWeld.Total(m);
Unblank()
Description
Unblanks the generalized weld
March 2016
Keywords 187
Constrained
Arguments
No arguments
Return type
No return value
Example
To unblank generalized weld gw:
gw.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the generalized welds in model m:
GeneralizedWeld.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Keywords 188
March 2016
Constrained
Example
To unblank all of the generalized welds in model m flagged with f:
GeneralizedWeld.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all generalized welds will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the generalized welds in model m:
GeneralizedWeld.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the generalized weld.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the generalized weld is unsketched. If omitted redraw
is true. If you want to unsketch several generalized welds and only redraw after the last one
then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch generalized weld gw:
gw.Unsketch();
March 2016
Keywords 189
Constrained
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the generalized welds 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().
Return type
No return value
Example
To unsketch all generalized welds in model m:
GeneralizedWeld.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
GeneralizedWeld object.
Example
To check if GeneralizedWeld property gw.example is a parameter by using the GeneralizedWeld.GetParameter()
method:
if (gw.ViewParameters().GetParameter(gw.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Keywords 190
March 2016
Constrained
Example
To add a warning message "My custom warning" for generalized weld gw:
gw.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this generalized weld.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for generalized weld gw:
var xrefs = gw.Xrefs();
toString()
Description
Creates a string containing the gwld data in keyword format. Note that this contains the keyword header and the
keyword cards. See also GeneralizedWeld.Keyword() and GeneralizedWeld.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for generalized weld gw in keyword format
var s = gw.toString();
March 2016
Keywords 191
Joint class
Constrained
Joint class
The Joint class gives you access to constrained joint cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[joint property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Joint constants
Name
Description
Joint.CONSTANT_VELOCITY
CONSTANT_VELOCITY is *CONSTRAINED_JOINT_CONSTANT_
VELOCITY.
Joint.CYLINDRICAL
CYLINDRICAL is *CONSTRAINED_JOINT_CYLINDRICAL.
Joint.GEARS
GEARS is *CONSTRAINED_JOINT_GEARS.
Joint.LOCKING
LOCKING is *CONSTRAINED_JOINT_LOCKING.
Joint.PLANAR
PLANAR is *CONSTRAINED_JOINT_PLANAR.
Keywords 192
March 2016
Constrained
Joint class
Joint.PULLEY
PULLEY is *CONSTRAINED_JOINT_PULLEY.
Joint.RACK_AND_PINION
RACK_AND_PINION is *CONSTRAINED_JOINT_RACK_AND_PINION.
Joint.REVOLUTE
REVOLUTE is *CONSTRAINED_JOINT_REVOLUTE.
Joint.ROTATIONAL_MOTOR
ROTATIONAL_MOTOR is *CONSTRAINED_JOINT_ROTATIONAL_
MOTOR.
Joint.SCREW
SCREW is *CONSTRAINED_JOINT_SCREW.
Joint.SPHERICAL
SPHERICAL is *CONSTRAINED_JOINT_SPHERICAL.
Joint.TRANSLATIONAL
TRANSLATIONAL is *CONSTRAINED_JOINT_TRANSLATIONAL.
Joint.TRANSLATIONAL_
MOTOR
TRANSLATIONAL_MOTOR is *CONSTRAINED_JOINT_
TRANSLATIONAL_MOTOR.
Joint.UNIVERSAL
UNIVERSAL is *CONSTRAINED_JOINT_UNIVERSAL.
Joint properties
Name
Type
Description
cid
integer
coupl
float
damp
float
exists
logical
true if constrained joint exists, false if referred to but not defined. (read only)
failure
logical
h_angle float
heading string
id
logical
include integer
jid
integer
label
integer
lcid
integer
Loadcuve number.
local
logical
lst
integer
model
integer
mxx
float
myy
float
mzz
float
n1
integer
Node number 1.
n2
integer
Node number 2.
n3
integer
Node number 3.
n4
integer
Node number 4.
n5
integer
Node number 5.
n6
integer
Node number 6.
nxx
float
March 2016
Keywords 193
Joint class
Constrained
nyy
float
nzz
float
option
parm
float
r1
float
raid
integer
rps
float
tfail
float
type
integer
Detailed Description
The Joint class allows you to create, modify, edit and manipulate constrained joint cards. See the documentation below
for more details.
Constructor
new Joint(Model[Model], option[constant], n1[integer], n2[integer], jid
(optional)[integer], heading (optional)[string])
Description
Create a new Joint object.
Arguments
Name
Type
Description
Model
Model
option
n1
integer
Node 1.
n2
integer
Node 2.
jid (optional)
integer
Return type
Joint object
Example
To create a new constrained joint 500 called "test spherical joint" of type _SPHERICAL in model m with nodes 50 and
150
var j = new Joint(m, Joint.SPHERICAL, 50, 150, 500, "test spherical joint");
To create a new constrained joint 500 called "test revolute joint" of type _REVOLUTE in model m with nodes 50, 100,
150 and 200
var j = new Joint(m, Joint.REVOLUTE, 50, 100, 500, "test revolute joint");
j.n3 = 150;
j.n4 = 200;
Keywords 194
March 2016
Constrained
Joint class
Arguments
Name
Type
Description
Model
Model
option
n1
integer
Node 1.
n2
integer
Node 2.
n3
integer
Node 3.
n4
integer
Node 4.
jid (optional)
integer
heading
(optional)
string
Return type
Joint object
Example
To create a new constrained joint 500 called "test revolute joint" of type _REVOLUTE in model m with nodes 50, 100,
150 and 200
var j = new Joint(m, Joint.REVOLUTE, 50, 100, 150, 200, 500, "test revolute
joint");
March 2016
Keywords 195
Joint class
Constrained
Arguments
Name
Type
Description
Model
Model
option
n1
integer
Node 1.
n2
integer
Node 2.
n3
integer
Node 3.
n4
integer
Node 4.
n5
integer
Node 5.
n6
integer
Node 6.
jid
(optional)
integer
heading
(optional)
string
Return type
Joint object
Example
To create a new constrained joint 500 called "test translational joint" of type _TRANSLATIONAL in model m with
nodes 50, 100, 150, 300, 250 and 300
var j = new Joint(m, Joint.TRANSLATIONAL, 50, 100, 150, 200, 250, 300, 500,
"test translational joint");
Details of functions
Blank()
Description
Blanks the joint
Arguments
No arguments
Return type
No return value
Example
To blank joint j:
j.Blank();
Keywords 196
March 2016
Constrained
Joint class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the joints in model m:
Joint.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the joints in model m flagged with f:
Joint.BlankFlagged(m, f);
Blanked()
Description
Checks if the joint is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
March 2016
Keywords 197
Joint class
Constrained
Example
To check if joint j is blanked:
if (j.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse joint j:
j.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the joint.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for joint j:
j.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the joint.
Arguments
Name
Type
range
(optional)
boolean 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() .
Keywords 198
Description
March 2016
Constrained
Joint class
Return type
Return class object
Example
To copy joint j into joint z:
var z = j.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Joint object (or null if not made)
Example
To start creating a joint in model n:
var j = Joint.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit joint j:
j.Edit();
March 2016
Keywords 199
Joint class
Constrained
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for joint j:
j.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first joint in the model.
Arguments
Name Type
Description
Return type
Joint object (or null if there are no joints in the model).
Example
To get the first joint in model m:
var j = Joint.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Joint label.
Keywords 200
March 2016
Constrained
Joint class
Example
To get the first free joint label in model m:
var label = Joint.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the joints with flag f in model m:
Joint.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the joint is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if joint j has flag f set on it:
if (j.Flagged(f) ) do_something...
March 2016
Keywords 201
Joint class
Constrained
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the joints in model m:
Joint.ForEach(m, test);
function test(j)
{
// j is Joint object
}
To call function test for all of the joints in model m with optional object:
var data = { x:0, y:0 };
Joint.ForEach(m, test, data);
function test(j, extra)
{
// j is Joint object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Joint objects for all of the joints in a model in Primer
Arguments
Name Type
Description
Return type
Array of Joint objects
Example
To make an array of Joint objects for all of the joints in model m
var j = Joint.GetAll(m);
Keywords 202
March 2016
Constrained
Joint class
Arguments
Name Type
Description
Flag
Return type
Array of Joint objects
Example
To make an array of Joint objects for all of the joints in model m flagged with f
var j = Joint.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the joint you want the Joint object for
Return type
Joint object (or null if joint does not exist).
Example
To get the Joint object for joint 100 in model m
var j = Joint.GetFromID(m, 100);
GetParameter(prop[joint property])
Description
Checks if a Joint 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 Joint.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
March 2016
Keywords 203
Joint class
Constrained
Example
To check if Joint property j.example is a parameter:
Options.property_parameter_names = true;
if (j.GetParameter(j.example) ) do_something...
Options.property_parameter_names = false;
To check if Joint property j.example is a parameter by using the GetParameter method:
if (j.ViewParameters().GetParameter(j.example) ) do_something...
Keyword()
Description
Returns the keyword for this joint (*CONSTRAINED_JOINT). Note that a carriage return is not added. See also
Joint.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for joint j:
var key = j.Keyword();
KeywordCards()
Description
Returns the keyword cards for the joint. Note that a carriage return is not added. See also Joint.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for joint j:
var cards = j.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last joint in the model.
Arguments
Name Type
Description
Keywords 204
March 2016
Constrained
Joint class
Return type
Joint object (or null if there are no joints in the model).
Example
To get the last joint in model m:
var j = Joint.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Joint label.
Example
To get the last free joint label in model m:
var label = Joint.LastFreeLabel(m);
Next()
Description
Returns the next joint in the model.
Arguments
No arguments
Return type
Joint object (or null if there are no more joints in the model).
Example
To get the joint in model m after joint j:
var j = j.Next();
March 2016
Keywords 205
Joint class
Constrained
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Joint label.
Example
To get the next free joint label in model m:
var label = Joint.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the joint can be picked from any model.
modal
(optional)
boolean 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.
Return type
Joint object (or null if not picked)
Example
To pick a joint from model m giving the prompt Pick joint from screen:
var joint = Joint.Pick(Pick joint from screen, m);
Previous()
Description
Returns the previous joint in the model.
Arguments
No arguments
Return type
Joint object (or null if there are no more joints in the model).
Keywords 206
March 2016
Constrained
Joint class
Example
To get the joint in model m before joint j:
var j = j.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the joints in model m, from 1000000:
Joint.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged joints will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the joints in model m flagged with f, from 1000000:
Joint.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 207
Joint class
Constrained
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only joints from that model can be selected. If the argument
Flag
is a Flag then only joints that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any joints can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of joints selected or null if menu cancelled
Example
To select joints from model m, flagging those selected with flag f, giving the prompt Select joints:
Joint.Select(f, Select joints, m);
To select joints, flagging those selected with flag f but limiting selection to joints flagged with flag l, giving the prompt
Select joints:
Joint.Select(f, Select joints, l);
SetFlag(flag[Flag])
Description
Sets a flag on the joint.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for joint j:
j.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the joint. The joint will be sketched until you either call Joint.Unsketch(), Joint.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the joint is sketched. If omitted redraw is true. If you
want to sketch several joints and only redraw after the last one then use false for redraw and
call View.Redraw().
Keywords 208
Description
March 2016
Constrained
Joint class
Return type
No return value
Example
To sketch joint j:
j.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing joints should be counted. If false or omitted referenced but undefined
joints will also be included in the total.
Return type
number of joints
Example
To get the total number of joints in model m:
var total = Joint.Total(m);
Unblank()
Description
Unblanks the joint
Arguments
No arguments
Return type
No return value
Example
To unblank joint j:
j.Unblank();
March 2016
Keywords 209
Joint class
Constrained
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the joints in model m:
Joint.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the joints in model m flagged with f:
Joint.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all joints will be unset in
flag
Flag
Return type
No return value
Keywords 210
March 2016
Constrained
Joint class
Example
To unset the flag f on all the joints in model m:
Joint.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the joint.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the joint is unsketched. If omitted redraw is true. If
you want to unsketch several joints and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To unsketch joint j:
j.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the joints 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().
Return type
No return value
Example
To unsketch all joints in model m:
Joint.UnsketchAll(m);
ViewParameters()
Description
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.
March 2016
Keywords 211
Joint class
Constrained
Arguments
No arguments
Return type
Joint object.
Example
To check if Joint property j.example is a parameter by using the Joint.GetParameter() method:
if (j.ViewParameters().GetParameter(j.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for joint j:
j.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this joint.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for joint j:
var xrefs = j.Xrefs();
toString()
Description
Creates a string containing the joint data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Joint.Keyword() and Joint.KeywordCards().
Keywords 212
March 2016
Constrained
Joint class
March 2016
Keywords 213
Arguments
No arguments
Return type
string
Example
To get data for joint j in keyword format
var s = j.toString();
Constrained
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[joint stiffness property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
JointStiffness constants
Name
Description
JointStiffness.FLEXION_
TORSION
JointStiffness is *CONSTRAINED_JOINT_STIFFNESS_
FLEXION-TORSION.
JointStiffness.GENERALIZED
JointStiffness is *CONSTRAINED_JOINT_STIFFNESS_GENERALIZED.
JointStiffness.TRANSLATIONAL
JointStiffness is *CONSTRAINED_JOINT_STIFFNESS_TRANSLATIONAL.
JointStiffness properties
Keywords 214
March 2016
Constrained
Name
Type
Description
cida
integer
cidb
integer
dlcidal integer
dlcidbt integer
dlcidg
integer
dlcidph integer
dlcidps integer
dlcidt
integer
dlcidx
integer
dlcidy
integer
dlcidz
integer
esal
float
esbt
float
esph
float
esps
float
est
float
esx
float
esy
float
esz
float
exists
logical
true if jstf exists, false if referred to but not defined. (read only)
ffx
integer
ffy
integer
ffz
integer
fmal
integer
fmbt
integer
fmph
integer
fmps
integer
fmt
integer
include integer
jid
integer
label
integer
JointStiffness ID of the JSTF. Also see the label property which is an alternative name for this.
lcidal
integer
lcidbt
integer
lcidg
integer
lcidph
integer
lcidps
integer
lcidt
integer
lcidx
integer
March 2016
Keywords 215
Constrained
lcidy
integer
lcidz
integer
model
integer
nsabt
float
nsaph
float
nsaps
float
nsat
float
nsdx
float
nsdy
float
nsdz
float
option
pida
integer
Part ID #A.
pidb
integer
Part ID #B.
psabt
float
psaph
float
psaps
float
psat
float
psdx
float
psdy
float
psdz
float
saal
float
Detailed Description
The JointStiffness class allows you to create, modify, edit and manipulate joint stiffness cards. See the documentation
below for more details.
For convenience "Jstf" can also be used as the class name instead of "JointStiffness".
Constructor
new JointStiffness(Model[Model], option[constant], label[integer],
pida[integer], pidb[integer], cida[integer], cidb[integer], jid[integer],
lcidph[integer], lcidt[integer], lcidps[integer], dlcidph[integer], dlcidt[integer],
dlcidps[integer], esph[float], fmph[integer], est[float], fmt[integer], esps[float],
fmps[integer], nsaph[float], psaph[float], nsat[float], psat[float], nsaps[float],
psaps[float])
Description
Create a new JointStiffness object for *CONSTRAINED_JOINT_STIFFNESS_GENERALIZED.
Keywords 216
March 2016
Constrained
Arguments
Name
Type
Model Model
Description
Model that jstf will be created in
option
label
integer
JointStiffness ID of the JSTF. Also see the label argument which is an alternative name for this.
pida
integer
Part ID #A.
pidb
integer
Part ID #B.
cida
integer
cidb
integer
jid
integer
lcidph
integer
lcidt
integer
lcidps
integer
dlcidph integer
dlcidt
integer
dlcidps integer
esph
float
fmph
integer
est
float
fmt
integer
esps
float
fmps
integer
nsaph
float
psaph
float
nsat
float
psat
float
nsaps
float
psaps
float
Return type
JointStiffness object
Example
To create a new jstf 1000 of type GENERALIZED in model m with the following specifiction: pida, pidb, cida, cidb,
jid are 91, 92, 81, 82, 71 respectively; lcidph, lcidt, lcidps, dlcidph, dlcidt, dlcidps are 1, 2, 3, 4, 5, 6 respectively; esph,
fmph, est, fmt, esps, fmps are 11.0, 11, 12.0, 12, 13.0, 13 respectively; nsaph, psaph, nsat, psat, nsaps, psaps are -20,
20, -30, 30, -40, 40 respectively.
var j = new JointStiffness(m, JointStiffness.GENERALIZED, 1000, 91, 92, 81, 82,
71, 1, 2, 3, 4, 5, 6, 11.0, 11, 12.0, 12, 13.0, 13, -20, 20, -30, 30, -40, 40);
March 2016
Keywords 217
Constrained
Arguments
Name Type
Description
Model Model
integer
JointStiffness ID of the JSTF. Also see the label argument which is an alternative name for this.
pida
integer
Part ID #A.
pidb
integer
Part ID #B.
cida
integer
cidb
integer
jid
integer
lcidal
integer
lcidg
integer
lcidbt
integer
dlcidal integer
dlcidg integer
dlcidbt integer
esal
float
fmal
integer
esbt
float
fmbt
integer
saal
float
nsabt
float
psabt
float
Return type
JointStiffness object
Example
To create a new jstf 2000 of type GENERALIZED in model m with the following specifiction: pida, pidb, cida, cidb,
jid are 81, 82, 71, 72, 61 respectively; lcidal, lcidg, lcidbt, dlcidal, dlcidg, dlcidbt are 1, 2, 3, 4, 5, 6 respectively; esal,
fmal, esbt, fmbt are 11.5, 12, 12.5, 13 respectively; saal, nsabt, psabt are 22.5, 25.0, 27.5 respectively.
var j = new JointStiffness(m, JointStiffness.FLEXION_TORSION, 2000, 81, 82, 71,
72, 61, 1, 2, 3, 4, 5, 6, 11.5, 12, 12.5, 13, 22.5, 25.0, 27.5);
Keywords 218
March 2016
Constrained
Arguments
Name Type
Description
Model Model
integer
JointStiffness ID of the JSTF. Also see the label argument which is an alternative name for this.
pida
integer
Part ID #A.
pidb
integer
Part ID #B.
cida
integer
cidb
integer
jid
integer
lcidx
integer
lcidy
integer
lcidz
integer
dlcidx integer
dlcidy integer
dlcidz integer
esx
float
ffx
integer
esy
float
ffy
integer
esz
float
ffz
integer
nsdx
float
psdx
float
nsdy
float
psdy
float
nsdz
float
psdz
float
Return type
JointStiffness object
March 2016
Keywords 219
Constrained
Example
To create a new jstf 3000 of type TRANSLATIONAL in model m with the following specifiction: pida, pidb, cida,
cidb, jid are 71, 72, 61, 62, 51 respectively; lcidx, lcidy, lcidz, dlcidx, dlcidy, dlcidz are 1, 2, 3, 4, 5, 6 respectively; esx,
ffx, esy, ffy, esz, ffz are are 12.5, 13, 13.5, 14, 14.5, 15 respectively; nsdx, psdx, nsdy, psdy, nsdz, psdz are -30, 30,
-40, 40, -50, 50 respectively.
var j = new JointStiffness(m, JointStiffness.TRANSLATIONAL, 3000, 71, 72, 61,
62, 51, 1, 2, 3, 4, 5, 6, 12.5, 13, 13.5, 14, 14.5, 15, -30, 30, -40, 40, -50,
50);
Details of functions
Blank()
Description
Blanks the joint stiffness
Arguments
No arguments
Return type
No return value
Example
To blank joint stiffness js:
js.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the joint stiffnesses in model m:
JointStiffness.BlankAll(m);
Keywords 220
March 2016
Constrained
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the joint stiffnesses in model m flagged with f:
JointStiffness.BlankFlagged(m, f);
Blanked()
Description
Checks if the joint stiffness is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if joint stiffness js is blanked:
if (js.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse joint stiffness js:
js.Browse();
March 2016
Keywords 221
Constrained
ClearFlag(flag[Flag])
Description
Clears a flag on the joint stiffness.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for joint stiffness js:
js.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the joint stiffness.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy joint stiffness js into joint stiffness z:
var z = js.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
JointStiffness object (or null if not made)
Keywords 222
March 2016
Constrained
Example
To start creating a jstf in model m:
var m = JointStiffness.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit joint stiffness js:
js.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for joint stiffness js:
js.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first joint stiffness in the model.
March 2016
Keywords 223
Constrained
Arguments
Name Type
Description
Return type
JointStiffness object (or null if there are no joint stiffnesses in the model).
Example
To get the first joint stiffness in model m:
var js = JointStiffness.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
JointStiffness label.
Example
To get the first free joint stiffness label in model m:
var label = JointStiffness.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 224
March 2016
Constrained
Example
To flag all of the joint stiffnesses with flag f in model m:
JointStiffness.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the joint stiffness is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if joint stiffness js has flag f set on it:
if (js.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 225
Constrained
Example
To call function test for all of the joint stiffnesses in model m:
JointStiffness.ForEach(m, test);
function test(js)
{
// js is JointStiffness object
}
To call function test for all of the joint stiffnesses in model m with optional object:
var data = { x:0, y:0 };
JointStiffness.ForEach(m, test, data);
function test(js, extra)
{
// js is JointStiffness object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of JointStiffness objects for all of the joint stiffnesses in a model in Primer
Arguments
Name Type
Description
Return type
Array of JointStiffness objects
Example
To make an array of JointStiffness objects for all of the joint stiffnesses in model m
var js = JointStiffness.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of JointStiffness objects
Example
To make an array of JointStiffness objects for all of the joint stiffnesses in model m flagged with f
var js = JointStiffness.GetFlagged(m, f);
Keywords 226
March 2016
Constrained
Arguments
Name
Type
Description
Model
number integer number of the joint stiffness you want the JointStiffness object for
Return type
JointStiffness object (or null if joint stiffness does not exist).
Example
To get the JointStiffness object for joint stiffness 100 in model m
var js = JointStiffness.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if JointStiffness property js.example is a parameter:
Options.property_parameter_names = true;
if (js.GetParameter(js.example) ) do_something...
Options.property_parameter_names = false;
To check if JointStiffness property js.example is a parameter by using the GetParameter method:
if (js.ViewParameters().GetParameter(js.example) ) do_something...
Keyword()
Description
Returns the keyword for this jstf (*CONSTRAINED_JOINT_STIFFNESS). Note that a carriage return is not added.
See also JointStiffness.KeywordCards()
March 2016
Keywords 227
Constrained
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for jstf n:
var key = n.Keyword();
KeywordCards()
Description
Returns the keyword cards for the jstf. Note that a carriage return is not added. See also JointStiffness.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for jstf n:
var cards = n.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last joint stiffness in the model.
Arguments
Name Type
Description
Return type
JointStiffness object (or null if there are no joint stiffnesses in the model).
Example
To get the last joint stiffness in model m:
var js = JointStiffness.Last(m);
Keywords 228
March 2016
Constrained
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
JointStiffness label.
Example
To get the last free joint stiffness label in model m:
var label = JointStiffness.LastFreeLabel(m);
Next()
Description
Returns the next joint stiffness in the model.
Arguments
No arguments
Return type
JointStiffness object (or null if there are no more joint stiffnesses in the model).
Example
To get the joint stiffness in model m after joint stiffness js:
var js = js.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
JointStiffness label.
Example
To get the next free joint stiffness label in model m:
var label = JointStiffness.NextFreeLabel(m);
March 2016
Keywords 229
Constrained
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the jstf can be picked from any model.
modal
(optional)
boolean 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.
Return type
JointStiffness object (or null if not picked)
Example
To pick a jstf from model m giving the prompt Pick jstf from screen:
var jstf = JointStiffness.Pick(Pick jstf from screen, m);
Previous()
Description
Returns the previous joint stiffness in the model.
Arguments
No arguments
Return type
JointStiffness object (or null if there are no more joint stiffnesses in the model).
Example
To get the joint stiffness in model m before joint stiffness js:
var js = js.Previous();
Arguments
Name Type
Description
Keywords 230
March 2016
Constrained
Return type
No return value
Example
To renumber all of the joint stiffnesses in model m, from 1000000:
JointStiffness.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged joint stiffnesses will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the joint stiffnesses in model m flagged with f, from 1000000:
JointStiffness.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only joint stiffnesses from that model can be selected. If the
Flag
argument is a Flag then only joint stiffnesses that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any joint stiffnesses can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of joint stiffnesses selected or null if menu cancelled
March 2016
Keywords 231
Constrained
Example
To select joint stiffnesses from model m, flagging those selected with flag f, giving the prompt Select joint stiffnesses:
JointStiffness.Select(f, Select joint stiffnesses, m);
To select joint stiffnesses, flagging those selected with flag f but limiting selection to joint stiffnesses flagged with flag
l, giving the prompt Select joint stiffnesses:
JointStiffness.Select(f, Select joint stiffnesses, l);
SetFlag(flag[Flag])
Description
Sets a flag on the joint stiffness.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for joint stiffness js:
js.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the joint stiffness. The joint stiffness will be sketched until you either call JointStiffness.Unsketch(),
JointStiffness.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the joint stiffness is sketched. If omitted redraw is true.
If you want to sketch several joint stiffnesses and only redraw after the last one then use false
for redraw and call View.Redraw().
Return type
No return value
Example
To sketch joint stiffness js:
js.Sketch();
Keywords 232
March 2016
Constrained
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing joint stiffnesses should be counted. If false or omitted referenced but
undefined joint stiffnesses will also be included in the total.
Return type
number of joint stiffnesses
Example
To get the total number of joint stiffnesses in model m:
var total = JointStiffness.Total(m);
Unblank()
Description
Unblanks the joint stiffness
Arguments
No arguments
Return type
No return value
Example
To unblank joint stiffness js:
js.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the joint stiffnesses in model m:
JointStiffness.UnblankAll(m);
March 2016
Keywords 233
Constrained
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the joint stiffnesses in model m flagged with f:
JointStiffness.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all joint stiffnesses will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the joint stiffnesses in model m:
JointStiffness.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the joint stiffness.
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the joint stiffness is unsketched. If omitted redraw is
true. If you want to unsketch several joint stiffnesses and only redraw after the last one then
use false for redraw and call View.Redraw().
Keywords 234
Description
March 2016
Constrained
Return type
No return value
Example
To unsketch joint stiffness js:
js.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the joint stiffnesses 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().
Return type
No return value
Example
To unsketch all joint stiffnesses in model m:
JointStiffness.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
JointStiffness object.
Example
To check if JointStiffness property js.example is a parameter by using the JointStiffness.GetParameter() method:
if (js.ViewParameters().GetParameter(js.example) ) do_something...
March 2016
Keywords 235
Constrained
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for joint stiffness js:
js.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this joint stiffness.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for joint stiffness js:
var xrefs = js.Xrefs();
toString()
Description
Creates a string containing the jstf data in keyword format. Note that this contains the keyword header and the keyword
cards. See also JointStiffness.Keyword() and JointStiffness.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for jstf n in keyword format
var s = n.toString();
Keywords 236
March 2016
Constrained
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[nodal rigid body property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
NodalRigidBody properties
Name
Type
Description
cid
cmo
con1
con2
drflag
exists
logical true if nrb exists, false if referred to but not defined. (read only)
March 2016
Keywords 237
Constrained
include integer The Include file number that the nrb is in.
inertia logical Flag to turn on or off _INERTIA option
iprt
ixx
float
ixy
float
ixz
float
iyy
float
iyz
float
izz
float
label
integer NodalRigidBody ID of the NRB. Also see the pid property which is an alternative name for this.
model
integer The Model number that the nodal rigid body is in.
pid
integer NodalRigidBody ID of the NRB. Also see the label property which is an alternative name for this.
pnode
rrflag
spc
tm
float
Translational mass
vrx
float
vry
float
vrz
float
vtx
float
vty
float
vtz
float
xc
float
xl
float
xlip
float
yc
float
yl
float
ylip
float
zc
float
zl
float
zlip
float
Detailed Description
The NodalRigidBody class allows you to create, modify, edit and manipulate nodal rigid body cards. See the
documentation below for more details.
For convenience "Nrb" can also be used as the class name instead of "NodalRigidBody".
Keywords 238
March 2016
Constrained
Constructor
new NodalRigidBody(Model[Model], nsid[integer], pid (optional)[integer], cid
(optional)[integer], pnode (optional)[integer], iprt (optional)[integer], drflag
(optional)[integer], rrflag (optional)[integer])
Description
Create a new NodalRigidBody object.
Arguments
Name
Type
Description
Model
nsid
pid (optional)
integer NodalRigidBody ID of the NRB. Also see the label property which is an alternative name
for this.
cid (optional)
pnode
(optional)
iprt (optional)
drflag
(optional)
Return type
NodalRigidBody object
Example
To create a new nrb in model m with label 200, using node set 50
var v = new NodalRigidBody(m, 50, 200);
Details of functions
Blank()
Description
Blanks the nodal rigid body
Arguments
No arguments
Return type
No return value
Example
To blank nodal rigid body nrb:
nrb.Blank();
March 2016
Keywords 239
Constrained
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the nodal rigid bodies in model m:
NodalRigidBody.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged nodal rigid bodies will be blanked in
flag
Flag
Flag set on the nodal rigid bodies that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the nodal rigid bodies in model m flagged with f:
NodalRigidBody.BlankFlagged(m, f);
Blanked()
Description
Checks if the nodal rigid body is blanked or not.
Arguments
No arguments
Keywords 240
March 2016
Constrained
Return type
true if blanked, false if not.
Example
To check if nodal rigid body nrb is blanked:
if (nrb.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse nodal rigid body nrb:
nrb.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the nodal rigid body.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for nodal rigid body nrb:
nrb.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the nodal rigid body.
March 2016
Keywords 241
Constrained
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy nodal rigid body nrb into nodal rigid body z:
var z = nrb.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
NodalRigidBody object (or null if not made)
Example
To start creating a nrb in model m:
var m = NodalRigidBody.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit nodal rigid body nrb:
nrb.Edit();
Keywords 242
March 2016
Constrained
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for nodal rigid body nrb:
nrb.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first nodal rigid body in the model.
Arguments
Name Type
Description
Return type
NodalRigidBody object (or null if there are no nodal rigid bodies in the model).
Example
To get the first nodal rigid body in model m:
var nrb = NodalRigidBody.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
March 2016
Keywords 243
Constrained
Return type
NodalRigidBody label.
Example
To get the first free nodal rigid body label in model m:
var label = NodalRigidBody.FirstFreeLabel(m);
Arguments
Name Type
Description
Model Model Model that all nodal rigid bodies will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the nodal rigid bodies with flag f in model m:
NodalRigidBody.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the nodal rigid body is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if nodal rigid body nrb has flag f set on it:
if (nrb.Flagged(f) ) do_something...
Keywords 244
March 2016
Constrained
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the nodal rigid bodies in model m:
NodalRigidBody.ForEach(m, test);
function test(nrb)
{
// nrb is NodalRigidBody object
}
To call function test for all of the nodal rigid bodies in model m with optional object:
var data = { x:0, y:0 };
NodalRigidBody.ForEach(m, test, data);
function test(nrb, extra)
{
// nrb is NodalRigidBody object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of NodalRigidBody objects for all of the nodal rigid bodies in a model in Primer
Arguments
Name Type
Description
Return type
Array of NodalRigidBody objects
Example
To make an array of NodalRigidBody objects for all of the nodal rigid bodies in model m
var nrb = NodalRigidBody.GetAll(m);
March 2016
Keywords 245
Constrained
Arguments
Name Type
Description
Flag
Flag set on the nodal rigid bodies that you want to retrieve
Return type
Array of NodalRigidBody objects
Example
To make an array of NodalRigidBody objects for all of the nodal rigid bodies in model m flagged with f
var nrb = NodalRigidBody.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the nodal rigid body you want the NodalRigidBody object for
Return type
NodalRigidBody object (or null if nodal rigid body does not exist).
Example
To get the NodalRigidBody object for nodal rigid body 100 in model m
var nrb = NodalRigidBody.GetFromID(m, 100);
Arguments
Name Type
prop
Description
nodal rigid body property nodal rigid body property to get parameter for
Keywords 246
March 2016
Constrained
Return type
Parameter object if property is a parameter, null if not.
Example
To check if NodalRigidBody property nrb.example is a parameter:
Options.property_parameter_names = true;
if (nrb.GetParameter(nrb.example) ) do_something...
Options.property_parameter_names = false;
To check if NodalRigidBody property nrb.example is a parameter by using the GetParameter method:
if (nrb.ViewParameters().GetParameter(nrb.example) ) do_something...
Keyword()
Description
Returns the keyword for this nrb (*CONSTRAINED_NODAL_RIGID_BODY_xxxx). Note that a carriage return is
not added. See also NodalRigidBody.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for nrb n:
var key = n.Keyword();
KeywordCards()
Description
Returns the keyword cards for the nrb. Note that a carriage return is not added. See also NodalRigidBody.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for nrb n:
var cards = n.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last nodal rigid body in the model.
March 2016
Keywords 247
Constrained
Arguments
Name Type
Description
Return type
NodalRigidBody object (or null if there are no nodal rigid bodies in the model).
Example
To get the last nodal rigid body in model m:
var nrb = NodalRigidBody.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
NodalRigidBody label.
Example
To get the last free nodal rigid body label in model m:
var label = NodalRigidBody.LastFreeLabel(m);
Next()
Description
Returns the next nodal rigid body in the model.
Arguments
No arguments
Return type
NodalRigidBody object (or null if there are no more nodal rigid bodies in the model).
Example
To get the nodal rigid body in model m after nodal rigid body nrb:
var nrb = nrb.Next();
Keywords 248
March 2016
Constrained
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
NodalRigidBody label.
Example
To get the next free nodal rigid body label in model m:
var label = NodalRigidBody.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the nrb can be picked from any model.
modal
(optional)
boolean 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.
Return type
NodalRigidBody object (or null if not picked)
Example
To pick a nrb from model m giving the prompt Pick nrb from screen:
var nrb = NodalRigidBody.Pick(Pick nrb from screen, m);
Previous()
Description
Returns the previous nodal rigid body in the model.
Arguments
No arguments
March 2016
Keywords 249
Constrained
Return type
NodalRigidBody object (or null if there are no more nodal rigid bodies in the model).
Example
To get the nodal rigid body in model m before nodal rigid body nrb:
var nrb = nrb.Previous();
Arguments
Name Type
Description
Model Model Model that all nodal rigid bodies will be renumbered in
start
Return type
No return value
Example
To renumber all of the nodal rigid bodies in model m, from 1000000:
NodalRigidBody.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged nodal rigid bodies will be renumbered in
flag
Flag
Flag set on the nodal rigid bodies that you want to renumber
start
Return type
No return value
Example
To renumber all of the nodal rigid bodies in model m flagged with f, from 1000000:
NodalRigidBody.RenumberFlagged(m, f, 1000000);
Keywords 250
March 2016
Constrained
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only nodal rigid bodies from that model can be selected. If the
Flag
argument is a Flag then only nodal rigid bodies that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any nodal rigid bodies can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of nodal rigid bodies selected or null if menu cancelled
Example
To select nodal rigid bodies from model m, flagging those selected with flag f, giving the prompt Select nodal rigid
bodies:
NodalRigidBody.Select(f, Select nodal rigid bodies, m);
To select nodal rigid bodies, flagging those selected with flag f but limiting selection to nodal rigid bodies flagged with
flag l, giving the prompt Select nodal rigid bodies:
NodalRigidBody.Select(f, Select nodal rigid bodies, l);
SetFlag(flag[Flag])
Description
Sets a flag on the nodal rigid body.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for nodal rigid body nrb:
nrb.SetFlag(f);
March 2016
Keywords 251
Constrained
Sketch(redraw (optional)[boolean])
Description
Sketches the nodal rigid body. The nodal rigid body will be sketched until you either call NodalRigidBody.Unsketch(),
NodalRigidBody.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the nodal rigid body is sketched. If omitted redraw is
true. If you want to sketch several nodal rigid bodies and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch nodal rigid body nrb:
nrb.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing nodal rigid bodies should be counted. If false or omitted referenced but
undefined nodal rigid bodies will also be included in the total.
Return type
number of nodal rigid bodies
Example
To get the total number of nodal rigid bodies in model m:
var total = NodalRigidBody.Total(m);
Unblank()
Description
Unblanks the nodal rigid body
Arguments
No arguments
Return type
No return value
Keywords 252
March 2016
Constrained
Example
To unblank nodal rigid body nrb:
nrb.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the nodal rigid bodies in model m:
NodalRigidBody.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the nodal rigid bodies that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the nodal rigid bodies in model m flagged with f:
NodalRigidBody.UnblankFlagged(m, f);
Keywords 253
Constrained
Arguments
Name Type
Description
Model Model Model that the defined flag for all nodal rigid bodies will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the nodal rigid bodies in model m:
NodalRigidBody.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the nodal rigid body.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the nodal rigid body is unsketched. If omitted redraw is
true. If you want to unsketch several nodal rigid bodies and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch nodal rigid body nrb:
nrb.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the nodal rigid bodies 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().
Return type
No return value
Keywords 254
March 2016
Constrained
Example
To unsketch all nodal rigid bodies in model m:
NodalRigidBody.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
NodalRigidBody object.
Example
To check if NodalRigidBody property nrb.example is a parameter by using the NodalRigidBody.GetParameter()
method:
if (nrb.ViewParameters().GetParameter(nrb.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for nodal rigid body nrb:
nrb.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this nodal rigid body.
Arguments
No arguments
March 2016
Keywords 255
Constrained
Return type
Xrefs object.
Example
To get the cross references for nodal rigid body nrb:
var xrefs = nrb.Xrefs();
toString()
Description
Creates a string containing the nrb data in keyword format. Note that this contains the keyword header and the keyword
cards. See also NodalRigidBody.Keyword() and NodalRigidBody.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for nrb n in keyword format
var s = n.toString();
Keywords 256
March 2016
Constrained
NodeSet class
NodeSet class
The NodeSet class gives you access to constrained node set cards in PRIMER, not set node cards. For access to set
node cards, refer to the Set class. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[node set property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
NodeSet properties
Name
Type
Description
cnsid
dof
exists
logical true if constrained node set exists, false if referred to but not defined. (read only)
id
include integer The Include file number that the constrained node set is in.
March 2016
Keywords 257
NodeSet class
Constrained
label
model
nsid
tf
float
Failure time.
Detailed Description
The NodeSet class allows you to create, modify, edit and manipulate constrained node set cards. See the documentation
below for more details.
Constructor
new NodeSet(Model[Model], nsid[integer], dof[integer], tf[float], id
(optional)[integer])
Description
Create a new NodeSet object.
Arguments
Name
Type
Description
Model
nsid
dof
tf
float
Failure time.
Return type
NodeSet object
Example
To create a new constrained node set 500 in model m, of type SET, with node set 9, degree of freedom 1 and failure
time 1000
var n = new NodeSet(m, 9, 1, 1000, 500);
Details of functions
Blank()
Description
Blanks the node set
Arguments
No arguments
Return type
No return value
Keywords 258
March 2016
Constrained
NodeSet class
Example
To blank node set ns:
ns.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the node sets in model m:
NodeSet.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the node sets in model m flagged with f:
NodeSet.BlankFlagged(m, f);
Blanked()
Description
Checks if the node set is blanked or not.
March 2016
Keywords 259
NodeSet class
Constrained
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if node set ns is blanked:
if (ns.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse node set ns:
ns.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the node set.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for node set ns:
ns.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the node set.
Keywords 260
March 2016
Constrained
NodeSet class
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy node set ns into node set z:
var z = ns.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
NodeSet object (or null if not made)
Example
To start creating a node set in model n:
var n = NodeSet.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit node set ns:
ns.Edit();
March 2016
Keywords 261
NodeSet class
Constrained
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for node set ns:
ns.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first node set in the model.
Arguments
Name Type
Description
Return type
NodeSet object (or null if there are no node sets in the model).
Example
To get the first node set in model m:
var ns = NodeSet.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Keywords 262
March 2016
Constrained
NodeSet class
Return type
NodeSet label.
Example
To get the first free node set label in model m:
var label = NodeSet.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the node sets with flag f in model m:
NodeSet.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the node set is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if node set ns has flag f set on it:
if (ns.Flagged(f) ) do_something...
March 2016
Keywords 263
NodeSet class
Constrained
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the node sets in model m:
NodeSet.ForEach(m, test);
function test(ns)
{
// ns is NodeSet object
}
To call function test for all of the node sets in model m with optional object:
var data = { x:0, y:0 };
NodeSet.ForEach(m, test, data);
function test(ns, extra)
{
// ns is NodeSet object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of NodeSet objects for all of the node sets in a model in Primer
Arguments
Name Type
Description
Return type
Array of NodeSet objects
Example
To make an array of NodeSet objects for all of the node sets in model m
var ns = NodeSet.GetAll(m);
Keywords 264
March 2016
Constrained
NodeSet class
Arguments
Name Type
Description
Flag
Return type
Array of NodeSet objects
Example
To make an array of NodeSet objects for all of the node sets in model m flagged with f
var ns = NodeSet.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the node set you want the NodeSet object for
Return type
NodeSet object (or null if node set does not exist).
Example
To get the NodeSet object for node set 100 in model m
var ns = NodeSet.GetFromID(m, 100);
Arguments
Name Type
prop
Description
March 2016
Keywords 265
NodeSet class
Constrained
Return type
Parameter object if property is a parameter, null if not.
Example
To check if NodeSet property ns.example is a parameter:
Options.property_parameter_names = true;
if (ns.GetParameter(ns.example) ) do_something...
Options.property_parameter_names = false;
To check if NodeSet property ns.example is a parameter by using the GetParameter method:
if (ns.ViewParameters().GetParameter(ns.example) ) do_something...
Keyword()
Description
Returns the keyword for this node_set (*CONSTRAINED_NODE_SET). Note that a carriage return is not added.
See also NodeSet.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for node_set n:
var key = n.Keyword();
KeywordCards()
Description
Returns the keyword cards for the node_set. Note that a carriage return is not added. See also NodeSet.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for node_set n:
var cards = n.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last node set in the model.
Keywords 266
March 2016
Constrained
NodeSet class
Arguments
Name Type
Description
Return type
NodeSet object (or null if there are no node sets in the model).
Example
To get the last node set in model m:
var ns = NodeSet.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
NodeSet label.
Example
To get the last free node set label in model m:
var label = NodeSet.LastFreeLabel(m);
Next()
Description
Returns the next node set in the model.
Arguments
No arguments
Return type
NodeSet object (or null if there are no more node sets in the model).
Example
To get the node set in model m after node set ns:
var ns = ns.Next();
March 2016
Keywords 267
NodeSet class
Constrained
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
NodeSet label.
Example
To get the next free node set label in model m:
var label = NodeSet.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the node_set can be picked from any model.
modal
(optional)
boolean 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.
Return type
NodeSet object (or null if not picked)
Example
To pick a node_set from model m giving the prompt Pick node_set from screen:
var node_set = NodeSet.Pick(Pick node_set from screen, m);
Previous()
Description
Returns the previous node set in the model.
Arguments
No arguments
Keywords 268
March 2016
Constrained
NodeSet class
Return type
NodeSet object (or null if there are no more node sets in the model).
Example
To get the node set in model m before node set ns:
var ns = ns.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the node sets in model m, from 1000000:
NodeSet.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged node sets will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the node sets in model m flagged with f, from 1000000:
NodeSet.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 269
NodeSet class
Constrained
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only node sets from that model can be selected. If the
Flag
argument is a Flag then only node sets that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any node sets can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of node sets selected or null if menu cancelled
Example
To select node sets from model m, flagging those selected with flag f, giving the prompt Select node sets:
NodeSet.Select(f, Select node sets, m);
To select node sets, flagging those selected with flag f but limiting selection to node sets flagged with flag l, giving the
prompt Select node sets:
NodeSet.Select(f, Select node sets, l);
SetFlag(flag[Flag])
Description
Sets a flag on the node set.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for node set ns:
ns.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the node set. The node set will be sketched until you either call NodeSet.Unsketch(), NodeSet.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Keywords 270
March 2016
Constrained
NodeSet class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the node set is sketched. If omitted redraw is true. If
you want to sketch several node sets and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch node set ns:
ns.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing node sets should be counted. If false or omitted referenced but undefined
node sets will also be included in the total.
Return type
number of node sets
Example
To get the total number of node sets in model m:
var total = NodeSet.Total(m);
Unblank()
Description
Unblanks the node set
Arguments
No arguments
Return type
No return value
Example
To unblank node set ns:
ns.Unblank();
March 2016
Keywords 271
NodeSet class
Constrained
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the node sets in model m:
NodeSet.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the node sets in model m flagged with f:
NodeSet.UnblankFlagged(m, f);
Keywords 272
March 2016
Constrained
NodeSet class
Arguments
Name Type
Description
Model Model Model that the defined flag for all node sets will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the node sets in model m:
NodeSet.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the node set.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the node set is unsketched. If omitted redraw is true. If
you want to unsketch several node sets and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch node set ns:
ns.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the node sets 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().
Return type
No return value
March 2016
Keywords 273
NodeSet class
Constrained
Example
To unsketch all node sets in model m:
NodeSet.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
NodeSet object.
Example
To check if NodeSet property ns.example is a parameter by using the NodeSet.GetParameter() method:
if (ns.ViewParameters().GetParameter(ns.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for node set ns:
ns.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this node set.
Arguments
No arguments
Keywords 274
March 2016
Constrained
NodeSet class
Return type
Xrefs object.
Example
To get the cross references for node set ns:
var xrefs = ns.Xrefs();
toString()
Description
Creates a string containing the node_set data in keyword format. Note that this contains the keyword header and the
keyword cards. See also NodeSet.Keyword() and NodeSet.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for node set n in keyword format
var s = n.toString();
March 2016
Keywords 275
RigidBodies class
Constrained
RigidBodies class
The RigidBodies class gives you access to constrained rigid bodies cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[rigid body merge property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
RigidBodies properties
Name
Type
Description
exists
logical true if constrained rigid bodies exists, false if referred to but not defined. (read only)
iflag
include integer The Include file number that the constrained rigid bodies is in.
label
integer The label the constrained rigid bodies has in PRIMER (read only)
model
integer The Model number that the rigid body merge is in.
pidm
pids
Keywords 276
March 2016
Constrained
RigidBodies class
Detailed Description
The RigidBodies class allows you to create, modify, edit and manipulate constrained rigid bodies cards. See the
documentation below for more details.
Constructor
new RigidBodies(Model[Model], pidm[integer], pids[integer], iflag[integer])
Description
Create a new RigidBodies object.
Arguments
Name Type
Description
pids
iflag
Return type
RigidBodies object
Example
To create a new constrained rigid bodies in model m with master part 5 and slave part 10
var r = new RigidBodies(m, 5, 10);
Details of functions
Blank()
Description
Blanks the rigid body merge
Arguments
No arguments
Return type
No return value
Example
To blank rigid body merge m:
m.Blank();
March 2016
Keywords 277
RigidBodies class
Constrained
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the rigid body merges in model m:
RigidBodies.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged rigid body merges will be blanked in
flag
Flag
Flag set on the rigid body merges that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the rigid body merges in model m flagged with f:
RigidBodies.BlankFlagged(m, f);
Blanked()
Description
Checks if the rigid body merge is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Keywords 278
March 2016
Constrained
RigidBodies class
Example
To check if rigid body merge m is blanked:
if (m.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse rigid body merge m:
m.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the rigid body merge.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for rigid body merge m:
m.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the rigid body merge.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
March 2016
Keywords 279
RigidBodies class
Constrained
Return type
Return class object
Example
To copy rigid body merge m into rigid body merge z:
var z = m.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
RigidBodies object (or null if not made)
Example
To start creating a constrained rigid bodies definition in model m:
var r = RigidBodies.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit rigid body merge m:
m.Edit();
Keywords 280
March 2016
Constrained
RigidBodies class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for rigid body merge m:
m.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first rigid body merge in the model.
Arguments
Name Type
Description
Return type
RigidBodies object (or null if there are no rigid body merges in the model).
Example
To get the first rigid body merge in model m:
var m = RigidBodies.First(m);
Arguments
Name Type
Description
Model Model Model that all rigid body merges will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the rigid body merges with flag f in model m:
RigidBodies.FlagAll(m, f);
March 2016
Keywords 281
RigidBodies class
Constrained
Flagged(flag[Flag])
Description
Checks if the rigid body merge is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if rigid body merge m has flag f set on it:
if (m.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Keywords 282
March 2016
Constrained
RigidBodies class
Example
To call function test for all of the rigid body merges in model m:
RigidBodies.ForEach(m, test);
function test(m)
{
// m is RigidBodies object
}
To call function test for all of the rigid body merges in model m with optional object:
var data = { x:0, y:0 };
RigidBodies.ForEach(m, test, data);
function test(m, extra)
{
// m is RigidBodies object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of RigidBodies objects for all of the rigid body merges in a model in Primer
Arguments
Name Type
Description
Return type
Array of RigidBodies objects
Example
To make an array of RigidBodies objects for all of the rigid body merges in model m
var m = RigidBodies.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the rigid body merges that you want to retrieve
Return type
Array of RigidBodies objects
Example
To make an array of RigidBodies objects for all of the rigid body merges in model m flagged with f
var m = RigidBodies.GetFlagged(m, f);
March 2016
Keywords 283
RigidBodies class
Constrained
Arguments
Name
Type
Description
Model
number integer number of the rigid body merge you want the RigidBodies object for
Return type
RigidBodies object (or null if rigid body merge does not exist).
Example
To get the RigidBodies object for rigid body merge 100 in model m
var m = RigidBodies.GetFromID(m, 100);
Arguments
Name Type
prop
Description
rigid body merge property rigid body merge property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if RigidBodies property m.example is a parameter:
Options.property_parameter_names = true;
if (m.GetParameter(m.example) ) do_something...
Options.property_parameter_names = false;
To check if RigidBodies property m.example is a parameter by using the GetParameter method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
Keyword()
Description
Returns the keyword for this constrained rigid bodies (*CONSTRAINED_RIGID_BODIES). Note that a carriage
return is not added. See also RigidBodies.KeywordCards()
Keywords 284
March 2016
Constrained
RigidBodies class
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for constrained rigid bodies r:
var key = r.Keyword();
KeywordCards()
Description
Returns the keyword cards for the constrained rigid bodies. Note that a carriage return is not added. See also
RigidBodies.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for constrained rigid bodies r:
var cards = r.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last rigid body merge in the model.
Arguments
Name Type
Description
Return type
RigidBodies object (or null if there are no rigid body merges in the model).
Example
To get the last rigid body merge in model m:
var m = RigidBodies.Last(m);
Next()
Description
Returns the next rigid body merge in the model.
March 2016
Keywords 285
RigidBodies class
Constrained
Arguments
No arguments
Return type
RigidBodies object (or null if there are no more rigid body merges in the model).
Example
To get the rigid body merge in model m after rigid body merge m:
var m = m.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the constrained rigid bodies can be picked from
any model.
modal
(optional)
boolean 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.
Return type
RigidBodies object (or null if not picked)
Example
To pick a constrained rigid bodies from model m giving the prompt Pick constrained rigid bodies from screen:
var rigid_bodies = RigidBodies.Pick(Pick constrained rigid bodies from screen,
m);
Previous()
Description
Returns the previous rigid body merge in the model.
Arguments
No arguments
Return type
RigidBodies object (or null if there are no more rigid body merges in the model).
Example
To get the rigid body merge in model m before rigid body merge m:
var m = m.Previous();
Keywords 286
March 2016
Constrained
RigidBodies class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only rigid body merges from that model can be selected. If
Flag
the argument is a Flag then only rigid body merges that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any rigid body merges can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of rigid body merges selected or null if menu cancelled
Example
To select rigid body merges from model m, flagging those selected with flag f, giving the prompt Select rigid body
merges:
RigidBodies.Select(f, Select rigid body merges, m);
To select rigid body merges, flagging those selected with flag f but limiting selection to rigid body merges flagged with
flag l, giving the prompt Select rigid body merges:
RigidBodies.Select(f, Select rigid body merges, l);
SetFlag(flag[Flag])
Description
Sets a flag on the rigid body merge.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for rigid body merge m:
m.SetFlag(f);
March 2016
Keywords 287
RigidBodies class
Constrained
Sketch(redraw (optional)[boolean])
Description
Sketches the rigid body merge. The rigid body merge will be sketched until you either call RigidBodies.Unsketch(),
RigidBodies.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the rigid body merge is sketched. If omitted redraw is
true. If you want to sketch several rigid body merges and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch rigid body merge m:
m.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing rigid body merges should be counted. If false or omitted referenced but
undefined rigid body merges will also be included in the total.
Return type
number of rigid body merges
Example
To get the total number of rigid body merges in model m:
var total = RigidBodies.Total(m);
Unblank()
Description
Unblanks the rigid body merge
Arguments
No arguments
Return type
No return value
Keywords 288
March 2016
Constrained
RigidBodies class
Example
To unblank rigid body merge m:
m.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the rigid body merges in model m:
RigidBodies.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the rigid body merges that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the rigid body merges in model m flagged with f:
RigidBodies.UnblankFlagged(m, f);
Keywords 289
RigidBodies class
Constrained
Arguments
Name Type
Description
Model Model Model that the defined flag for all rigid body merges will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the rigid body merges in model m:
RigidBodies.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the rigid body merge.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the rigid body merge is unsketched. If omitted redraw
is true. If you want to unsketch several rigid body merges and only redraw after the last one
then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch rigid body merge m:
m.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the rigid body merges 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().
Return type
No return value
Keywords 290
March 2016
Constrained
RigidBodies class
Example
To unsketch all rigid body merges in model m:
RigidBodies.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
RigidBodies object.
Example
To check if RigidBodies property m.example is a parameter by using the RigidBodies.GetParameter() method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for rigid body merge m:
m.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this rigid body merge.
Arguments
No arguments
March 2016
Keywords 291
RigidBodies class
Constrained
Return type
Xrefs object.
Example
To get the cross references for rigid body merge m:
var xrefs = m.Xrefs();
toString()
Description
Creates a string containing the constrained rigid bodies data in keyword format. Note that this contains the keyword
header and the keyword cards. See also RigidBodies.Keyword() and RigidBodies.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for constrained rigid bodies r in keyword format
var s = r.toString();
Keywords 292
March 2016
Constrained
Spotweld class
Spotweld class
The Spotweld class gives you access to constrained spotweld cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[spotweld property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Spotweld properties
Name
Type
Description
ep
float
exists
logical true if constrained spotweld exists, false if referred to but not defined. (read only)
include
integer The Include file number that the constrained spotweld is in.
label
Keywords 293
Spotweld class
Constrained
float
model
float
n1
integer Node ID
n2
integer Node ID
nf
sn
float
ss
float
tf
float
tw
float
wid
Detailed Description
The Spotweld class allows you to create, modify, edit and manipulate constrained spotweld cards. See the
documentation below for more details.
Constructor
new Spotweld(Model[Model], n1[integer], n2[integer], id (optional)[integer])
Description
Create a new Spotweld object.
Arguments
Name
Type
Description
Model
n1
integer Node ID 1
n2
integer Node ID 2
Return type
Spotweld object
Example
To create a new constrained spotweld 500 in model m between nodes 10 and 11
var s = new Spotweld(m, 10, 11, 500);
Details of functions
Blank()
Description
Blanks the spotweld
Arguments
No arguments
Keywords 294
March 2016
Constrained
Spotweld class
Return type
No return value
Example
To blank spotweld s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the spotwelds in model m:
Spotweld.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the spotwelds in model m flagged with f:
Spotweld.BlankFlagged(m, f);
March 2016
Keywords 295
Spotweld class
Constrained
Blanked()
Description
Checks if the spotweld is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if spotweld s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse spotweld s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the spotweld.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for spotweld s:
s.ClearFlag(f);
Keywords 296
March 2016
Constrained
Spotweld class
Copy(range (optional)[boolean])
Description
Copies the spotweld.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy spotweld s into spotweld z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Spotweld object (or null if not made)
Example
To start creating a spotweld in model s:
var s = Spotweld.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
March 2016
Keywords 297
Spotweld class
Constrained
Example
To Edit spotweld s:
s.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for spotweld s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first spotweld in the model.
Arguments
Name Type
Description
Return type
Spotweld object (or null if there are no spotwelds in the model).
Example
To get the first spotweld in model m:
var s = Spotweld.First(m);
Keywords 298
March 2016
Constrained
Spotweld class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Spotweld label.
Example
To get the first free spotweld label in model m:
var label = Spotweld.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the spotwelds with flag f in model m:
Spotweld.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the spotweld is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if spotweld s has flag f set on it:
if (s.Flagged(f) ) do_something...
March 2016
Keywords 299
Spotweld class
Constrained
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the spotwelds in model m:
Spotweld.ForEach(m, test);
function test(s)
{
// s is Spotweld object
}
To call function test for all of the spotwelds in model m with optional object:
var data = { x:0, y:0 };
Spotweld.ForEach(m, test, data);
function test(s, extra)
{
// s is Spotweld object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Spotweld objects for all of the spotwelds in a model in Primer
Arguments
Name Type
Description
Return type
Array of Spotweld objects
Example
To make an array of Spotweld objects for all of the spotwelds in model m
var s = Spotweld.GetAll(m);
Keywords 300
March 2016
Constrained
Spotweld class
Arguments
Name Type
Description
Flag
Return type
Array of Spotweld objects
Example
To make an array of Spotweld objects for all of the spotwelds in model m flagged with f
var s = Spotweld.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the spotweld you want the Spotweld object for
Return type
Spotweld object (or null if spotweld does not exist).
Example
To get the Spotweld object for spotweld 100 in model m
var s = Spotweld.GetFromID(m, 100);
GetParameter(prop[spotweld property])
Description
Checks if a Spotweld 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 Spotweld.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
March 2016
Keywords 301
Spotweld class
Constrained
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Spotweld property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Spotweld property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this spotweld (*CONSTRAINED_SPOTWELD). Note that a carriage return is not added.
See also Spotweld.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for spotweld s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the spotweld. Note that a carriage return is not added. See also Spotweld.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for spotweld s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last spotweld in the model.
Keywords 302
March 2016
Constrained
Spotweld class
Arguments
Name Type
Description
Return type
Spotweld object (or null if there are no spotwelds in the model).
Example
To get the last spotweld in model m:
var s = Spotweld.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Spotweld label.
Example
To get the last free spotweld label in model m:
var label = Spotweld.LastFreeLabel(m);
Next()
Description
Returns the next spotweld in the model.
Arguments
No arguments
Return type
Spotweld object (or null if there are no more spotwelds in the model).
Example
To get the spotweld in model m after spotweld s:
var s = s.Next();
March 2016
Keywords 303
Spotweld class
Constrained
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Spotweld label.
Example
To get the next free spotweld label in model m:
var label = Spotweld.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the spotweld can be picked from any model.
modal
(optional)
boolean 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.
Return type
Spotweld object (or null if not picked)
Example
To pick a spotweld from model m giving the prompt Pick spotweld from screen:
var spotweld = Spotweld.Pick(Pick spotweld from screen, m);
Previous()
Description
Returns the previous spotweld in the model.
Arguments
No arguments
Keywords 304
March 2016
Constrained
Spotweld class
Return type
Spotweld object (or null if there are no more spotwelds in the model).
Example
To get the spotweld in model m before spotweld s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the spotwelds in model m, from 1000000:
Spotweld.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged spotwelds will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the spotwelds in model m flagged with f, from 1000000:
Spotweld.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 305
Spotweld class
Constrained
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only spotwelds from that model can be selected. If the
Flag
argument is a Flag then only spotwelds that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any spotwelds can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of spotwelds selected or null if menu cancelled
Example
To select spotwelds from model m, flagging those selected with flag f, giving the prompt Select spotwelds:
Spotweld.Select(f, Select spotwelds, m);
To select spotwelds, flagging those selected with flag f but limiting selection to spotwelds flagged with flag l, giving the
prompt Select spotwelds:
Spotweld.Select(f, Select spotwelds, l);
SetFlag(flag[Flag])
Description
Sets a flag on the spotweld.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for spotweld s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the spotweld. The spotweld will be sketched until you either call Spotweld.Unsketch(),
Spotweld.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 306
March 2016
Constrained
Spotweld class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the spotweld is sketched. If omitted redraw is true. If
you want to sketch several spotwelds and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch spotweld s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing spotwelds should be counted. If false or omitted referenced but undefined
spotwelds will also be included in the total.
Return type
number of spotwelds
Example
To get the total number of spotwelds in model m:
var total = Spotweld.Total(m);
Unblank()
Description
Unblanks the spotweld
Arguments
No arguments
Return type
No return value
Example
To unblank spotweld s:
s.Unblank();
March 2016
Keywords 307
Spotweld class
Constrained
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the spotwelds in model m:
Spotweld.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the spotwelds in model m flagged with f:
Spotweld.UnblankFlagged(m, f);
Keywords 308
March 2016
Constrained
Spotweld class
Arguments
Name Type
Description
Model Model Model that the defined flag for all spotwelds will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the spotwelds in model m:
Spotweld.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the spotweld.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the spotweld is unsketched. If omitted redraw is true.
If you want to unsketch several spotwelds and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch spotweld s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the spotwelds 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().
Return type
No return value
March 2016
Keywords 309
Spotweld class
Constrained
Example
To unsketch all spotwelds in model m:
Spotweld.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Spotweld object.
Example
To check if Spotweld property s.example is a parameter by using the Spotweld.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for spotweld s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this spotweld.
Arguments
No arguments
Keywords 310
March 2016
Constrained
Spotweld class
Return type
Xrefs object.
Example
To get the cross references for spotweld s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the spotweld data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Spotweld.Keyword() and Spotweld.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for spotweld s in keyword format
var str = s.toString();
March 2016
Keywords 311
Contact class
Contact
Contact class
The Contact class gives you access to define contact cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Constrained(connection[boolean])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
FindInteractions() [deprecated]
Flagged(flag[Flag])
GetParameter(prop[contact property])
Interactions()
Keyword()
KeywordCards()
Next()
PenCheck(flag[Flag], eflag[integer])
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
StatusCheck()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Contact properties
Name
Type
Description
bt
real
cid
dc
real
Keywords 312
March 2016
Contact
dt
real
exists
logical true if contact exists, false if referred to but not defined. (read only)
fd
real
fs
real
fsf
real
heading
string
Contact heading
id
include
label
mboxid
model
mpr
msid
mst
real
mstyp
Contact class
sboxid
sfm
real
sfmt
real
sfs
real
sfst
real
spr
ssid
sst
real
sstyp
type
string
vc
real
vdc
real
vsf
real
real
Description
alpha real
beta
real
mtcj
Keywords 313
Contact class
Contact
tsvx
real
tsvy
real
tsvz
real
Description
dbdth
real
dbpid
dfscl
real
eloff
lceps
lceps2 integer Loadcurve ID for plastic strain vs. parametric coord (elements moved > offset)
lcidnf
lcidrf
real
tscale
integer
distance offset
Description
isym
Description
lcid1
lcid2
Description
fcm
lcid
us
real
Type
algo
Keywords 314
Description
March 2016
Contact
b
bc_flg
Contact class
real
ftoslv
real
h0
real
real
lcfdt
lcfst
lch
lmax
real
lmin
real
Description
ct2cn real
eraten real
erates real
mes
real
nen
real
nfls
real
Critical distance
sfls
real
Type
Description
bucket
March 2016
Keywords 315
Contact class
Contact
pensf
real
Type
Description
bsort
depth
frcfrq
lcidab
maxpar real
sbopt
real
sofscl
real
soft
Type
i2d3d
isym
penmax real
Description
shlthk
sldstf
real
sldthk
real
snlog
thkopt
Description
cid_rcf integer Coordinate system ID to output rcforc force resultants and ncforc data in a local system
dprfac real
dtstif
real
flangl
real
igap
Description
dnlscl real
dtpchk real
Keywords 316
March 2016
Contact
fnlscl
real
q2tri
sfnbr
real
Contact class
tiedid
Type
Description
float
ftorq
icor
ipback
region
sharec
srnde
Description
ignroff integer Flag to ignore the thickness offset for shells in the calculation of the shell contact penetration depth.
pstiff
integer Flag to choose the method for calculating the penalty stiffness
Detailed Description
The Contact class allows you to create, modify, edit and contact cards. See the documentation below for more details.
Constructor
new Contact(Model[Model], type[string], id (optional)[integer], heading
(optional)[string])
Description
Create a new Contact object.
Arguments
Name
Type
Model
type
string
id (optional)
Description
Type of contact
March 2016
Keywords 317
Contact class
Contact
Return type
Contact object
Example
To create a new AUTOMATIC_GENERIC contact n model m with label 10 and title "Test contact"
var c = new Contact(m, "AUTOMATIC_GENERAL", 10, "Test contact");
Details of functions
Blank()
Description
Blanks the contact
Arguments
No arguments
Return type
No return value
Example
To blank contact c:
c.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the contacts in model m:
Contact.BlankAll(m);
Keywords 318
March 2016
Contact
Contact class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the contacts in model m flagged with f:
Contact.BlankFlagged(m, f);
Blanked()
Description
Checks if the contact is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if contact c is blanked:
if (c.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse contact c:
c.Browse();
March 2016
Keywords 319
Contact class
Contact
ClearFlag(flag[Flag])
Description
Clears a flag on the contact.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for contact c:
c.ClearFlag(f);
Constrained(connection[boolean])
Description
see if tied/spotweld contact uses constrained formulation
Arguments
Name
Type
Description
connection boolean if true will only consider conntacts used for primer connections
Return type
logical
Example
To see if contact is of type tied and constrained
c.Constrained();
Copy(range (optional)[boolean])
Description
Copies the contact.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Keywords 320
March 2016
Contact
Contact class
Example
To copy contact c into contact z:
var z = c.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Contact object (or null if not made)
Example
To start creating a contact in model m:
var c = Contact.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit contact c:
c.Edit();
March 2016
Keywords 321
Contact class
Contact
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for contact c:
c.Error("My custom error");
FindInteractions() [deprecated]
This function is deprecated in version 11.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.
Use Contact.Interactions() instead.
First(Model[Model]) [static]
Description
Returns the first contact in the model.
Arguments
Name Type
Description
Return type
Contact object (or null if there are no contacts in the model).
Example
To get the first contact in model m:
var c = Contact.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Keywords 322
March 2016
Contact
Contact class
Return type
Contact label.
Example
To get the first free contact label in model m:
var label = Contact.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the contacts with flag f in model m:
Contact.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the contact is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if contact c has flag f set on it:
if (c.Flagged(f) ) do_something...
March 2016
Keywords 323
Contact class
Contact
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the contacts in model m:
Contact.ForEach(m, test);
function test(c)
{
// c is Contact object
}
To call function test for all of the contacts in model m with optional object:
var data = { x:0, y:0 };
Contact.ForEach(m, test, data);
function test(c, extra)
{
// c is Contact object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Contact objects for all of the contacts in a model in Primer
Arguments
Name Type
Description
Return type
Array of Contact objects
Example
To make an array of Contact objects for all of the contacts in model m
var c = Contact.GetAll(m);
Keywords 324
March 2016
Contact
Contact class
Arguments
Name Type
Description
Flag
Return type
Array of Contact objects
Example
To make an array of Contact objects for all of the contacts in model m flagged with f
var c = Contact.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the contact you want the Contact object for
Return type
Contact object (or null if contact does not exist).
Example
To get the Contact object for contact 100 in model m
var c = Contact.GetFromID(m, 100);
GetParameter(prop[contact property])
Description
Checks if a Contact 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 Contact.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
March 2016
Keywords 325
Contact class
Contact
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Contact property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if Contact property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Interactions()
Description
Finds slave nodes that are tied to (or penetrate) elements in the contact. Returns an array of objects describing the
interactions, properties of which are object of penetrating node (node), object of penetrated shell (shell), object of
penetrated solid (solid), object of penetrated thickshell (thickshell), object of node 1 of master segment (n1), object of
node 2 of master segment (n2), object of node 3 of master segment (n3), object of node 4 of master segment (n4),
parametric coordinates (s, t) of the slave node projected onto the shell, depth of penetration (pen), thickness of contact
segment (thick) i.e. 0.5*(t1+t2), remaining unpenetrated thickness (rthick), remaining thickness ratio (qthick). Note if
the node penetrates a shell the solid and thickshell objects will be undefined, etc.
Arguments
No arguments
Return type
Array
Example
To get the interactions for contact c:
var interactions = c.Interactions();
for(i=0; i<interactions.length; i++)
{
var node = interactions[i].node;
var shell = interactions[i].shell;
var n1
= interactions[i].n1;
var n2
= interactions[i].n2;
var n3
= interactions[i].n3;
var n4
= interactions[i].n4;
var s
= interactions[i].s;
var t
= interactions[i].t;
var pen
= interactions[i].pen;
var thick = interactions[i].thick;
var rthick = interactions[i].rthick;
var qthick = interactions[i].qthick;
if(shell != undefined)
... process shell ...
}
Keyword()
Description
Returns the keyword for this Contact (*BOUNDARY_PRESCRIBED_MOTION_xxxx). Note that a carriage return
is not added. See also Contact.KeywordCards()
Keywords 326
March 2016
Contact
Contact class
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for Contact c:
var key = c.Keyword();
KeywordCards()
Description
Returns the keyword cards for the Contact. Note that a carriage return is not added. See also Contact.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for Contact c:
var cards = c.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last contact in the model.
Arguments
Name Type
Description
Return type
Contact object (or null if there are no contacts in the model).
Example
To get the last contact in model m:
var c = Contact.Last(m);
March 2016
Keywords 327
Contact class
Contact
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Contact label.
Example
To get the last free contact label in model m:
var label = Contact.LastFreeLabel(m);
Next()
Description
Returns the next contact in the model.
Arguments
No arguments
Return type
Contact object (or null if there are no more contacts in the model).
Example
To get the contact in model m after contact c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Contact label.
Example
To get the next free contact label in model m:
var label = Contact.NextFreeLabel(m);
Keywords 328
March 2016
Contact
Contact class
PenCheck(flag[Flag], eflag[integer])
Description
Flags nodes that penetrate (or tie) in contact
Arguments
Name Type
Description
flag
Flag
eflag
integer Optional flag for elements. If supplied, node will be flagged only if it penetrates (or ties to) an element
that is flagged. Node and element flag may be the same.
Return type
zero if contact successfully checked
Example
To set flag f on slave nodes of Contact c which tie to elements flagged with f:
c.PenCheck(f, f);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the Contact can be picked from any model.
modal
(optional)
boolean 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.
Return type
Contact object (or null if not picked)
Example
To pick a Contact from model m giving the prompt Pick Contact from screen:
var c = Contact.Pick(Pick Contact from screen, m);
Previous()
Description
Returns the previous contact in the model.
Arguments
No arguments
March 2016
Keywords 329
Contact class
Contact
Return type
Contact object (or null if there are no more contacts in the model).
Example
To get the contact in model m before contact c:
var c = c.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the contacts in model m, from 1000000:
Contact.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged contacts will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the contacts in model m flagged with f, from 1000000:
Contact.RenumberFlagged(m, f, 1000000);
Keywords 330
March 2016
Contact
Contact class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only contacts from that model can be selected. If the
Flag
argument is a Flag then only contacts that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any contacts can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of contacts selected or null if menu cancelled
Example
To select contacts from model m, flagging those selected with flag f, giving the prompt Select contacts:
Contact.Select(f, Select contacts, m);
To select contacts, flagging those selected with flag f but limiting selection to contacts flagged with flag l, giving the
prompt Select contacts:
Contact.Select(f, Select contacts, l);
SetFlag(flag[Flag])
Description
Sets a flag on the contact.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for contact c:
c.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the contact. The contact will be sketched until you either call Contact.Unsketch(), Contact.UnsketchAll(),
Model.UnsketchAll(), or delete the model
March 2016
Keywords 331
Contact class
Contact
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the contact is sketched. If omitted redraw is true. If
you want to sketch several contacts and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To sketch contact c:
c.Sketch();
StatusCheck()
Description
Checks sliding contact for crossed edges and penetrations
Arguments
No arguments
Return type
An array containing count of crossed edges, count of penetrations (note if a node penetrates more than one segment, it is
only reported once here)
Example
To check Contact c:
var status = c.StatusCheck(); ncrossed = status[0]; npens = status[1]
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing contacts should be counted. If false or omitted referenced but undefined
contacts will also be included in the total.
Return type
number of contacts
Example
To get the total number of contacts in model m:
var total = Contact.Total(m);
Keywords 332
March 2016
Contact
Contact class
Unblank()
Description
Unblanks the contact
Arguments
No arguments
Return type
No return value
Example
To unblank contact c:
c.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the contacts in model m:
Contact.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
Keywords 333
Contact class
Contact
Example
To unblank all of the contacts in model m flagged with f:
Contact.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all contacts will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the contacts in model m:
Contact.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the contact.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the contact is unsketched. If omitted redraw is true. If
you want to unsketch several contacts and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch contact c:
c.Unsketch();
Keywords 334
March 2016
Contact
Contact class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the contacts 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().
Return type
No return value
Example
To unsketch all contacts in model m:
Contact.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Contact object.
Example
To check if Contact property c.example is a parameter by using the Contact.GetParameter() method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for contact c:
c.Warning("My custom warning");
March 2016
Keywords 335
Contact class
Contact
Xrefs()
Description
Returns the cross references for this contact.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for contact c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the Contact data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Contact.Keyword() and Contact.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for Contact c in keyword format
var data = c.toString();
Keywords 336
March 2016
Control
Control class
Control class
The Control class gives you access to control cards in PRIMER. More...
Control properties
Name
Type
Description
accuracy
adapstep
adaptive
adaptive_curve
ale
bulk_viscosity
check
coarsen
contact
coupling
cpm
cpu
debug
discrete_element
dynamic_relaxation
efg
energy
explosive_shadow
forming_initial_thickness
forming_maxid
forming_position
forming_pre_bending
forming_projection
forming_stoning
forming_template
forming_travel
forming_trim_merge
forming_unflanging
forming_user
frequency_response_function
hourglass
Keywords 337
Control class
Control
implicit_auto
implicit_buckle
implicit_consistent_mass
implicit_dynamics
implicit_eigenvalue
implicit_explicit_hybrid
implicit_forming
implicit_general
implicit_inertia_relief
implicit_joints
implicit_modal_dynamic
implicit_modes
implicit_solution
implicit_solver
implicit_stabilization
implicit_static_condensation
implicit_termination
mpp_contact_groupable
mpp_decomposition_automatic
mpp_decomposition_bagref
mpp_decomposition_check_speed
Object *CONTROL_MPP_DECOMPOSITION_CONTACT_ISOLATE
card
mpp_decomposition_disable_unref_
curves
Object *CONTROL_MPP_DECOMPOSITION_DISABLE_UNREF_
CURVES card
mpp_decomposition_distribute_ale_
elements
Object *CONTROL_MPP_DECOMPOSITION_DISTRIBUTE_ALE_
ELEMENTS card
mpp_decomposition_distribute_sph_
elements
Object *CONTROL_MPP_DECOMPOSITION_DISTRIBUTE_SPH_
ELEMENTS card
mpp_decomposition_elcost
mpp_decomposition_file
mpp_decomposition_method
mpp_decomposition_numproc
mpp_decomposition_outdecomp
mpp_decomposition_parts_distribute
Object *CONTROL_MPP_DECOMPOSITION_PARTS_DISTRIBUTE
card
Keywords 338
March 2016
Control
Control class
mpp_decomposition_scale_contact_
cost
Object *CONTROL_MPP_DECOMPOSITION_SCALE_CONTACT_
COST card
mpp_decomposition_scale_factor_sph
Object *CONTROL_MPP_DECOMPOSITION_SCALE_FACTOR_SPH
card
mpp_decomposition_show
mpp_decomposition_transformation
Object *CONTROL_MPP_DECOMPOSITION_TRANSFORMATION
card
mpp_io_binoutonly
mpp_io_lstc_reduce
mpp_io_nod3dump
mpp_io_nodump
mpp_io_nofail
mpp_io_nofull
mpp_io_swapbytes
mpp_mat_model_driver
nonlocal
output
parallel
pore_air
pore_fluid
pwp_auto_tmf
remesh
rigid
shell
solid
solution
sph
spotweld_beam
staged_construction
start
steady_state_rolling
structured
termination
thermal_eigenvalue
thermal_nonlinear
March 2016
Keywords 339
Control class
Control
thermal_solver
thermal_timestep
timestep
units
vibro_acoustic
Type
Description
exists
iacc
include integer The Include file number that the control card is in.
inn
osu
Type
Description
dfactr
real
exists
factin
real
include integer The Include file number that the control card is in.
Type
Description
adpass
adpctl
real
adpene
real
adperr
adpfreq real
adpfreq real
adpopt
adpopt
adpsize real
adpsize real
adpth
real
adpth
real
adptol
real
adptol
real
cbirth
real
Keywords 340
March 2016
Control
cbirth
real
cdeath
real
cdeath
real
cnla
real
cnla
real
d3trace
exists
iadpcl
iadpcl
Control class
include
integer The Include file number that the control card is in.
ioflag
ireflg
lcadp
lclvl
maxel
maxlvl
orient
tbirth
real
tdeath
real
Type
Description
exists
idset
include integer The Include file number that the control card is in.
itriopt
itype
smin
real
Type
Description
aafac
real
afac
real
March 2016
Keywords 341
Control class
Control
beamin
real
bfac
real
cfac
real
checkr
real
dct
dfac
real
dtmufac real
ebc
efac
real
end
real
exists
imascl
include
integer The Include file number that the control card is in.
meth
mmgpref integer Selects the method that is used to include a reference pressure in a calculation involving ALE
multi-material groups
nadv
nbkt
ncpl
nsidebc
pdifmx
real
pref
real
prit
start
real
vfact
real
Void factor
Type
Description
btype
exists
ibq
include integer The Include file number that the control card is in.
q1
real
q2
real
Type
Description
exists
include integer The Include file number that the control card is in.
Keywords 342
March 2016
Control
Control class
Type
Description
angle
real
exists
n2
n3
n4
n5
n6
n7
n8
nseed
psid
smax
real
Type
Description
dfric
real
ecdt
edc
real
frceng
ftall
icov
igactc
ignore
include integer The Include file number that the control card is in.
interm
islchk
isym
ithcnt
ithoff
integer Flag for offsetting thermal contact surfaces for thick thermal shells
nsbcs
March 2016
Keywords 343
Control class
Control
nserod
orien
outseg
pen_sf
real
penopt
pstiff
ptscl
float
rwksf
real
rwpnal
real
sfric
real
shledg
shlthk
shltrw
real
real
swradf
real
tdcnof
th
real
th_sf
real
thkchg
tiedprj
usrfrc
usrstr
vfc
real
xpene
real
Type
Description
exists
flipx
flipy
flipz
include integer The Include file number that the control card is in.
Keywords 344
March 2016
Control
Control class
real
unforc real
unleng real
untime real
Type
Description
cpmerr
exists
include
integer The Include file number that the control card is in.
np2p
sffdc
float
Type
cputim real
Description
Max permitted cpu time
exists
iglst
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
ang
real
contact angle
cap
exists
fric
real
friction coefficient
fricr
real
gamma real
gap
real
include integer The Include file number that the control card is in.
ndamp real
normk real
Keywords 345
Control class
Control
sheark real
tdamp
real
vol
real
volume fraction
vtk
Type
Description
drfctr
real
drpset
drterm real
drtol
real
Convergence tolerance
edttl
real
exists
idrflg
include integer The Include file number that the control card is in.
irelal
real
Type
Description
etol
real
exists
hsort
ideb
idila
imlm
integer Choice for matrix operation, linear solving and memory usage
include integer The Include file number that the control card is in.
inint
integer Factor needed for the estimation of maximum workspace used during initialization
Type
Description
exists
hgen
include integer The Include file number that the control card is in.
rwen
rylen
Keywords 346
March 2016
Control
slnten
Control class
Type
Description
exists
include
integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
lcid
pid
vx
float
vy
float
vz
float
x0
float
y0
float
z0
float
Type
Description
exists
include integer The Include file number that the control card is in.
maxide integer Element ID number
maxidn integer Node ID number
pid
Type
exists
include
integer The Include file number that the control card is in.
pid
integer Part ID
premove real
target
Description
integer
March 2016
Keywords 347
Control class
Control
Name
Type
Description
cx
real
cy
real
cz
real
exists
include integer The Include file number that the control card is in.
pset
radius
real
Radius of pre-bending
vx
real
vy
real
vz
real
Type
Description
exists
gap
real
idpm
idps
Minimum gap
include integer The Include file number that the control card is in.
nrmst
nrsst
Type
Description
direct
float
exists
include integer The Include file number that the control card is in.
istone
itype
length
float
node1
step
float
v1
float
v2
float
v3
float
Keywords 348
March 2016
Control
width
float
Control class
Type
Description
al_fe
string
amax
real
blkid
integer Part (stype=0) or part set (stype=1) ID that defines the blank
bndl
bndu
d3plt
density real
Density
dieid
real
exists
fs
real
Friction coefficient
gap
real
Youngs modulus
real
lcss
lvlada
mtyp
real
patern
pnch
pr
real
Poissons ratio
prebd
real
r00
real
r45
real
r90
real
sizeada real
stype
thick
real
Blank thickness
timsada integer Total number of adaptive steps during the forming simulation
unit
vid
vmax
real
vx
real
vy
real
March 2016
Keywords 349
Control class
vz
real
Control
Z vector component of movement of punch
Type
Description
exists
real
include integer The Include file number that the control card is in.
phase
pid
target
travel
real
vid
Type
Description
exists
gapm
float
Gap distance between two open ends of a trim loop curve in the model
Type
Description
dist
real
dvid
exists
iflimit
include
integer The Include file number that the control card is in.
real
Unflanging stiffness
stfcnt
real
Normal stiffness
Type
Description
adatims integer Total number of adaptive steps during the forming simulation
al_fe
string
amax
real
blank
Keywords 350
March 2016
Control
d3plot
Control class
density real
Density
real
Youngs modulus
exists
fs
real
Friction coefficient
gap
real
include integer The Include file number that the control card is in.
k
real
lcss
lvlada
mtype
real
patern
pr
real
Poissons ratio
r00
real
r45
real
r90
real
sizeada real
stype
thick
real
unit
vmax
real
Blank thickness
Type
Description
dampf
real
dmpmas real
dmpstf
real
dof1
dof2
exists
fmax
real
fmin
real
fnmax
real
include
integer The Include file number that the control card is in.
lcdam
lctyp
March 2016
Keywords 351
Control class
Control
n1
integer Node (n1typ=0) / node set (n1typ=1) /segment set (n1typ=2) ID for excitation input
n1typ
integer Type of N1
n2
integer Node (n2typ=0) /node set (n2typ=1) /segment set (n2typ=2) ID for response output
n2typ
integer Type of N2
nfreq
restrt
vad1
vad2
vid
Type
Description
exists
f_936
ihq
include integer The Include file number that the control card is in.
qh
real
Type
Description
dtexp
real
dtmax
dtmin
real
exists
iauto
include integer The Include file number that the control card is in.
iteopt
itewin
Type
Description
include integer The Include file number that the control card is in.
nmode integer number of buckling modes to calculate
Keywords 352
March 2016
Control
Name
Type
exists
iflag
Control class
Description
include integer The Include file number that the control card is in.
Type
Description
alpha
real
beta
real
exists
gamma real
imass
include integer The Include file number that the control card is in.
irate
tdybir
tdybur real
burial
tdydth real
death
Type
Description
center
real
Centre frequency
eigmth
ibeam
include integer The Include file number that the control card is in.
ishell
isolid
itshell
lflag
lftend
real
mstres
mstrscl real
neig
rflag
rhtend
real
shfscl
real
Shift scale
March 2016
Keywords 353
Control class
Control
Name
Type
Description
exists
include integer The Include file number that the control card is in.
psid
Type
Description
birth
float
birth time
death
float
death time
exists
include integer The Include file number that the control card is in.
ioption integer 1:gravity 2:binder
nsmax integer max number of implicit steps
nsmin
penchk float
Type
Description
cnstn
dt0
real
exists
form
igs
Type
Description
exists
include integer The Include file number that the control card is in.
ircnt
irflag
thresh
real
Type
Keywords 354
Description
March 2016
Control
exists
icylin
Control class
include integer The Include file number that the control card is in.
irevol
ispher
Type
exists
filename string
Description
include
integer The Include file number that the control card is in.
mdflag
zeta
float
Type
exists
ibase
include
integer The Include file number that the control card is in.
neig
nsida
nsidc
opt
se_damp
string
se_filename string
Description
se_inert
string
se_mass
string
se_stiff
string
Type
Description
abstol
real
arcalf
arcctl
arcdir
real
March 2016
Keywords 355
Control class
Control
arctim
awgt
real
cpchk
d3itctl
dctol
real
diverg
weight factor
real
exists
ilimit
include integer The Include file number that the control card is in.
irad
real
curve factor
istif
lsdir
lsmtd
lstol
real
rctol
real
srad
real
radius of influence
sred
real
Type
Description
real
AUTOSPC tolerance
drcm
drcprm
real
exists
include
integer The Include file number that the control card is in.
lcpack
lprint
lsolvr
order
March 2016
Control
Name
Type
exists
ias
Control class
Description
include integer The Include file number that the control card is in.
scale
tend
real
End time
tstart
real
Start time
Type
binary
exists
include
integer The Include file number that the control card is in.
sc_flag
sc_nsid
sc_psid
se_filename string
Description
File name
se_inert
string
se_mass
string
se_stiff
string
Type
Description
delta1
real
deltau
real
exists
ietol
real
include integer The Include file number that the control card is in.
ketol
real
nstep
tetol
real
Type
Description
exists
grp
include integer The Include file number that the control card is in.
March 2016
Keywords 357
Control class
Control
Name
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
id1
id2
id3
id4
id5
include integer The Include file number that the control card is in.
Type
Description
exists
id1
id2
id3
id4
id5
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Keywords 358
March 2016
Control
Control class
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
itype
Type
Description
exists
include integer The Include file number that the control card is in.
name
string
decomposition file
Type
Description
exists
include integer The Include file number that the control card is in.
name
string
decomposition method
Type
Description
exists
include integer The Include file number that the control card is in.
n
Type
Description
exists
March 2016
Keywords 359
Control class
Control
include integer The Include file number that the control card is in.
itype
Type
Description
exists
id10
id11
id12
id13
id14
id15
id16
id1
id2
id3
id4
id5
id6
id7
id8
id9
include integer The Include file number that the control card is in.
Type
exists
id10
id11
id12
id13
id14
id15
id16
id1
id2
id3
id4
Keywords 360
Description
March 2016
Control
id5
id6
id7
id8
id9
Control class
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
name
string
decomposition file
Type
Description
exists
id10
id11
id12
id13
id14
id15
id1
id2
id3
id4
id5
id6
id7
id8
id9
include integer The Include file number that the control card is in.
sf
real
Scale factor
Type
Description
exists
include integer The Include file number that the control card is in.
March 2016
Keywords 361
Control class
sf
real
Control
Scale factor
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Keywords 362
Description
March 2016
Control
exists
Control class
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
Type
Description
exists
include integer The Include file number that the control card is in.
mem
Type
Description
cdetol
real
eocs
exists
frfreq
gmdt
real
iaccop
ierode
iflush
ikedit
include
integer The Include file number that the control card is in.
ip1dblt
ipcurv
ipnint
iprtf
minfo
msgflg
Keywords 363
Control class
Control
newleg
npopt
nrefup
opifs
real
solsig
tet10
tolev
Type
Description
include integer The Include file number that the control card is in.
ncpu
Type
Description
air_p
real
air_ro
real
anamsg integer Flag to turn off printing of pore air analysis status message
eterm
real
exists
include integer The Include file number that the control card is in.
Type
Description
atype
conmax real
damping factor
conv
real
conduction factor
datum
real
Z elevation of datum
eterm
real
etflag
exists
fmax
real
fmin
real
ftied
real
Analysis type
grav
real
Keywords 364
March 2016
Control
Control class
include integer The Include file number that the control card is in.
output
pf_bulk real
pf_rho
real
targ
real
therm
real
tmf
wtable
real
Type
dpwmax real
Description
Max rate of change of pwp water head (m/s)
exists
fmax
real
fmin
real
include
integer The Include file number that the control card is in.
sprfac
real
targ
real
Type
Description
cid
dtmin
real
efg
exists
iaat
iat
iat1
real
iat2
real
iat3
real
icurv
ier
include integer The Include file number that the control card is in.
ivt
mfrac
real
mm
rmax
real
rmin
real
segang real
March 2016
Keywords 365
Control class
vfloss
real
Control
necessary VF loss for remesh
Type
Description
exists
include integer The Include file number that the control card is in.
jntf
lmf
plotel
rbsms
integer Flag to apply consistent treatment of rigid bodies in selective mass scaling
sparse
integer Use sparse xply routines for modal & stiffness damping matrices
Type
Description
bwc
cntco
cstyp6
delfr
esort
excl
exists
include integer The Include file number that the control card is in.
intgrd
intperr
integer Flag for behavior in case of unwanted interp. or extrap. of initial stresses
irnxx
irquad
istupd
itsflg
keepcs
lamsht
miter
nfail1
nfail4
proj
Keywords 366
March 2016
Control
psnfail
Control class
real
sidt4tu
integer part set for type 4 thickness update where elastic strains are ignored.
stretch
real
theory
tshell
wmode real
wrpang real
Type
Description
esort
exists
pm10
pm2
pm3
pm4
pm5
pm6
pm7
pm8
pm9
psfail
Type
Description
exists
include integer The Include file number that the control card is in.
isnan
lcint
nlq
March 2016
Keywords 367
Control class
soln
Control
Type
Description
boxid
cont
deriv
dt
real
exists
form
iavis
icont
idim
ierod
Death time
include integer The Include file number that the control card is in.
ini
ishow
isymp
maxv
real
max velocity
start
real
start time
Type
Description
bmsid
exists
id_off
include integer The Include file number that the control card is in.
lcs
lct
prtflg
rpbhx
t_ors
t_ort
Type
Description
accel
real
gravity
Keywords 368
March 2016
Control
Control class
fact
real
include integer The Include file number that the control card is in.
nopdel integer Treatment of pressure loads on deleted elements
stge
stgs
stref
tstart
real
start time
Type
begtim real
exists
Description
start time
include integer The Include file number that the control card is in.
Type
Description
exists
imass
include integer The Include file number that the control card is in.
ivel
lcdmu
lcdmur integer Loadcurve for scaling friction forces during dynamic relaxation
scl_k
Type
Description
exists
include integer The Include file number that the control card is in.
term
Type
Description
dtmin
real
endmas real
endtim real
Termination time
March 2016
Keywords 369
Control class
exists
Control
include integer The Include file number that the control card is in.
nosol
Type
Description
exists
include integer The Include file number that the control card is in.
neig
Type
Description
dcp
real
exists
include integer The Include file number that the control card is in.
lumpbc integer lump boundary condition
nlthpr
phchpn real
real
tol
real
Type
Description
abstol
real
atype
cgtol
real
dtvf
real
eqheat
exists
fwork
real
gpt
include integer The Include file number that the control card is in.
maxitr
real
ptype
reltol
real
Keywords 370
Relaxation parameter
March 2016
Control
sbc
real
solver
tsf
Control class
Type
Description
dtemp
real
exists
include integer The Include file number that the control card is in.
its
real
lcts
tip
real
tmax
real
tmin
real
ts
tscp
real
Type
Description
dt2ms
real
dt2msf real
Scale factor for initial timestep size to determine min permitted time step size
real
erode
exists
imscl
include integer The Include file number that the control card is in.
isdo
lctm
ms1st
rmscl
tslimt
real
tssfac
real
Type
Description
exists
include
integer The Include file number that the control card is in.
March 2016
Keywords 371
Control class
Control
length
string
length_
scale
float
mass
string
mass_
scale
float
temp
string
time
string
time_scale float
Type
Description
exists
include integer The Include file number that the control card is in.
ipanelu integer Number of strips in U direction
ipanelv integer Number of strips in V direction
nmdstr integer Number of modes in modal stress/strain output
restrt
vaflag
vaplot
varms
vastrs
Detailed Description
The Control class allows you to create, modify, edit and manipulate control cards. Unlike other classes there is no
constructor and there are no functions. Instead a Control object is available as the control property of a Model object.
This object allows you to access all of the control cards.
For example, to activate control card *CONTROL_TERMINATION in model m and set endtim to 0.1.
m.control.termination.exists = true;
m.control.termination.endtim = 0.1;
See the properties for more details.
Keywords 372
March 2016
Damping
Damping class
Damping class
The Damping class gives you access to damping cards in PRIMER. More...
Damping properties
Name Type
Description
Type
Description
exists
include integer The Include file number that the damping card is in.
lcid
srx
real
sry
real
srz
real
stx
real
sty
real
stz
real
valdmp real
Detailed Description
The Damping class allows you to create, modify, edit and manipulate damping cards. Unlike other classes there is no
constructor and there are no functions. Instead a Damping object is available as the damping property of a Model object.
This object allows you to access the damping cards.
For example, to activate damping card *DAMPING_GLOBAL in model m and set valdmp to 0.001.
m.damping.global.exists = true;
m.damping.global.valdmp = 0.001;
See the properties for more details.
March 2016
Keywords 373
Database class
Database
Database class
The Database class gives you access to database cards in PRIMER. More...
Database properties
Name
Type
Description
abstat
atdout
bearing
binary
bndout
dcfail
defgeo
deforc
elout
gceout
glstat
h3out
jntforc
matsum
ncforc
nodfor
nodout
pbstat
pllyout
rbdout
rcforc
rwforc
sbtout
secforc
sleout
spcforc
sphout
swforc
Keywords 374
March 2016
Database
tprint
trhist
Database class
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
blstfor
March 2016
Keywords 375
Database class
Database
d3plot
d3prop
d3thdt
demfor
fsifor
fsilnk
intfor
runrsf
xtfile
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
cycl
exists
include integer The Include file number that the database binary card is in.
Type
Description
cycl
exists
include integer The Include file number that the database binary card is in.
Keywords 376
March 2016
Database
Database class
Type
Description
dt
real
exists
iavg
include integer The Include file number that the database binary card is in.
istats
tstart
real
Start time
Type
Description
beam
dt
real
exists
include integer The Include file number that the database binary card is in.
lcdt
npltc
psetid
Type
Description
beam
cutoff
real
Frequency cut-off C in Hz
dt
real
exists
include integer The Include file number that the database binary card is in.
ioopt
lcdt
npltc
pset
psetid
rate
real
type
window real
Width of the window in units of time for storing single, forward filtering
Type
Description
exists
ifile
Keywords 377
Database class
imatl
Database
include integer The Include file number that the database binary card is in.
iwall
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
lcdt
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
lcdt
Type
cycl
Keywords 378
Description
March 2016
Database
exists
Database class
include integer The Include file number that the database binary card is in.
nr
Type
Description
dt
real
exists
include integer The Include file number that the database binary card is in.
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
March 2016
Keywords 379
Database class
Database
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
binary
dt
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Keywords 380
March 2016
Database
Name
Type
Database class
Description
dcomp
dtdt
engflg
epsflg
exists
hydro
include integer The Include file number that the database card is in.
intout
string
maxint
msscl
n3thdt
neipb
neiph
neips
nintsld
nodout
string
pkp_sen integer Flag to output peak pressure and surface energy for each contact interface
resplt
rltflg
sclp
real
shge
sigflg
strflg
stssz
therm
Type
Description
exists
ieverp
include integer The Include file number that the database card is in.
maxint integer #integration points for shell output
March 2016
Keywords 381
Database class
Database
neiph
neips
shge
sigflg
strflg
stssz
Type
Description
exists
ieverf
include integer The Include file number that the database card is in.
nfail
nforc
ngapc
nglbv
nwear
nwusr
Type
Description
exists
include integer The Include file number that the database card is in.
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Keywords 382
March 2016
Database
Database class
Type
Description
binary
dt
real
exists
include
integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
March 2016
Keywords 383
Database class
Name
Type
Database
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
binary
dt
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
option1 real
option2 integer Flag for binary file for high frequency output
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Keywords 384
Description
March 2016
Database
Database class
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
March 2016
Keywords 385
Database class
Database
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Keywords 386
March 2016
Database
Database class
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Type
Description
real
exists
include integer The Include file number that the database card is in.
ioopt
lcur
Detailed Description
The Database class allows you to create, modify, edit and manipulate database cards. Unlike other classes there is no
constructor and there are no functions. Instead a Database object is available as the database property of a Model object.
This object allows you to access all of the database cards.
For example, to activate database card *DATABASE_SWFORC in model m and set dt to 0.001.
m.database.swforc.exists = true;
m.database.swforc.dt = 0.001;
See the properties for more details.
March 2016
Keywords 387
CrossSection class
Database
CrossSection class
The CrossSection class gives you access to database cross section cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
ElemCut(Shell label[integer])
Error(message[string], details (optional)[string])
FlagCut(Flag[Flag])
Flagged(flag[Flag])
GetParameter(prop[cross section property])
Keyword()
KeywordCards()
Next()
PartCut(Part label[integer], Flag (optional)[Flag])
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
CrossSection constants
Name
Description
SET is *DATABASE_CROSS_SECTION_SET.
CrossSection properties
Keywords 388
March 2016
Database
CrossSection class
Name
Type
Description
bsid
integer
csid
integer
dsid
integer
exists
logical
true if database cross section exists, false if referred to but not defined. (read only)
heading string
hsid
integer
id
integer
idset
logical
include integer
The Include file number that the database cross section is in.
itype
integer
label
integer
lenl
float
Length of L edge.
lenm
float
Length of M edge.
model
integer
nsid
integer
option
psid
integer
radius
float
Radius.
ssid
integer
tsid
integer
xch
float
xct
float
xhev
float
ych
float
yct
float
yhev
float
zch
float
zct
float
zhev
float
Detailed Description
The CrossSection class allows you to create, modify, edit and manipulate database cross section cards. See the
documentation below for more details.
March 2016
Keywords 389
CrossSection class
Database
Constructor
new CrossSection(Model[Model], option[constant], nsid[integer], hsid[integer],
bsid[integer], ssid[integer], tsid[integer], dsid[integer], id (optional)[integer],
itype (optional)[integer], csid (optional)[integer], heading (optional)[string])
Description
Create a new CrossSection object for *DATABASE_CROSS_SECTION_SET.
Arguments
Name
Type
Description
Model
Model
option
nsid
integer
hsid
integer
bsid
integer
ssid
integer
tsid
integer
dsid
integer
id (optional)
integer
itype (optional)
integer
csid (optional)
integer
Return type
CrossSection object
Example
To create a new Database cross section 500 called "test cross_section" of type _SET in model m with nsid, hsid, bsid,
ssid, tsid, dsid, id, itype set to 11, 12, 13, 14, 15, 16, 17, 2 respectively:
var c = new CrossSection(m, CrossSection.SET, 11, 12, 13, 14, 15, 16, 17, 2,
500, "test cross_section");
Keywords 390
March 2016
Database
CrossSection class
Arguments
Name
Type
Description
Model
Model
option
psid
integer
xct
float
yct
float
zct
float
xch
float
ych
float
zch
float
xhev
float
yhev
float
zhev
float
lenl (optional)
float
Length in l direction.
lenm (optional)
float
Length in m direction.
id (optional)
integer
itype (optional)
integer
csid (optional)
integer
Return type
CrossSection object
Example
To create a new Database cross section 500 called "test cross_section" of type _PLANE in model m with part set ID
100, normal tail (10, 20, 30), normal head (20, 20, 30), head of edge vector (10, 30, 30) and edge lengths 50 and 100:
var c = new CrossSection(m, CrossSection.PLANE, 100, 10, 20, 30, 20, 20, 30, 10,
30, 30, 50, 100, 0, 0, 500, "test cross_section");
Details of functions
Blank()
Description
Blanks the cross section
Arguments
No arguments
Return type
No return value
March 2016
Keywords 391
CrossSection class
Database
Example
To blank cross section c:
c.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the cross sections in model m:
CrossSection.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the cross sections in model m flagged with f:
CrossSection.BlankFlagged(m, f);
Blanked()
Description
Checks if the cross section is blanked or not.
Keywords 392
March 2016
Database
CrossSection class
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if cross section c is blanked:
if (c.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse cross section c:
c.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the cross section.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for cross section c:
c.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the cross section.
March 2016
Keywords 393
CrossSection class
Database
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy cross section c into cross section z:
var z = c.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
CrossSection object (or null if not made)
Example
To start creating a cross section in model m:
var c = CrossSection.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit cross section c:
c.Edit();
Keywords 394
March 2016
Database
CrossSection class
ElemCut(Shell label[integer])
Description
Returns coordinates of the intersections between a shell and a database cross section. Note, ElemCut on the Shell class
may be quicker
Arguments
Name
Type
Description
Return type
An array containing the x1,y1,z1,x2,y2,z2 coordinates of the cut line, or NULL if it does not cut. Note this function
does not check that the shell is in the cross section definition (part set)
Example
To get the cut line coordinates between database cross section x and shell 300:
var data = x.ElemCut(300)
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for cross section c:
c.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first cross section in the model.
Arguments
Name Type
Description
Return type
CrossSection object (or null if there are no cross sections in the model).
March 2016
Keywords 395
CrossSection class
Database
Example
To get the first cross section in model m:
var c = CrossSection.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
CrossSection label.
Example
To get the first free cross section label in model m:
var label = CrossSection.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the cross sections with flag f in model m:
CrossSection.FlagAll(m, f);
FlagCut(Flag[Flag])
Description
Flags every element (solid,shell,tshell,beam) cut by the cross section. Note this function does not check that the element
is in the cross section definition (part set)
Keywords 396
March 2016
Database
CrossSection class
Arguments
Name Type Description
Flag
Return type
Boolean.
Example
To find elements cut by database cross section x:
x.FlagCut(flag)
Flagged(flag[Flag])
Description
Checks if the cross section is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if cross section c has flag f set on it:
if (c.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 397
CrossSection class
Database
Example
To call function test for all of the cross sections in model m:
CrossSection.ForEach(m, test);
function test(c)
{
// c is CrossSection object
}
To call function test for all of the cross sections in model m with optional object:
var data = { x:0, y:0 };
CrossSection.ForEach(m, test, data);
function test(c, extra)
{
// c is CrossSection object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of CrossSection objects for all of the cross sections in a model in Primer
Arguments
Name Type
Description
Return type
Array of CrossSection objects
Example
To make an array of CrossSection objects for all of the cross sections in model m
var c = CrossSection.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of CrossSection objects
Example
To make an array of CrossSection objects for all of the cross sections in model m flagged with f
var c = CrossSection.GetFlagged(m, f);
Keywords 398
March 2016
Database
CrossSection class
Arguments
Name
Type
Description
Model
number integer number of the cross section you want the CrossSection object for
Return type
CrossSection object (or null if cross section does not exist).
Example
To get the CrossSection object for cross section 100 in model m
var c = CrossSection.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if CrossSection property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if CrossSection property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Keyword()
Description
Returns the keyword for this cross_section (*DATABASE_CROSS_SECTION). Note that a carriage return is not
added. See also CrossSection.KeywordCards()
March 2016
Keywords 399
CrossSection class
Database
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for cross_section c:
var key = c.Keyword();
KeywordCards()
Description
Returns the keyword cards for the cross_section. Note that a carriage return is not added. See also
CrossSection.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for cross_section c:
var cards = c.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last cross section in the model.
Arguments
Name Type
Description
Return type
CrossSection object (or null if there are no cross sections in the model).
Example
To get the last cross section in model m:
var c = CrossSection.Last(m);
Keywords 400
March 2016
Database
CrossSection class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
CrossSection label.
Example
To get the last free cross section label in model m:
var label = CrossSection.LastFreeLabel(m);
Next()
Description
Returns the next cross section in the model.
Arguments
No arguments
Return type
CrossSection object (or null if there are no more cross sections in the model).
Example
To get the cross section in model m after cross section c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
CrossSection label.
Example
To get the next free cross section label in model m:
var label = CrossSection.NextFreeLabel(m);
March 2016
Keywords 401
CrossSection class
Database
Arguments
Name
Type
Part label
Description
Optional Flag to flag the element which are cut by the cross section.
Return type
Boolean.
Example
To know if a database cross section x cuts part 300:
x.PartCut(300)
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the cross_section can be picked from any
model.
modal
(optional)
boolean 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.
Return type
CrossSection object (or null if not picked)
Example
To pick a cross_section from model m giving the prompt Pick cross_section from screen:
var cross_section = CrossSection.Pick(Pick cross_section from screen, m);
Previous()
Description
Returns the previous cross section in the model.
Arguments
No arguments
Keywords 402
March 2016
Database
CrossSection class
Return type
CrossSection object (or null if there are no more cross sections in the model).
Example
To get the cross section in model m before cross section c:
var c = c.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the cross sections in model m, from 1000000:
CrossSection.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged cross sections will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the cross sections in model m flagged with f, from 1000000:
CrossSection.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 403
CrossSection class
Database
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only cross sections from that model can be selected. If the
Flag
argument is a Flag then only cross sections that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any cross sections can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of cross sections selected or null if menu cancelled
Example
To select cross sections from model m, flagging those selected with flag f, giving the prompt Select cross sections:
CrossSection.Select(f, Select cross sections, m);
To select cross sections, flagging those selected with flag f but limiting selection to cross sections flagged with flag l,
giving the prompt Select cross sections:
CrossSection.Select(f, Select cross sections, l);
SetFlag(flag[Flag])
Description
Sets a flag on the cross section.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for cross section c:
c.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the cross section. The cross section will be sketched until you either call CrossSection.Unsketch(),
CrossSection.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 404
March 2016
Database
CrossSection class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the cross section is sketched. If omitted redraw is true.
If you want to sketch several cross sections and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch cross section c:
c.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing cross sections should be counted. If false or omitted referenced but
undefined cross sections will also be included in the total.
Return type
number of cross sections
Example
To get the total number of cross sections in model m:
var total = CrossSection.Total(m);
Unblank()
Description
Unblanks the cross section
Arguments
No arguments
Return type
No return value
Example
To unblank cross section c:
c.Unblank();
March 2016
Keywords 405
CrossSection class
Database
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the cross sections in model m:
CrossSection.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the cross sections in model m flagged with f:
CrossSection.UnblankFlagged(m, f);
Keywords 406
March 2016
Database
CrossSection class
Arguments
Name Type
Description
Model Model Model that the defined flag for all cross sections will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the cross sections in model m:
CrossSection.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the cross section.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the cross section is unsketched. If omitted redraw is
true. If you want to unsketch several cross sections and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch cross section c:
c.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the cross sections 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().
Return type
No return value
March 2016
Keywords 407
CrossSection class
Database
Example
To unsketch all cross sections in model m:
CrossSection.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
CrossSection object.
Example
To check if CrossSection property c.example is a parameter by using the CrossSection.GetParameter() method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for cross section c:
c.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this cross section.
Arguments
No arguments
Keywords 408
March 2016
Database
CrossSection class
Return type
Xrefs object.
Example
To get the cross references for cross section c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the cross_section data in keyword format. Note that this contains the keyword header and the
keyword cards. See also CrossSection.Keyword() and CrossSection.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for cross_section c in keyword format
var s = c.toString();
March 2016
Keywords 409
History class
Database
History class
The History class gives you access to database history cards in PRIMER. More...
Class functions
Member functions
Blanked()
ClearFlag(flag[Flag])
Edit(modal (optional)[boolean])
Flagged(flag[Flag])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unsketch(redraw (optional)[boolean])
Xrefs()
toString()
History constants
Name
Description
History.ALL_TYPES
History.BEAM
BEAM is *DATABASE_HISTORY_BEAM.
History.BEAM_SET
BEAM_SET is *DATABASE_HISTORY_BEAM_SET.
History.DISCRETE
DISCRETE is *DATABASE_HISTORY_DISCRETE.
NODE is *DATABASE_HISTORY_NODE.
History.NODE_SET
NODE_SET is *DATABASE_HISTORY_NODE_SET.
History.SEATBELT
SEATBELT is *DATABASE_HISTORY_SEATBELT.
History.SHELL
SHELL is *DATABASE_HISTORY_SHELL.
History.SHELL_SET
SHELL_SET is *DATABASE_HISTORY_SHELL_SET.
History.SOLID
SOLID is *DATABASE_HISTORY_SOLID.
History.SOLID_SET
SOLID_SET is *DATABASE_HISTORY_SOLID_SET.
History.SPH
SPH is *DATABASE_HISTORY_SPH.
History.SPH_SET
SPH_SET is *DATABASE_HISTORY_SPH_SET.
Keywords 410
March 2016
Database
History.TSHELL
TSHELL is *DATABASE_HISTORY_TSHELL.
History.TSHELL_SET
TSHELL_SET is *DATABASE_HISTORY_TSHELL_SET.
History class
History properties
Name
Type
Description
cid
integer
exists
logical
true if database history exists, false if referred to but not defined. (read only)
heading
string
Optional heading
hfo
integer
id
integer
ID of the item
include
integer
local
logical
model
integer
ref
integer
type
(read
only)
Detailed Description
The History class allows you to create, modify, edit and manipulate database history cards. See the documentation
below for more details.
Constructor
new History(Model[Model], type[constant], id[integer], heading
(optional)[string])
Description
Create a new History object.
Arguments
Name
Type
Description
Model
Model
type
id
integer
ID of the item
Optional heading
Return type
History object
March 2016
Keywords 411
History class
Database
Example
To create a new Database history on NODE 500 called "test history":
var c = new History(m, History.NODE, 500, "test history");
Details of functions
BlankAll(Model[Model], type (optional)[constant], redraw (optional)[boolean])
[static]
Description
Blanks all of the database histories in the model.
Arguments
Name
Type
Description
Model
Model
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the database histories in model m:
History.BlankAll(m);
Keywords 412
March 2016
Database
History class
Arguments
Name
Type
Description
Model
Model
flag
Flag
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the database histories in model m flagged with f:
History.BlankFlagged(m, f);
Blanked()
Description
Checks if the database history is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if database history c is blanked:
if (c.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the database history.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Keywords 413
History class
Database
Example
To clear flag f for database history c:
c.ClearFlag(f);
Arguments
Name
Type
Description
Model
Model
type
modal
(optional)
boolean 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.
Return type
History object (or null if not made)
Example
To start creating a history in model m:
var c = History.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel to edit the database history.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
No return value
Example
To edit database history c:
c.Edit();
Keywords 414
March 2016
Database
History class
Arguments
Name
Type
Description
Model
Model
type
constant The database history type. Can be Set.BEAM or History.BEAM or History.BEAM_SET or
(optional)
History.DISCRETE or History.DISCRETE_SET or History.NODE or History.NODE_SET or
History.SEATBELT or History.SHELL or History.SHELL_SET or History.SOLID or
History.SOLID_SET or History.SPH or History.SPH_SET or History.TSHELL or
History.TSHELL_SET or History.ALL_TYPES. If omitted, applied to all database history
types.
Return type
History object (or null if there are no database histories in the model).
Example
To get the first database history in model m:
var history = History.First(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
type
constant The database history type. Can be Set.BEAM or History.BEAM or History.BEAM_SET or
(optional)
History.DISCRETE or History.DISCRETE_SET or History.NODE or History.NODE_SET or
History.SEATBELT or History.SHELL or History.SHELL_SET or History.SOLID or
History.SOLID_SET or History.SPH or History.SPH_SET or History.TSHELL or
History.TSHELL_SET or History.ALL_TYPES. If omitted, applied to all database history
types.
Return type
No return value
Example
To flag all of the database histories with flag f in model m:
History.FlagAll(m, f);
March 2016
Keywords 415
History class
Database
Flagged(flag[Flag])
Description
Checks if the database history is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if database history c has flag f set on it:
if (c.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
type
constant The database history type. Can be Set.BEAM or History.BEAM or History.BEAM_SET or
(optional)
History.DISCRETE or History.DISCRETE_SET or History.NODE or History.NODE_SET or
History.SEATBELT or History.SHELL or History.SHELL_SET or History.SOLID or
History.SOLID_SET or History.SPH or History.SPH_SET or History.TSHELL or
History.TSHELL_SET or History.ALL_TYPES. If omitted, applied to all database history
types.
Return type
Array of History objects
Example
To make an array of History objects for all of the database histories in model m
var database history = History.GetAll(m);
Keywords 416
March 2016
Database
History class
Arguments
Name
Type
Description
Model
database history number integer number of the database history you want the History object for
Return type
History object (or null if database history does not exist).
Example
To get the History object for database history 100 in model m
var database history = History.GetFromID(m, 100);
Keyword()
Description
Returns the keyword for this database history (*DATABASE_HISTORY). Note that a carriage return is not added.
See also History.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for database history c:
var key = c.Keyword();
KeywordCards()
Description
Returns the keyword cards for the database history. Note that a carriage return is not added. See also
History.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for database history c:
var cards = c.KeywordCards();
Keywords 417
History class
Database
Arguments
Name
Type
Description
Model
Model
type
constant The database history type. Can be Set.BEAM or History.BEAM or History.BEAM_SET or
(optional)
History.DISCRETE or History.DISCRETE_SET or History.NODE or History.NODE_SET or
History.SEATBELT or History.SHELL or History.SHELL_SET or History.SOLID or
History.SOLID_SET or History.SPH or History.SPH_SET or History.TSHELL or
History.TSHELL_SET or History.ALL_TYPES. If omitted, applied to all database history
types.
Return type
History object (or null if there are no database histories in the model).
Example
To get the last database history in model m:
var database history = History.Last(m);
Next()
Description
Returns the next database history in the model.
Arguments
No arguments
Return type
History object (or null if there are no more database histories in the model).
Example
To get the database history in model m after database history c:
var database history = c.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the database history can be picked from any
model.
modal
(optional)
boolean 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.
Keywords 418
March 2016
Database
History class
Return type
History object (or null if not picked)
Example
To pick a database history from model m giving the prompt Pick database history from screen:
var database history = History.Pick(Pick database history from screen, m);
Previous()
Description
Returns the previous database history in the model.
Arguments
No arguments
Return type
History object (or null if there are no more database histories in the model).
Example
To get the database history in model m before this one:
var history = history.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
Model
(optional)
Model
Model to limit selection to. If omitted, or null, database histories can be selected from any
model.
modal
(optional)
boolean 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.
Return type
Number of items selected or null if menu cancelled
Example
To select database histories from model m, flagging those selected which flag f, giving the prompt Select database
histories:
History.Select(f, Select database histories, m);
March 2016
Keywords 419
History class
Database
SetFlag(flag[Flag])
Description
Sets a flag on the database history.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for database history c:
c.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the database history. The database history will be sketched until you either call History.Unsketch(),
History.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the database history is sketched. If omitted redraw is
true. If you want to sketch several database histories and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch database history c:
c.Sketch();
Keywords 420
March 2016
Database
History class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
type
(optional)
Return type
No return value
Example
To unblank all of the database histories in model m:
History.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the database histories in model m flagged with f:
History.UnblankFlagged(m, f);
March 2016
Keywords 421
History class
Database
Arguments
Name
Type
Description
Model
Model
Model that the defined flag for all database histories will be unset in
flag
Flag
type
constant The database history type. Can be Set.BEAM or History.BEAM or History.BEAM_SET or
(optional)
History.DISCRETE or History.DISCRETE_SET or History.NODE or History.NODE_SET or
History.SEATBELT or History.SHELL or History.SHELL_SET or History.SOLID or
History.SOLID_SET or History.SPH or History.SPH_SET or History.TSHELL or
History.TSHELL_SET or History.ALL_TYPES. If omitted, applied to all database history
types.
Return type
No return value
Example
To unset the flag f on all the database histories in model m:
History.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the database history.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the database history is unsketched. If omitted redraw is
true. If you want to unsketch several database histories and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch database history c:
c.Unsketch();
Keywords 422
March 2016
Database
History class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the database histories 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().
Return type
No return value
Example
To unsketch all database histories in model m:
History.UnsketchAll(m);
Xrefs()
Description
Returns the cross references for this database history.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for this database history:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the database history data in keyword format. Note that this contains the keyword header and
the keyword cards. See also History.Keyword() and History.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for database history c in keyword format
var s = c.toString();
March 2016
Keywords 423
Database
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[nodal force group property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
NodalForceGroup properties
Name
Type
Description
cid
exists
logical true if Nodal Force Group exists, false if referred to but not defined. (read only)
id
include integer The Include file number that the Nodal Force Group is in.
label
model
integer The Model number that the nodal force group is in.
nsid
Keywords 424
March 2016
Database
Detailed Description
The NodalForceGroup class allows you to create, modify, edit and manipulate nodal force group cards. See the
documentation below for more details.
For convenience "Nfgr" can also be used as the class name instead of "NodalForceGroup".
Constructor
new NodalForceGroup(Model[Model], nsid[integer], cid (optional)[integer])
Description
Create a new NodalForceGroup object.
Arguments
Name
Type
Description
Model
nsid
Return type
NodalForceGroup object
Example
To create a new nodal force group in model m with nsid 100:
var nfg = new NodalForceGroup(m, 100);
Details of functions
Blank()
Description
Blanks the nodal force group
Arguments
No arguments
Return type
No return value
Example
To blank nodal force group nfg:
nfg.Blank();
March 2016
Keywords 425
Database
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the nodal force groups in model m:
NodalForceGroup.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged nodal force groups will be blanked in
flag
Flag
Flag set on the nodal force groups that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the nodal force groups in model m flagged with f:
NodalForceGroup.BlankFlagged(m, f);
Blanked()
Description
Checks if the nodal force group is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Keywords 426
March 2016
Database
Example
To check if nodal force group nfg is blanked:
if (nfg.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the nodal force group.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for nodal force group nfg:
nfg.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the nodal force group.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy nodal force group nfg into nodal force group z:
var z = nfg.Copy();
March 2016
Keywords 427
Database
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for nodal force group nfg:
nfg.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first nodal force group in the model.
Arguments
Name Type
Description
Return type
NodalForceGroup object (or null if there are no nodal force groups in the model).
Example
To get the first nodal force group in model m:
var nfg = NodalForceGroup.First(m);
Arguments
Name Type
Description
Model Model Model that all nodal force groups will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the nodal force groups with flag f in model m:
NodalForceGroup.FlagAll(m, f);
Keywords 428
March 2016
Database
Flagged(flag[Flag])
Description
Checks if the nodal force group is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if nodal force group nfg has flag f set on it:
if (nfg.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 429
Database
Example
To call function test for all of the nodal force groups in model m:
NodalForceGroup.ForEach(m, test);
function test(nfg)
{
// nfg is NodalForceGroup object
}
To call function test for all of the nodal force groups in model m with optional object:
var data = { x:0, y:0 };
NodalForceGroup.ForEach(m, test, data);
function test(nfg, extra)
{
// nfg is NodalForceGroup object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of NodalForceGroup objects for all of the nodal force groups in a model in Primer
Arguments
Name Type
Description
Return type
Array of NodalForceGroup objects
Example
To make an array of NodalForceGroup objects for all of the nodal force groups in model m
var nfg = NodalForceGroup.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the nodal force groups that you want to retrieve
Return type
Array of NodalForceGroup objects
Example
To make an array of NodalForceGroup objects for all of the nodal force groups in model m flagged with f
var nfg = NodalForceGroup.GetFlagged(m, f);
Keywords 430
March 2016
Database
Arguments
Name
Type
Description
Model
number integer number of the nodal force group you want the NodalForceGroup object for
Return type
NodalForceGroup object (or null if nodal force group does not exist).
Example
To get the NodalForceGroup object for nodal force group 100 in model m
var nfg = NodalForceGroup.GetFromID(m, 100);
Arguments
Name Type
prop
Description
nodal force group property nodal force group property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if NodalForceGroup property nfg.example is a parameter:
Options.property_parameter_names = true;
if (nfg.GetParameter(nfg.example) ) do_something...
Options.property_parameter_names = false;
To check if NodalForceGroup property nfg.example is a parameter by using the GetParameter method:
if (nfg.ViewParameters().GetParameter(nfg.example) ) do_something...
Keyword()
Description
Returns the keyword for this nodal force group. Note that a carriage return is not added. See also
NodalForceGroup.KeywordCards()
March 2016
Keywords 431
Database
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for nodal force group nfg:
var key = nfg.Keyword();
KeywordCards()
Description
Returns the keyword cards for the nodal force group. Note that a carriage return is not added. See also
NodalForceGroup.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for nodal force group nfg:
var cards = nfg.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last nodal force group in the model.
Arguments
Name Type
Description
Return type
NodalForceGroup object (or null if there are no nodal force groups in the model).
Example
To get the last nodal force group in model m:
var nfg = NodalForceGroup.Last(m);
Next()
Description
Returns the next nodal force group in the model.
Keywords 432
March 2016
Database
Arguments
No arguments
Return type
NodalForceGroup object (or null if there are no more nodal force groups in the model).
Example
To get the nodal force group in model m after nodal force group nfg:
var nfg = nfg.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the nodal force group can be picked from any
model.
modal
(optional)
boolean 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.
Return type
NodalForceGroup object (or null if not picked)
Example
To pick a nodal force group from model m giving the prompt Pick nodal force group from screen:
var nfg = NodalForceGroup.Pick(Pick nodal force group from screen, m);
Previous()
Description
Returns the previous nodal force group in the model.
Arguments
No arguments
Return type
NodalForceGroup object (or null if there are no more nodal force groups in the model).
Example
To get the nodal force group in model m before nodal force group nfg:
var nfg = nfg.Previous();
March 2016
Keywords 433
Database
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only nodal force groups from that model can be selected. If
Flag
the argument is a Flag then only nodal force groups that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any nodal force groups can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of nodal force groups selected or null if menu cancelled
Example
To select nodal force groups from model m, flagging those selected with flag f, giving the prompt Select nodal force
groups:
NodalForceGroup.Select(f, Select nodal force groups, m);
To select nodal force groups, flagging those selected with flag f but limiting selection to nodal force groups flagged
with flag l, giving the prompt Select nodal force groups:
NodalForceGroup.Select(f, Select nodal force groups, l);
SetFlag(flag[Flag])
Description
Sets a flag on the nodal force group.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for nodal force group nfg:
nfg.SetFlag(f);
Keywords 434
March 2016
Database
Sketch(redraw (optional)[boolean])
Description
Sketches the nodal force group. The nodal force group will be sketched until you either call
NodalForceGroup.Unsketch(), NodalForceGroup.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the nodal force group is sketched. If omitted redraw is
true. If you want to sketch several nodal force groups and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch nodal force group nfg:
nfg.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing nodal force groups should be counted. If false or omitted referenced but
undefined nodal force groups will also be included in the total.
Return type
number of nodal force groups
Example
To get the total number of nodal force groups in model m:
var total = NodalForceGroup.Total(m);
Unblank()
Description
Unblanks the nodal force group
Arguments
No arguments
Return type
No return value
March 2016
Keywords 435
Database
Example
To unblank nodal force group nfg:
nfg.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the nodal force groups in model m:
NodalForceGroup.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the nodal force groups that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the nodal force groups in model m flagged with f:
NodalForceGroup.UnblankFlagged(m, f);
March 2016
Database
Arguments
Name Type
Description
Model Model Model that the defined flag for all nodal force groups will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the nodal force groups in model m:
NodalForceGroup.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the nodal force group.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the nodal force group is unsketched. If omitted redraw
is true. If you want to unsketch several nodal force groups and only redraw after the last one
then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch nodal force group nfg:
nfg.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the nodal force groups 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().
Return type
No return value
March 2016
Keywords 437
Database
Example
To unsketch all nodal force groups in model m:
NodalForceGroup.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
NodalForceGroup object.
Example
To check if NodalForceGroup property nfg.example is a parameter by using the NodalForceGroup.GetParameter()
method:
if (nfg.ViewParameters().GetParameter(nfg.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for nodal force group nfg:
nfg.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this nodal force group.
Arguments
No arguments
Keywords 438
March 2016
Database
Return type
Xrefs object.
Example
To get the cross references for nodal force group nfg:
var xrefs = nfg.Xrefs();
toString()
Description
Creates a string containing the nodal force group data in keyword format. Note that this contains the keyword header
and the keyword cards. See also NodalForceGroup.Keyword() and NodalForceGroup.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for nodal force group n in keyword format
var s = n.toString();
March 2016
Keywords 439
Box class
Define
Box class
The Box class gives you access to define box cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[box property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Box properties
Name
Type
bid
integer Box number. Also see the label property which is an alternative name for this.
cx
float
cy
float
cz
float
exists
logical true if box exists, false if referred to but not defined. (read only)
heading string
Keywords 440
Description
Box heading
March 2016
Define
Box class
include integer The Include file number that the box is in.
label
integer Box number. Also see the bid property which is an alternative name for this.
local
model
xmn
float
Minimum X coordinate
xmx
float
Maximum X coordinate
xv
float
xx
float
ymn
float
Minimum Y coordinate
ymx
float
Maximum Y coordinate
yv
float
yx
float
zmn
float
Minimum Z coordinate
zmx
float
Maximum Z coordinate
zv
float
zx
float
Detailed Description
The Box class allows you to create, modify, edit and manipulate box cards. See the documentation below for more
details.
Constructor
new Box(Model[Model], bid[integer], xmn[float], xmx[float], ymn[float],
ymx[float], zmn[float], zmx[float], heading (optional)[string])
Description
Create a new Box object.
Arguments
Name
Type
Model
bid
xmn
float
Minimum X coordinate
xmx
float
Maximum X coordinate
ymn
float
Minimum Y coordinate
ymx
float
Maximum Y coordinate
zmn
float
Minimum Z coordinate
zmx
float
Maximum Z coordinate
Description
Return type
Box object
March 2016
Keywords 441
Box class
Define
Example
To create a new box in model m with label 200
var b = new Box(m, 200, 1.5, 2.5, 1.0, 4.5, -4.0, 3.0);
Details of functions
Blank()
Description
Blanks the box
Arguments
No arguments
Return type
No return value
Example
To blank box b:
b.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boxs in model m:
Box.BlankAll(m);
Keywords 442
March 2016
Define
Box class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the boxs in model m flagged with f:
Box.BlankFlagged(m, f);
Blanked()
Description
Checks if the box is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if box b is blanked:
if (b.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse box b:
b.Browse();
March 2016
Keywords 443
Box class
Define
ClearFlag(flag[Flag])
Description
Clears a flag on the box.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for box b:
b.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the box.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy box b into box z:
var z = b.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Box object (or null if not made)
Keywords 444
March 2016
Define
Box class
Example
To start creating a box in model m:
var m = Box.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit box b:
b.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for box b:
b.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first box in the model.
March 2016
Keywords 445
Box class
Define
Arguments
Name Type
Description
Return type
Box object (or null if there are no boxs in the model).
Example
To get the first box in model m:
var b = Box.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Box label.
Example
To get the first free box label in model m:
var label = Box.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 446
March 2016
Define
Box class
Example
To flag all of the boxs with flag f in model m:
Box.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the box is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if box b has flag f set on it:
if (b.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 447
Box class
Define
Example
To call function test for all of the boxs in model m:
Box.ForEach(m, test);
function test(b)
{
// b is Box object
}
To call function test for all of the boxs in model m with optional object:
var data = { x:0, y:0 };
Box.ForEach(m, test, data);
function test(b, extra)
{
// b is Box object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Box objects for all of the boxs in a model in Primer
Arguments
Name Type
Description
Return type
Array of Box objects
Example
To make an array of Box objects for all of the boxs in model m
var b = Box.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Box objects
Example
To make an array of Box objects for all of the boxs in model m flagged with f
var b = Box.GetFlagged(m, f);
Keywords 448
March 2016
Define
Box class
Arguments
Name
Type
Description
Model
number integer number of the box you want the Box object for
Return type
Box object (or null if box does not exist).
Example
To get the Box object for box 100 in model m
var b = Box.GetFromID(m, 100);
GetParameter(prop[box property])
Description
Checks if a Box 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 Box.ViewParameters() method and method chaining (see
the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Box property b.example is a parameter:
Options.property_parameter_names = true;
if (b.GetParameter(b.example) ) do_something...
Options.property_parameter_names = false;
To check if Box property b.example is a parameter by using the GetParameter method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Keyword()
Description
Returns the keyword for this box (*DEFINE_BOX). Note that a carriage return is not added. See also
Box.KeywordCards()
March 2016
Keywords 449
Box class
Define
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for box m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the box. Note that a carriage return is not added. See also Box.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for box b:
var cards = b.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last box in the model.
Arguments
Name Type
Description
Return type
Box object (or null if there are no boxs in the model).
Example
To get the last box in model m:
var b = Box.Last(m);
Keywords 450
March 2016
Define
Box class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Box label.
Example
To get the last free box label in model m:
var label = Box.LastFreeLabel(m);
Next()
Description
Returns the next box in the model.
Arguments
No arguments
Return type
Box object (or null if there are no more boxs in the model).
Example
To get the box in model m after box b:
var b = b.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Box label.
Example
To get the next free box label in model m:
var label = Box.NextFreeLabel(m);
March 2016
Keywords 451
Box class
Define
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the box can be picked from any model.
modal
(optional)
boolean 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.
Return type
Box object (or null if not picked)
Example
To pick a box from model m giving the prompt Pick box from screen:
var box = Box.Pick(Pick box from screen, m);
Previous()
Description
Returns the previous box in the model.
Arguments
No arguments
Return type
Box object (or null if there are no more boxs in the model).
Example
To get the box in model m before box b:
var b = b.Previous();
Arguments
Name Type
Description
Return type
No return value
Keywords 452
March 2016
Define
Box class
Example
To renumber all of the boxs in model m, from 1000000:
Box.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged boxs will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the boxs in model m flagged with f, from 1000000:
Box.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only boxs from that model can be selected. If the argument is
Flag
a Flag then only boxs that are flagged with limit can be selected (limit should be different to
flag). If omitted, or null, any boxs can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of boxs selected or null if menu cancelled
March 2016
Keywords 453
Box class
Define
Example
To select boxs from model m, flagging those selected with flag f, giving the prompt Select boxs:
Box.Select(f, Select boxs, m);
To select boxs, flagging those selected with flag f but limiting selection to boxs flagged with flag l, giving the prompt
Select boxs:
Box.Select(f, Select boxs, l);
SetFlag(flag[Flag])
Description
Sets a flag on the box.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for box b:
b.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the box. The box will be sketched until you either call Box.Unsketch(), Box.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the box is sketched. If omitted redraw is true. If you
want to sketch several boxs and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch box b:
b.Sketch();
Keywords 454
March 2016
Define
Box class
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing boxs should be counted. If false or omitted referenced but undefined
boxs will also be included in the total.
Return type
number of boxs
Example
To get the total number of boxs in model m:
var total = Box.Total(m);
Unblank()
Description
Unblanks the box
Arguments
No arguments
Return type
No return value
Example
To unblank box b:
b.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boxs in model m:
Box.UnblankAll(m);
March 2016
Keywords 455
Box class
Define
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the boxs in model m flagged with f:
Box.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all boxs will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the boxs in model m:
Box.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the box.
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the box is unsketched. If omitted redraw is true. If you
want to unsketch several boxs and only redraw after the last one then use false for redraw and
call View.Redraw().
Keywords 456
Description
March 2016
Define
Box class
Return type
No return value
Example
To unsketch box b:
b.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the boxs 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().
Return type
No return value
Example
To unsketch all boxs in model m:
Box.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Box object.
Example
To check if Box property b.example is a parameter by using the Box.GetParameter() method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
March 2016
Keywords 457
Box class
Define
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for box b:
b.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this box.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for box b:
var xrefs = b.Xrefs();
toString()
Description
Creates a string containing the box data in keyword format. Note that this contains the keyword header and the keyword
cards. See also Box.Keyword() and Box.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for box b in keyword format
var s = b.toString();
Keywords 458
March 2016
Define
ConnectionProperties class
ConnectionProperties class
The ConnectionProperties class gives you access to *DEFINE_CONNECTION_PROPERTIES keyword in PRIMER.
More...
Class functions
Member functions
AddMaterialDataLine()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetMaterialDataLine(row[integer])
GetParameter(prop[*DEFINE_CONNECTION_PROPERTIES property])
Keyword()
KeywordCards()
Next()
Previous()
RemoveMaterialDataLine(row[integer])
SetFlag(flag[Flag])
SetMaterialDataLine(row[integer], mid[integer], sigy (optional)[real], etan (optional)[real], dg_pr
(optional)[real], rank (optional)[real], sn (optional)[real], sb (optional)[real], ss (optional)[real], exsn
(optional)[real], exsb (optional)[real], exss (optional)[real], lcsn (optional)[integer], lcsb (optional)[integer],
lcss (optional)[integer], gfad (optional)[real], sclmrr (optional)[real])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
ConnectionProperties properties
Name
Type
add
areaeq
con_id
d_dg_pr real
Description
d_dg_
prf
d_etan
real
March 2016
Keywords 459
ConnectionProperties class
Define
d_etanf
d_exsb
real
d_exsbf
d_exsn
real
d_exsnf
d_exss
real
d_exssf
d_gfad
real
d_gfadf
d_lcsb
d_lcsn
d_lcss
d_rank
real
d_sb
real
d_sbf
d_sclmrr real
d_sigy
real
d_sigyf
d_sn
real
d_snf
d_ss
real
d_ssf
dg_typ
exists
logical true if *DEFINE_CONNECTION_PROPERTIES exists, false if referred to but not defined. (read
only)
include
moarfl
model
proprul
Detailed Description
The ConnectionProperties class allows you to create, modify, edit and manipulate *DEFINE_CONNECTION_
PROPERTIES. See the documentation below for more details.
Constructor
new ConnectionProperties(Model[Model], con_id[integer], heading
(optional)[string])
Description
Create a new *DEFINE_CONNECTION_PROPERTIES object.
Keywords 460
March 2016
Define
ConnectionProperties class
Arguments
Name
Type
Model
con_id
Description
Return type
ConnectionProperties object
Example
To create a new *DEFINE_CONNECTION_PROPERTIES in model m with label 100:
var c = new ConnectionProperties(m, 100);
Details of functions
AddMaterialDataLine()
Description
Allows user to add material data line in *DEFINE_CONNECTION_PROPERTIES.
Arguments
No arguments
Return type
No return value
Example
To Add Material data line in *DEFINE_CONNECTION_PROPERTIES c:
c.AddMaterialDataLine();
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse *DEFINE_CONNECTION_PROPERTIES c:
c.Browse();
March 2016
Keywords 461
ConnectionProperties class
Define
ClearFlag(flag[Flag])
Description
Clears a flag on the *DEFINE_CONNECTION_PROPERTIES.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for *DEFINE_CONNECTION_PROPERTIES c:
c.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the *DEFINE_CONNECTION_PROPERTIES.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy *DEFINE_CONNECTION_PROPERTIES c into *DEFINE_CONNECTION_PROPERTIES z:
var z = c.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
ConnectionProperties object (or null if not made)
Keywords 462
March 2016
Define
ConnectionProperties class
Example
To start creating a *DEFINE_CONNECTION_PROPERTIES in model m:
var c = ConnectionProperties.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit *DEFINE_CONNECTION_PROPERTIES c:
c.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for *DEFINE_CONNECTION_PROPERTIES c:
c.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first *DEFINE_CONNECTION_PROPERTIES in the model.
March 2016
Keywords 463
ConnectionProperties class
Define
Arguments
Name Type
Description
Return type
ConnectionProperties object (or null if there are no *DEFINE_CONNECTION_PROPERTIESs in the model).
Example
To get the first *DEFINE_CONNECTION_PROPERTIES in model m:
var c = ConnectionProperties.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ConnectionProperties label.
Example
To get the first free *DEFINE_CONNECTION_PROPERTIES label in model m:
var label = ConnectionProperties.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 464
March 2016
Define
ConnectionProperties class
Example
To flag all of the *DEFINE_CONNECTION_PROPERTIESs with flag f in model m:
ConnectionProperties.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the *DEFINE_CONNECTION_PROPERTIES is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if *DEFINE_CONNECTION_PROPERTIES c has flag f set on it:
if (c.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 465
ConnectionProperties class
Define
Example
To call function test for all of the *DEFINE_CONNECTION_PROPERTIESs in model m:
ConnectionProperties.ForEach(m, test);
function test(c)
{
// c is ConnectionProperties object
}
To call function test for all of the *DEFINE_CONNECTION_PROPERTIESs in model m with optional object:
var data = { x:0, y:0 };
ConnectionProperties.ForEach(m, test, data);
function test(c, extra)
{
// c is ConnectionProperties object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of ConnectionProperties objects for all of the *DEFINE_CONNECTION_PROPERTIESs in a model
in Primer
Arguments
Name Type
Description
Return type
Array of ConnectionProperties objects
Example
To make an array of ConnectionProperties objects for all of the *DEFINE_CONNECTION_PROPERTIESs in model
m
var c = ConnectionProperties.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of ConnectionProperties objects
Keywords 466
March 2016
Define
ConnectionProperties class
Example
To make an array of ConnectionProperties objects for all of the *DEFINE_CONNECTION_PROPERTIESs in model
m flagged with f
var c = ConnectionProperties.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the *DEFINE_CONNECTION_PROPERTIES you want the ConnectionProperties object
for
Return type
ConnectionProperties object (or null if *DEFINE_CONNECTION_PROPERTIES does not exist).
Example
To get the ConnectionProperties object for *DEFINE_CONNECTION_PROPERTIES 100 in model m
var c = ConnectionProperties.GetFromID(m, 100);
GetMaterialDataLine(row[integer])
Description
Returns the material data at given row in *DEFINE_CONNECTION_PROPERTIES.
Arguments
Name Type
row
Description
integer Material data row number, eg. for first material data, row = 0
Return type
An array containing the material id, sigy, e_tan etc. .
Example
To get material data at first row, row = 0 in *DEFINE_CONNECTION_PROPERTIES c:
c.GetMaterialData(0);
March 2016
Keywords 467
ConnectionProperties class
Define
GetParameter(prop[*DEFINE_CONNECTION_PROPERTIES property])
Description
Checks if a ConnectionProperties 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 ConnectionProperties.ViewParameters()
method and method chaining (see the examples below).
Arguments
Name Type
Description
prop
*DEFINE_CONNECTION_PROPERTIES
property
Return type
Parameter object if property is a parameter, null if not.
Example
To check if ConnectionProperties property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if ConnectionProperties property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Keyword()
Description
Returns the keyword for this *DEFINE_CONNECTION_PROPERTIES Note that a carriage return is not added.
See also ConnectionProperties.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for ConnectionProperties c:
var key = c.Keyword();
KeywordCards()
Description
Returns the keyword cards for the *DEFINE_CONNECTION_PROPERTIES. Note that a carriage return is not
added. See also ConnectionProperties.Keyword()
Arguments
No arguments
Keywords 468
March 2016
Define
ConnectionProperties class
Return type
string containing the cards.
Example
To get the cards for connection_properties c:
var cards = c.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last *DEFINE_CONNECTION_PROPERTIES in the model.
Arguments
Name Type
Description
Return type
ConnectionProperties object (or null if there are no *DEFINE_CONNECTION_PROPERTIESs in the model).
Example
To get the last *DEFINE_CONNECTION_PROPERTIES in model m:
var c = ConnectionProperties.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
ConnectionProperties label.
Example
To get the last free *DEFINE_CONNECTION_PROPERTIES label in model m:
var label = ConnectionProperties.LastFreeLabel(m);
March 2016
Keywords 469
ConnectionProperties class
Define
Next()
Description
Returns the next *DEFINE_CONNECTION_PROPERTIES in the model.
Arguments
No arguments
Return type
ConnectionProperties object (or null if there are no more *DEFINE_CONNECTION_PROPERTIESs in the model).
Example
To get the *DEFINE_CONNECTION_PROPERTIES in model m after *DEFINE_CONNECTION_PROPERTIES c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ConnectionProperties label.
Example
To get the next free *DEFINE_CONNECTION_PROPERTIES label in model m:
var label = ConnectionProperties.NextFreeLabel(m);
Previous()
Description
Returns the previous *DEFINE_CONNECTION_PROPERTIES in the model.
Arguments
No arguments
Return type
ConnectionProperties object (or null if there are no more *DEFINE_CONNECTION_PROPERTIESs in the model).
Keywords 470
March 2016
Define
ConnectionProperties class
Example
To get the *DEFINE_CONNECTION_PROPERTIES in model m before *DEFINE_CONNECTION_PROPERTIES c:
var c = c.Previous();
RemoveMaterialDataLine(row[integer])
Description
Allows user to remove material data line in *DEFINE_CONNECTION_PROPERTIES.
Arguments
Name Type
row
Description
integer Material data row number, eg. for first material data, row = 0
Return type
No return value
Example
To remove first material data line in *DEFINE_CONNECTION_PROPERTIES c:
c.RemoveMaterialDataLine(0);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the *DEFINE_CONNECTION_PROPERTIESs in model m, from 1000000:
ConnectionProperties.RenumberAll(m, 1000000);
March 2016
Keywords 471
ConnectionProperties class
Define
Arguments
Name Type
Description
Model Model Model that all the flagged *DEFINE_CONNECTION_PROPERTIESs will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the *DEFINE_CONNECTION_PROPERTIESs in model m flagged with f, from 1000000:
ConnectionProperties.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
modal
(optional)
boolean
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.
Return type
Number of *DEFINE_CONNECTION_PROPERTIESs selected or null if menu cancelled
Example
To select *DEFINE_CONNECTION_PROPERTIESs from model m, flagging those selected with flag f, giving the
prompt Select *DEFINE_CONNECTION_PROPERTIESs:
ConnectionProperties.Select(f, Select *DEFINE_CONNECTION_PROPERTIESs, m);
To select *DEFINE_CONNECTION_PROPERTIESs, flagging those selected with flag f but limiting selection to
*DEFINE_CONNECTION_PROPERTIESs flagged with flag l, giving the prompt Select *DEFINE_CONNECTION_
PROPERTIESs:
ConnectionProperties.Select(f, Select *DEFINE_CONNECTION_PROPERTIESs, l);
Keywords 472
March 2016
Define
ConnectionProperties class
SetFlag(flag[Flag])
Description
Sets a flag on the *DEFINE_CONNECTION_PROPERTIES.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for *DEFINE_CONNECTION_PROPERTIES c:
c.SetFlag(f);
March 2016
Keywords 473
ConnectionProperties class
Define
Arguments
Name
Type
Description
row
integer Material data row number, eg. for first material data, row = 0
mid
integer Material ID
sigy (optional)
real
etan (optional)
real
rank (optional)
real
sn (optional)
real
sb (optional)
real
ss (optional)
real
exsn (optional)
real
exsb (optional)
real
exss (optional)
real
lcsn (optional)
lcsb (optional)
lcss (optional)
gfad (optional)
real
Return type
No return value
Example
To set material data at first row ( row = 0) to mat 111 in *DEFINE_CONNECTION_PROPERTIES c:
c.SetMaterialData(0,111);
Arguments
Name
Type
Description
Model
Model
exists
(optional)
Return type
number of *DEFINE_CONNECTION_PROPERTIESs
Keywords 474
March 2016
Define
ConnectionProperties class
Example
To get the total number of *DEFINE_CONNECTION_PROPERTIESs in model m:
var total = ConnectionProperties.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all *DEFINE_CONNECTION_PROPERTIESs will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the *DEFINE_CONNECTION_PROPERTIESs in model m:
ConnectionProperties.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
ConnectionProperties object.
Example
To check if ConnectionProperties property c.example is a parameter by using the ConnectionProperties.GetParameter()
method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
March 2016
Keywords 475
ConnectionProperties class
Define
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for *DEFINE_CONNECTION_PROPERTIES c:
c.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this *DEFINE_CONNECTION_PROPERTIES.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for *DEFINE_CONNECTION_PROPERTIES c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the connection_properties data in keyword format. Note that this contains the keyword
header and the keyword cards. See also ConnectionProperties.Keyword() and ConnectionProperties.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for connection_properties c in keyword format
var str = c.toString();
Keywords 476
March 2016
Define
ConstructionStages class
ConstructionStages class
The ConstructionStages class gives you access to *DEFINE_CONSTRUCTION_STAGES keyword in PRIMER.
More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[*DEFINE_CONSTRUCTION_STAGES property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
ConstructionStages properties
Name
Type
Description
ate
float
atr
float
ats
float
exists
logical true if *DEFINE_CONSTRUCTION_STAGES exists, false if referred to but not defined. (read only)
include integer The Include file number that the *DEFINE_CONSTRUCTION_STAGES is in.
istage
label
model
rte
float
rts
float
March 2016
Keywords 477
ConstructionStages class
Define
Detailed Description
The ConstructionStages class allows you to create, modify, edit and manipulate *DEFINE_CONSTRUCTION_
STAGES. See the documentation below for more details.
Constructor
new ConstructionStages(Model[Model], Stage ID[integer])
Description
Create a new ConstructionStages object.
Arguments
Name
Type
Description
Model
Return type
ConstructionStages object
Example
To create a new *DEFINE_CONSTRUCTION_STAGES in model m with label 100:
var c = new ConstructionStages(m, 100);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse *DEFINE_CONSTRUCTION_STAGES c:
c.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the *DEFINE_CONSTRUCTION_STAGES.
Keywords 478
March 2016
Define
ConstructionStages class
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for *DEFINE_CONSTRUCTION_STAGES c:
c.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the *DEFINE_CONSTRUCTION_STAGES.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy *DEFINE_CONSTRUCTION_STAGES c into *DEFINE_CONSTRUCTION_STAGES z:
var z = c.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
ConstructionStages object (or null if not made)
Example
To start creating a *DEFINE_CONSTRUCTION_STAGES in model m:
var c = ConstructionStages.Create(m);
March 2016
Keywords 479
ConstructionStages class
Define
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit *DEFINE_CONSTRUCTION_STAGES c:
c.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for *DEFINE_CONSTRUCTION_STAGES c:
c.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first *DEFINE_CONSTRUCTION_STAGES in the model.
Arguments
Name Type
Description
Return type
ConstructionStages object (or null if there are no *DEFINE_CONSTRUCTION_STAGESs in the model).
Keywords 480
March 2016
Define
ConstructionStages class
Example
To get the first *DEFINE_CONSTRUCTION_STAGES in model m:
var c = ConstructionStages.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ConstructionStages label.
Example
To get the first free *DEFINE_CONSTRUCTION_STAGES label in model m:
var label = ConstructionStages.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the *DEFINE_CONSTRUCTION_STAGESs with flag f in model m:
ConstructionStages.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the *DEFINE_CONSTRUCTION_STAGES is flagged or not.
March 2016
Keywords 481
ConstructionStages class
Define
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if *DEFINE_CONSTRUCTION_STAGES c has flag f set on it:
if (c.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the *DEFINE_CONSTRUCTION_STAGESs in model m:
ConstructionStages.ForEach(m, test);
function test(c)
{
// c is ConstructionStages object
}
To call function test for all of the *DEFINE_CONSTRUCTION_STAGESs in model m with optional object:
var data = { x:0, y:0 };
ConstructionStages.ForEach(m, test, data);
function test(c, extra)
{
// c is ConstructionStages object
// extra is data
}
Keywords 482
March 2016
Define
ConstructionStages class
GetAll(Model[Model]) [static]
Description
Returns an array of ConstructionStages objects for all of the *DEFINE_CONSTRUCTION_STAGESs in a model in
Primer
Arguments
Name Type
Description
Return type
Array of ConstructionStages objects
Example
To make an array of ConstructionStages objects for all of the *DEFINE_CONSTRUCTION_STAGESs in model m
var c = ConstructionStages.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of ConstructionStages objects
Example
To make an array of ConstructionStages objects for all of the *DEFINE_CONSTRUCTION_STAGESs in model m
flagged with f
var c = ConstructionStages.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the *DEFINE_CONSTRUCTION_STAGES you want the ConstructionStages object for
March 2016
Keywords 483
ConstructionStages class
Define
Return type
ConstructionStages object (or null if *DEFINE_CONSTRUCTION_STAGES does not exist).
Example
To get the ConstructionStages object for *DEFINE_CONSTRUCTION_STAGES 100 in model m
var c = ConstructionStages.GetFromID(m, 100);
GetParameter(prop[*DEFINE_CONSTRUCTION_STAGES property])
Description
Checks if a ConstructionStages 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 ConstructionStages.ViewParameters()
method and method chaining (see the examples below).
Arguments
Name Type
Description
prop
*DEFINE_CONSTRUCTION_STAGES
property
Return type
Parameter object if property is a parameter, null if not.
Example
To check if ConstructionStages property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if ConstructionStages property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Keyword()
Description
Returns the keyword for this *DEFINE_CONSTRUCTION_STAGES. Note that a carriage return is not added. See
also ConstructionStages.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for ConstructionStages c:
var key = c.Keyword();
Keywords 484
March 2016
Define
ConstructionStages class
KeywordCards()
Description
Returns the keyword cards for the *DEFINE_CONSTRUCTION_STAGES. Note that a carriage return is not added.
See also ConstructionStages.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for construction_stages c:
var cards = c.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last *DEFINE_CONSTRUCTION_STAGES in the model.
Arguments
Name Type
Description
Return type
ConstructionStages object (or null if there are no *DEFINE_CONSTRUCTION_STAGESs in the model).
Example
To get the last *DEFINE_CONSTRUCTION_STAGES in model m:
var c = ConstructionStages.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
ConstructionStages label.
March 2016
Keywords 485
ConstructionStages class
Define
Example
To get the last free *DEFINE_CONSTRUCTION_STAGES label in model m:
var label = ConstructionStages.LastFreeLabel(m);
Next()
Description
Returns the next *DEFINE_CONSTRUCTION_STAGES in the model.
Arguments
No arguments
Return type
ConstructionStages object (or null if there are no more *DEFINE_CONSTRUCTION_STAGESs in the model).
Example
To get the *DEFINE_CONSTRUCTION_STAGES in model m after *DEFINE_CONSTRUCTION_STAGES c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
ConstructionStages label.
Example
To get the next free *DEFINE_CONSTRUCTION_STAGES label in model m:
var label = ConstructionStages.NextFreeLabel(m);
Previous()
Description
Returns the previous *DEFINE_CONSTRUCTION_STAGES in the model.
Arguments
No arguments
Keywords 486
March 2016
Define
ConstructionStages class
Return type
ConstructionStages object (or null if there are no more *DEFINE_CONSTRUCTION_STAGESs in the model).
Example
To get the *DEFINE_CONSTRUCTION_STAGES in model m before *DEFINE_CONSTRUCTION_STAGES c:
var c = c.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the *DEFINE_CONSTRUCTION_STAGESs in model m, from 1000000:
ConstructionStages.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged *DEFINE_CONSTRUCTION_STAGESs will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the *DEFINE_CONSTRUCTION_STAGESs in model m flagged with f, from 1000000:
ConstructionStages.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 487
ConstructionStages class
Define
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
modal
(optional)
boolean
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.
Return type
Number of *DEFINE_CONSTRUCTION_STAGESs selected or null if menu cancelled
Example
To select *DEFINE_CONSTRUCTION_STAGESs from model m, flagging those selected with flag f, giving the
prompt Select *DEFINE_CONSTRUCTION_STAGESs:
ConstructionStages.Select(f, Select *DEFINE_CONSTRUCTION_STAGESs, m);
To select *DEFINE_CONSTRUCTION_STAGESs, flagging those selected with flag f but limiting selection to
*DEFINE_CONSTRUCTION_STAGESs flagged with flag l, giving the prompt Select *DEFINE_CONSTRUCTION_
STAGESs:
ConstructionStages.Select(f, Select *DEFINE_CONSTRUCTION_STAGESs, l);
SetFlag(flag[Flag])
Description
Sets a flag on the *DEFINE_CONSTRUCTION_STAGES.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for *DEFINE_CONSTRUCTION_STAGES c:
c.SetFlag(f);
Keywords 488
March 2016
Define
ConstructionStages class
Arguments
Name
Type
Description
Model
Model
exists
(optional)
Return type
number of *DEFINE_CONSTRUCTION_STAGESs
Example
To get the total number of *DEFINE_CONSTRUCTION_STAGESs in model m:
var total = ConstructionStages.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all *DEFINE_CONSTRUCTION_STAGESs will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the *DEFINE_CONSTRUCTION_STAGESs in model m:
ConstructionStages.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
March 2016
Keywords 489
ConstructionStages class
Define
Return type
ConstructionStages object.
Example
To check if ConstructionStages property c.example is a parameter by using the ConstructionStages.GetParameter()
method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for *DEFINE_CONSTRUCTION_STAGES c:
c.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this *DEFINE_CONSTRUCTION_STAGES.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for *DEFINE_CONSTRUCTION_STAGES c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the construction stages data in keyword format. Note that this contains the keyword header
and the keyword cards. See also ConstructionStages.Keyword() and ConstructionStages.KeywordCards().
Keywords 490
March 2016
Define
ConstructionStages class
Arguments
No arguments
Return type
string
Example
To get data for construction stages c in keyword format
var str = c.toString();
March 2016
Keywords 491
Define
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[coordinate system property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
CoordinateSystem constants
Name
Description
CoordinateSystem.NODES
Csys is *DEFINE_COORDINATE_NODES.
CoordinateSystem properties
Keywords 492
March 2016
Define
Name
Type
Description
cid
integer
cidl
integer
dir
int
exists
logical
true if csys exists, false if referred to but not defined. (read only)
flag
logical
heading string
CoordinateSystem heading
include integer
label
integer
CoordinateSystem number. Also see the cid property which is an alternative name for this.
lx
float
ly
float
lz
float
model
integer
n1
int
n2
int
n3
int
nid
integer
option
ox
float
X-coordinate of origin
oy
float
Y-coordinate of origin
oz
float
Z-coordinate of origin
px
float
py
float
pz
float
vx
float
vy
float
vz
float
xx
float
xy
float
xz
float
Detailed Description
The CoordinateSystem class allows you to create, modify, edit and manipulate csys cards. See the documentation below
for more details.
For convenience "Csys" can also be used as the class name instead of "CoordinateSystem".
March 2016
Keywords 493
Define
Constructor
new CoordinateSystem(Model[Model], option[constant], cid[integer],
n1[integer], n2[integer], n3[integer], flag[boolean], dir[integer], heading
(optional)[string])
Description
Create a new CoordinateSystem object for *DEFINE_COORDINATE_NODES.
Arguments
Name
Type
Description
Model
Model
option
cid
integer
CoordinateSystem number
n1
integer
n2
integer
n3
integer
flag
dir
integer
Return type
CoordinateSystem object
Example
To create a new Csys of type Nodes in model m with label 200 and title "Test csys 1" defined by nodes 1, 2, 3 with
where N1N2 defines local Y-axis; local system update flag is off
var c = new CoordinateSystem(m, CoordinateSystem.NODES, 200, 1, 2, 3, 0, 2,
"Test csys");
Keywords 494
March 2016
Define
Arguments
Name
Type
Description
Model
Model
option
cid
integer
CoordinateSystem number
ox
float
X-coordinate of origin
oy
float
Y-coordinate of origin
oz
float
Z-coordinate of origin
lx
float
ly
float
lz
float
px
float
py
float
pz
float
Return type
No return value
Example
To create a new Csys of type Points in model m with label 300 and title "Test csys 2" with origin at (10, 10, 0), point on
local X-axis at (20, 20, 0) and point on X-y at (10, 20, 0)
var c = new CoordinateSystem(m, CoordinateSystem.SYSTEM, 300, 10, 10, 0, 20, 20,
0, 10, 20, 0, "Test csys");
Arguments
Name Type
Description
Model Model
integer
CoordinateSystem number
xx
float
xy
float
xz
float
vx
float
vy
float
vz
float
nid
integer
March 2016
Keywords 495
Define
Return type
No return value
Example
To create a new Csys of type Vectors in model m with label 400 with point on local X-axis at (50, 50, 0) and local XY
being (-10, -20, 0) that can rotate with node 10003
var c = new CoordinateSystem(m, CoordinateSystem.VECTOR, 400, 50, 50, 0, -10,
-10, 10003);
Details of functions
Blank()
Description
Blanks the coordinate system
Arguments
No arguments
Return type
No return value
Example
To blank coordinate system c:
c.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the coordinate systems in model m:
CoordinateSystem.BlankAll(m);
Keywords 496
March 2016
Define
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the coordinate systems in model m flagged with f:
CoordinateSystem.BlankFlagged(m, f);
Blanked()
Description
Checks if the coordinate system is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if coordinate system c is blanked:
if (c.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse coordinate system c:
c.Browse();
March 2016
Keywords 497
Define
ClearFlag(flag[Flag])
Description
Clears a flag on the coordinate system.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for coordinate system c:
c.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the coordinate system.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy coordinate system c into coordinate system z:
var z = c.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
CoordinateSystem object (or null if not made)
Keywords 498
March 2016
Define
Example
To start creating a csys in model m:
var m = CoordinateSystem.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit coordinate system c:
c.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for coordinate system c:
c.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first coordinate system in the model.
March 2016
Keywords 499
Define
Arguments
Name Type
Description
Return type
CoordinateSystem object (or null if there are no coordinate systems in the model).
Example
To get the first coordinate system in model m:
var c = CoordinateSystem.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
CoordinateSystem label.
Example
To get the first free coordinate system label in model m:
var label = CoordinateSystem.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 500
March 2016
Define
Example
To flag all of the coordinate systems with flag f in model m:
CoordinateSystem.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the coordinate system is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if coordinate system c has flag f set on it:
if (c.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 501
Define
Example
To call function test for all of the coordinate systems in model m:
CoordinateSystem.ForEach(m, test);
function test(c)
{
// c is CoordinateSystem object
}
To call function test for all of the coordinate systems in model m with optional object:
var data = { x:0, y:0 };
CoordinateSystem.ForEach(m, test, data);
function test(c, extra)
{
// c is CoordinateSystem object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of CoordinateSystem objects for all of the coordinate systems in a model in Primer
Arguments
Name Type
Description
Return type
Array of CoordinateSystem objects
Example
To make an array of CoordinateSystem objects for all of the coordinate systems in model m
var c = CoordinateSystem.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of CoordinateSystem objects
Example
To make an array of CoordinateSystem objects for all of the coordinate systems in model m flagged with f
var c = CoordinateSystem.GetFlagged(m, f);
Keywords 502
March 2016
Define
Arguments
Name
Type
Description
Model
number integer number of the coordinate system you want the CoordinateSystem object for
Return type
CoordinateSystem object (or null if coordinate system does not exist).
Example
To get the CoordinateSystem object for coordinate system 100 in model m
var c = CoordinateSystem.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if CoordinateSystem property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if CoordinateSystem property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
Keyword()
Description
Returns the keyword for this csys (*DEFINE_COORDINATE). Note that a carriage return is not added. See also
CoordinateSystem.KeywordCards()
March 2016
Keywords 503
Define
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for csys m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the csys. Note that a carriage return is not added. See also
CoordinateSystem.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for csys c:
var cards = v.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last coordinate system in the model.
Arguments
Name Type
Description
Return type
CoordinateSystem object (or null if there are no coordinate systems in the model).
Example
To get the last coordinate system in model m:
var c = CoordinateSystem.Last(m);
Keywords 504
March 2016
Define
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
CoordinateSystem label.
Example
To get the last free coordinate system label in model m:
var label = CoordinateSystem.LastFreeLabel(m);
Next()
Description
Returns the next coordinate system in the model.
Arguments
No arguments
Return type
CoordinateSystem object (or null if there are no more coordinate systems in the model).
Example
To get the coordinate system in model m after coordinate system c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
CoordinateSystem label.
Example
To get the next free coordinate system label in model m:
var label = CoordinateSystem.NextFreeLabel(m);
March 2016
Keywords 505
Define
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the csys can be picked from any model.
modal
(optional)
boolean 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.
Return type
CoordinateSystem object (or null if not picked)
Example
To pick a csys from model m giving the prompt Pick csys from screen:
var csys = CoordinateSystem.Pick(Pick csys from screen, m);
Previous()
Description
Returns the previous coordinate system in the model.
Arguments
No arguments
Return type
CoordinateSystem object (or null if there are no more coordinate systems in the model).
Example
To get the coordinate system in model m before coordinate system c:
var c = c.Previous();
Arguments
Name Type
Description
Keywords 506
March 2016
Define
Return type
No return value
Example
To renumber all of the coordinate systems in model m, from 1000000:
CoordinateSystem.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged coordinate systems will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the coordinate systems in model m flagged with f, from 1000000:
CoordinateSystem.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only coordinate systems from that model can be selected. If
Flag
the argument is a Flag then only coordinate systems that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any coordinate systems can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of coordinate systems selected or null if menu cancelled
March 2016
Keywords 507
Define
Example
To select coordinate systems from model m, flagging those selected with flag f, giving the prompt Select coordinate
systems:
CoordinateSystem.Select(f, Select coordinate systems, m);
To select coordinate systems, flagging those selected with flag f but limiting selection to coordinate systems flagged
with flag l, giving the prompt Select coordinate systems:
CoordinateSystem.Select(f, Select coordinate systems, l);
SetFlag(flag[Flag])
Description
Sets a flag on the coordinate system.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for coordinate system c:
c.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the coordinate system. The coordinate system will be sketched until you either call
CoordinateSystem.Unsketch(), CoordinateSystem.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the coordinate system is sketched. If omitted redraw is
true. If you want to sketch several coordinate systems and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch coordinate system c:
c.Sketch();
Keywords 508
March 2016
Define
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing coordinate systems should be counted. If false or omitted referenced but
undefined coordinate systems will also be included in the total.
Return type
number of coordinate systems
Example
To get the total number of coordinate systems in model m:
var total = CoordinateSystem.Total(m);
Unblank()
Description
Unblanks the coordinate system
Arguments
No arguments
Return type
No return value
Example
To unblank coordinate system c:
c.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the coordinate systems in model m:
CoordinateSystem.UnblankAll(m);
March 2016
Keywords 509
Define
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the coordinate systems in model m flagged with f:
CoordinateSystem.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all coordinate systems will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the coordinate systems in model m:
CoordinateSystem.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the coordinate system.
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the coordinate system is unsketched. If omitted redraw
is true. If you want to unsketch several coordinate systems and only redraw after the last one
then use false for redraw and call View.Redraw().
Keywords 510
Description
March 2016
Define
Return type
No return value
Example
To unsketch coordinate system c:
c.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the coordinate systems 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().
Return type
No return value
Example
To unsketch all coordinate systems in model m:
CoordinateSystem.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
CoordinateSystem object.
Example
To check if CoordinateSystem property c.example is a parameter by using the CoordinateSystem.GetParameter()
method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
March 2016
Keywords 511
Define
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for coordinate system c:
c.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this coordinate system.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for coordinate system c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the csys data in keyword format. Note that this contains the keyword header and the
keyword cards. See also CoordinateSystem.Keyword() and CoordinateSystem.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for csys c in keyword format
var s = v.toString();
Keywords 512
March 2016
Define
Curve class
Curve class
The Curve class gives you access to load curve cards in PRIMER. More...
Class functions
Member functions
AddPoint(xvalue[real], yvalue[real])
AddTableEntry(value[real], load curve[integer])
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[curve property])
GetPoint(row[integer])
GetTableEntry(row[integer])
InsertPoint(ipt[integer], xvalue[real], yvalue[real], position[integer])
InsertTableEntry(ipt[integer], value[real], lcid[integer], position[integer])
Keyword()
KeywordCards()
Next()
Previous()
RemovePoint(row[integer])
RemoveTableEntry(ipt[integer])
SetFlag(flag[Flag])
SetPoint(ipt[integer], xvalue[real], yvalue[real])
SetTableEntry(ipt[integer], value[real], load curve[integer])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Curve constants
Name
Description
Curve.AFTER
Curve.BEFORE
Curve.CURVE
March 2016
Keywords 513
Curve class
Define
Curve properties
Name
Type
Description
dattyp
integer
Data type
exists
logical
true if curve exists, false if referred to but not defined. (read only)
function string
heading string
Curve heading
include integer
label
integer
Curve number. Also see the lcid property which is an alternative name for this.
lcid
integer
Curve number. Also see the label property which is an alternative name for this.
model
integer
npoints integer
Number of points
offa
float
offo
float
sfa
float
sfo
float
sidr
integer
type
version string
Detailed Description
The Curve class allows you to create, modify, edit and manipulate curve cards. See the documentation below for more
details.
Constructor
new Curve(Load curve type[constant], Model[Model], lcid[integer], sidr
(optional)[integer], sfa (optional)[float], sfo (optional)[float], offa
(optional)[float], offo (optional)[float], dattyp (optional)[integer], heading
(optional)[string])
Description
Create a new Curve object.
Keywords 514
March 2016
Define
Curve class
Arguments
Name
Type
Description
Load curve constant Type of load curve. Can be Curve.CURVE, Curve.TABLE, Note this does not have to be
type
defined. In previous versions of Primer you could only construct a basic load curve type,
therefore the type argument was not used. Primer is still backwards compatible with this
method of load curve creation.
Model
Model
lcid
integer
Curve number
sidr
(optional)
integer
sfa
(optional)
float
sfo
(optional)
float
offa
(optional)
float
offo
(optional)
float
dattyp
(optional)
integer
Data type
heading
(optional)
string
Return type
Curve object
Example
To create a new curve in model m with label 200
var l = new Curve(Curve.CURVE, m, 200);
Arguments
Name
Type
Description
Model
Model
lcid
integer
Curve number
sidr (optional)
integer
Function expression
Return type
Curve object
March 2016
Keywords 515
Curve class
Define
Example
To create a new curve function in model m with label 200 and function 0.5*lc9*vm(22)**3 (example from keyword
manual)
var l = new Curve(Curve.CURVE_FUNCTION, m, 200, 0, "0.5*lc9*vm(22)**3");
Details of functions
AddPoint(xvalue[real], yvalue[real])
Description
Adds a point to a load curve.
Arguments
Name Type Description
xvalue real
yvalue real
Return type
No return value.
Example
To add a point with values of x=3 and y=5 to curve l:
l.AddPoint(3, 5);
Arguments
Name
Type
Description
value
real
load curve integer The load curve corresponding to the defined value.
Return type
No return value.
Example
To add an entry with a value of 3 for load curve 1000:
l.AddTableEntry(3, 1000);
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Keywords 516
March 2016
Define
Curve class
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse curve c:
c.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the curve.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for curve c:
c.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the curve.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy curve c into curve z:
var z = c.Copy();
March 2016
Keywords 517
Curve class
Define
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Curve object (or null if not made)
Example
To start creating a curve in model m:
var l = Curve.Create(m);
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Curve object (or null if not made)
Example
To start creating a table in model m:
var l = Curve.CreateTable(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
modal
(optional)
boolean 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.
Keywords 518
Description
March 2016
Define
Curve class
Return type
no return value
Example
To Edit curve c:
c.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for curve c:
c.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first curve in the model.
Arguments
Name Type
Description
Return type
Curve object (or null if there are no curves in the model).
Example
To get the first curve in model m:
var c = Curve.First(m);
March 2016
Keywords 519
Curve class
Define
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Curve label.
Example
To get the first free curve label in model m:
var label = Curve.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the curves with flag f in model m:
Curve.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the curve is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if curve c has flag f set on it:
if (c.Flagged(f) ) do_something...
Keywords 520
March 2016
Define
Curve class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the curves in model m:
Curve.ForEach(m, test);
function test(c)
{
// c is Curve object
}
To call function test for all of the curves in model m with optional object:
var data = { x:0, y:0 };
Curve.ForEach(m, test, data);
function test(c, extra)
{
// c is Curve object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Curve objects for all of the curves in a model in Primer
Arguments
Name Type
Description
Return type
Array of Curve objects
Example
To make an array of Curve objects for all of the curves in model m
var c = Curve.GetAll(m);
March 2016
Keywords 521
Curve class
Define
Arguments
Name Type
Description
Flag
Return type
Array of Curve objects
Example
To make an array of Curve objects for all of the curves in model m flagged with f
var c = Curve.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the curve you want the Curve object for
Return type
Curve object (or null if curve does not exist).
Example
To get the Curve object for curve 100 in model m
var c = Curve.GetFromID(m, 100);
GetParameter(prop[curve property])
Description
Checks if a Curve 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 Curve.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Keywords 522
March 2016
Define
Curve class
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Curve property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if Curve property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
GetPoint(row[integer])
Description
Returns x and y data for a point in a curve
Arguments
Name Type
row
Description
integer The row point you want the data for. Note that curve points start at 0, not 1.
Return type
An array containing the x value and the y value.
Example
To get the curve data for the 3rd point for curve l:
if (l.npoints >= 3)
{
var point_data = l.GetPoint(2);
}
GetTableEntry(row[integer])
Description
Returns the value and curve label for a row in a table
Arguments
Name Type
row
Description
integer The row point you want the data for. Note that curve points start at 0, not 1.
Return type
An array containing the value and the load curve label.
Example
To get the data for the 3rd point for table t:
if (t.npoints >= 3)
{
var row_data = t.GetTableEntry(2);
}
March 2016
Keywords 523
Curve class
Define
Arguments
Name
Type
Description
ipt
integer The row you want to insert the data before or after. Note that the row data starts at 0, not 1.
xvalue
real
yvalue
real
position integer Specify either before or after the selected row. Use Curve.BEFORE for before, and Curve.AFTER
for after.
Return type
No return value.
Example
To insert the values after the 3rd row to x=3, y=5 for curve l:
l.InsertPoint(2, 3, 5, Curve.AFTER);
Arguments
Name
Type
Description
ipt
integer The row you want to insert the data before or after. Note that the row data starts at 0, not 1.
value
real
lcid
position integer Specify either before or after the selected row. Use Curve.BEFORE for before, and Curve.AFTER
for after.
Return type
No return value.
Example
To insert the values after the 3rd row to value=3, lcur=5 for table t:
t.InsertTableEntry(2, 3, 5, Curve.AFTER);
Keyword()
Description
Returns the keyword for this curve (*DEFINE_CURVE_xxxx). Note that a carriage return is not added. See also
Curve.KeywordCards()
Keywords 524
March 2016
Define
Curve class
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for curve l:
var key = l.Keyword();
KeywordCards()
Description
Returns the keyword cards for the curve. Note that a carriage return is not added. See also Curve.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for curve l:
var cards = l.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last curve in the model.
Arguments
Name Type
Description
Return type
Curve object (or null if there are no curves in the model).
Example
To get the last curve in model m:
var c = Curve.Last(m);
March 2016
Keywords 525
Curve class
Define
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Curve label.
Example
To get the last free curve label in model m:
var label = Curve.LastFreeLabel(m);
Next()
Description
Returns the next curve in the model.
Arguments
No arguments
Return type
Curve object (or null if there are no more curves in the model).
Example
To get the curve in model m after curve c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Curve label.
Example
To get the next free curve label in model m:
var label = Curve.NextFreeLabel(m);
Keywords 526
March 2016
Define
Curve class
Previous()
Description
Returns the previous curve in the model.
Arguments
No arguments
Return type
Curve object (or null if there are no more curves in the model).
Example
To get the curve in model m before curve c:
var c = c.Previous();
RemovePoint(row[integer])
Description
Removes a row of data from a curve
Arguments
Name Type
row
Description
integer The row point you want to remove. Note that curve points start at 0, not 1.
Return type
No return value.
Example
To remove the curve data for the 3rd point for curve l:
if (l.npoints >= 3)
{
var point_data = l.RemovePoint(2);
}
RemoveTableEntry(ipt[integer])
Description
Removes the value and loadcurve values for a specified row of data on a load curve.
Arguments
Name Type
ipt
Description
integer The row you want to remove the data for. Note that the row data starts at 0, not 1.
Return type
No return value.
March 2016
Keywords 527
Curve class
Define
Example
To remove an entry at row 4:
t.RemoveTableEntry(4);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the curves in model m, from 1000000:
Curve.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged curves will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the curves in model m flagged with f, from 1000000:
Curve.RenumberFlagged(m, f, 1000000);
Keywords 528
March 2016
Define
Curve class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only curves from that model can be selected. If the argument
Flag
is a Flag then only curves that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any curves can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of curves selected or null if menu cancelled
Example
To select curves from model m, flagging those selected with flag f, giving the prompt Select curves:
Curve.Select(f, Select curves, m);
To select curves, flagging those selected with flag f but limiting selection to curves flagged with flag l, giving the
prompt Select curves:
Curve.Select(f, Select curves, l);
SetFlag(flag[Flag])
Description
Sets a flag on the curve.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for curve c:
c.SetFlag(f);
March 2016
Keywords 529
Curve class
Define
Arguments
Name Type
ipt
Description
integer The row you want to set the data for. Note that the row data starts at 0, not 1.
xvalue real
yvalue real
Return type
No return value.
Example
To set the values for the 3rd row to x=3, y=5 for curve l:
l.SetPoint(2, 3, 5);
Arguments
Name
Type
Description
ipt
integer The row you want to set the data for. Note that the row data starts at 0, not 1.
value
real
load curve integer The load curve corresponding to the defined value.
Return type
No return value.
Example
To add an entry with a value of 3 for load curve 1000 at row 4:
t.SetTableEntry(4, 3, 1000);
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing curves should be counted. If false or omitted referenced but undefined
curves will also be included in the total.
Return type
number of curves
Keywords 530
March 2016
Define
Curve class
Example
To get the total number of curves in model m:
var total = Curve.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all curves will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the curves in model m:
Curve.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Curve object.
Example
To check if Curve property c.example is a parameter by using the Curve.GetParameter() method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
March 2016
Keywords 531
Curve class
Define
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for curve c:
c.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this curve.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for curve c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the curve data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Curve.Keyword() and Curve.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for curve l in keyword format
var l = d.toString();
Keywords 532
March 2016
Define
ElementDeath class
ElementDeath class
The ElementDeath class gives you access to define element death cards in PRIMER. More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[element death property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
ElementDeath constants
Name
Description
ElementDeath.BEAM
Beam option
ElementDeath.BEAM_SET
ElementDeath.SHELL
Shell option
ElementDeath.SHELL_SET
ElementDeath.SOLID
Solid option
ElementDeath.SOLID_SET
ElementDeath.THICK_SHELL
ElementDeath properties
Name
Type
Description
boxid
integer
cid
integer
eid
integer
Element ID or element set ID. The sid property is an alternative name for this.
March 2016
Keywords 533
ElementDeath class
Define
exists
logical
true if element death exists, false if referred to but not defined. (read only)
idgrp
integer
include integer
inout
logical
model
integer
integer
Element ID or element set ID. The eid property is an alternative name for this.
time
float
title
string
ElementDeath title
type
Detailed Description
The ElementDeath class allows you to create, modify, edit and manipulate element death cards. See the documentation
below for more details.
Constructor
new ElementDeath(Model[Model], type[string], eid/sid[integer])
Description
Create a new ElementDeath object.
Arguments
Name Type
Description
string
Return type
ElementDeath object
Example
To create a new element death in model m with option BEAM_SET and sid 100
var ed = new ElementDeath(m, ElementDeath.BEAM_SET, 100);
Keywords 534
March 2016
Define
ElementDeath class
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse element death ed:
ed.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the element death.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for element death ed:
ed.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the element death.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
March 2016
Keywords 535
ElementDeath class
Define
Example
To copy element death ed into element death z:
var z = ed.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
ElementDeath object (or null if not made)
Example
To start creating an element death in model m:
var ed = ElementDeath.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit element death ed:
ed.Edit();
Keywords 536
March 2016
Define
ElementDeath class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for element death ed:
ed.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first element death in the model.
Arguments
Name Type
Description
Return type
ElementDeath object (or null if there are no element deaths in the model).
Example
To get the first element death in model m:
var ed = ElementDeath.First(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the element deaths with flag f in model m:
ElementDeath.FlagAll(m, f);
March 2016
Keywords 537
ElementDeath class
Define
Flagged(flag[Flag])
Description
Checks if the element death is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if element death ed has flag f set on it:
if (ed.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the element deaths in model m:
ElementDeath.ForEach(m, test);
function test(ed)
{
// ed is ElementDeath object
}
To call function test for all of the element deaths in model m with optional object:
var data = { x:0, y:0 };
ElementDeath.ForEach(m, test, data);
function test(ed, extra)
{
// ed is ElementDeath object
// extra is data
}
Keywords 538
March 2016
Define
ElementDeath class
GetAll(Model[Model]) [static]
Description
Returns an array of ElementDeath objects for all of the element deaths in a model in Primer
Arguments
Name Type
Description
Return type
Array of ElementDeath objects
Example
To make an array of ElementDeath objects for all of the element deaths in model m
var ed = ElementDeath.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of ElementDeath objects
Example
To make an array of ElementDeath objects for all of the element deaths in model m flagged with f
var ed = ElementDeath.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the element death you want the ElementDeath object for
Return type
ElementDeath object (or null if element death does not exist).
March 2016
Keywords 539
ElementDeath class
Define
Example
To get the ElementDeath object for element death 100 in model m
var ed = ElementDeath.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if ElementDeath property ed.example is a parameter:
Options.property_parameter_names = true;
if (ed.GetParameter(ed.example) ) do_something...
Options.property_parameter_names = false;
To check if ElementDeath property ed.example is a parameter by using the GetParameter method:
if (ed.ViewParameters().GetParameter(ed.example) ) do_something...
Keyword()
Description
Returns the keyword for this element death (*DEFINE_ELEMENT_DEATH). Note that a carriage return is not
added. See also ElementDeath.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for element death ed:
var key = ed.Keyword();
Keywords 540
March 2016
Define
ElementDeath class
KeywordCards()
Description
Returns the keyword cards for the element death. Note that a carriage return is not added. See also
ElementDeath.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for element death ed:
var cards = ed.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last element death in the model.
Arguments
Name Type
Description
Return type
ElementDeath object (or null if there are no element deaths in the model).
Example
To get the last element death in model m:
var ed = ElementDeath.Last(m);
Next()
Description
Returns the next element death in the model.
Arguments
No arguments
Return type
ElementDeath object (or null if there are no more element deaths in the model).
Example
To get the element death in model m after element death ed:
var ed = ed.Next();
March 2016
Keywords 541
ElementDeath class
Define
Previous()
Description
Returns the previous element death in the model.
Arguments
No arguments
Return type
ElementDeath object (or null if there are no more element deaths in the model).
Example
To get the element death in model m before element death ed:
var ed = ed.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only element deaths from that model can be selected. If the
Flag
argument is a Flag then only element deaths that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any element deaths can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of element deaths selected or null if menu cancelled
Example
To select element deaths from model m, flagging those selected with flag f, giving the prompt Select element deaths:
ElementDeath.Select(f, Select element deaths, m);
To select element deaths, flagging those selected with flag f but limiting selection to element deaths flagged with flag l,
giving the prompt Select element deaths:
ElementDeath.Select(f, Select element deaths, l);
SetFlag(flag[Flag])
Description
Sets a flag on the element death.
Keywords 542
March 2016
Define
ElementDeath class
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for element death ed:
ed.SetFlag(f);
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing element deaths should be counted. If false or omitted referenced but
undefined element deaths will also be included in the total.
Return type
number of element deaths
Example
To get the total number of element deaths in model m:
var total = ElementDeath.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all element deaths will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the element deaths in model m:
ElementDeath.UnflagAll(m, f);
March 2016
Keywords 543
ElementDeath class
Define
ViewParameters()
Description
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.
Arguments
No arguments
Return type
ElementDeath object.
Example
To check if ElementDeath property ed.example is a parameter by using the ElementDeath.GetParameter() method:
if (ed.ViewParameters().GetParameter(ed.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for element death ed:
ed.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this element death.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for element death ed:
var xrefs = ed.Xrefs();
Keywords 544
March 2016
Define
ElementDeath class
toString()
Description
Creates a string containing the element death data in keyword format. Note that this contains the keyword header and
the keyword cards. See also ElementDeath.Keyword() and ElementDeath.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for element death ed in keyword format
var s = ed.toString();
March 2016
Keywords 545
Transformation class
Define
Transformation class
The Transformation class gives you access to define transform cards in PRIMER. More...
Class functions
Member functions
Transformation properties
Name
Type
Description
exists
logical true if transformation exists, false if referred to but not defined. (read only)
include
label
integer Transformation number. Also see the tranid property which is an alternative name for this.
model
string
tranid
integer Transformation number. Also see the label property which is an alternative name for this.
Detailed Description
The Transformation class allows you to create, modify, edit and manipulate define transformation cards. See the
documentation below for more details.
Keywords 546
March 2016
Define
Transformation class
Constructor
new Transformation(Model[Model], tranid[integer], title (optional)[string])
Description
Create a new Transformation object.
Arguments
Name
Type
Model
tranid
Description
Transformation title
Return type
Transformation object
Example
To create a new transformation in model m with label 1000 and title "Example transform"
var t = new Transformation(m, 1000, "Example transform");
Details of functions
AddRow(data[array], row (optional)[integer])
Description
Adds a row of data for a *DEFINE_TRANSFORMATION.
Arguments
Name
Type
Description
data
array
row
(optional)
integer The row you want to add the data at. Existing transforms will be shifted. If omitted the data will
be added to the end of the existing transforms. Note that row indices start at 0.
Return type
No return value.
Example
To add a translation of (0, 0, 100) to transformation t:
var array = ["TRANSL", 0, 0, 100];
t.AddRow(array);
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
March 2016
Keywords 547
Transformation class
Define
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse transformation t:
t.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the transformation.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for transformation t:
t.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the transformation.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy transformation t into transformation z:
var z = t.Copy();
Keywords 548
March 2016
Define
Transformation class
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Transformation object (or null if not made)
Example
To start creating a define transformation definition in model m:
var t = Transformation.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit transformation t:
t.Edit();
Arguments
Name
Type Description
message
Return type
No return value
March 2016
Keywords 549
Transformation class
Define
Example
To add an error message "My custom error" for transformation t:
t.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first transformation in the model.
Arguments
Name Type
Description
Return type
Transformation object (or null if there are no transformations in the model).
Example
To get the first transformation in model m:
var t = Transformation.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Transformation label.
Example
To get the first free transformation label in model m:
var label = Transformation.FirstFreeLabel(m);
Keywords 550
March 2016
Define
Transformation class
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the transformations with flag f in model m:
Transformation.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the transformation is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if transformation t has flag f set on it:
if (t.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
March 2016
Keywords 551
Transformation class
Define
Return type
No return value
Example
To call function test for all of the transformations in model m:
Transformation.ForEach(m, test);
function test(t)
{
// t is Transformation object
}
To call function test for all of the transformations in model m with optional object:
var data = { x:0, y:0 };
Transformation.ForEach(m, test, data);
function test(t, extra)
{
// t is Transformation object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Transformation objects for all of the transformations in a model in Primer
Arguments
Name Type
Description
Return type
Array of Transformation objects
Example
To make an array of Transformation objects for all of the transformations in model m
var t = Transformation.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Transformation objects
Keywords 552
March 2016
Define
Transformation class
Example
To make an array of Transformation objects for all of the transformations in model m flagged with f
var t = Transformation.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the transformation you want the Transformation object for
Return type
Transformation object (or null if transformation does not exist).
Example
To get the Transformation object for transformation 100 in model m
var t = Transformation.GetFromID(m, 100);
GetParameter(prop[transformation property])
Description
Checks if a Transformation 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 Transformation.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Transformation property t.example is a parameter:
Options.property_parameter_names = true;
if (t.GetParameter(t.example) ) do_something...
Options.property_parameter_names = false;
To check if Transformation property t.example is a parameter by using the GetParameter method:
if (t.ViewParameters().GetParameter(t.example) ) do_something...
March 2016
Keywords 553
Transformation class
Define
GetRow(row[integer])
Description
Returns the data for a row in the transformation.
Arguments
Name Type
row
Description
integer The row you want the data for. Note row indices start at 0.
Return type
An array containing the row variables.
Example
To get the data for the 2nd row in transformation t:
var data = t.GetRow(1);
Keyword()
Description
Returns the keyword for this transformation. Note that a carriage return is not added. See also
Transformation.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for transformation t:
var key = t.Keyword();
KeywordCards()
Description
Returns the keyword cards for the transformation. Note that a carriage return is not added. See also
Transformation.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for transformation i:
var cards = i.KeywordCards();
Keywords 554
March 2016
Define
Transformation class
Last(Model[Model]) [static]
Description
Returns the last transformation in the model.
Arguments
Name Type
Description
Return type
Transformation object (or null if there are no transformations in the model).
Example
To get the last transformation in model m:
var t = Transformation.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Transformation label.
Example
To get the last free transformation label in model m:
var label = Transformation.LastFreeLabel(m);
Next()
Description
Returns the next transformation in the model.
Arguments
No arguments
Return type
Transformation object (or null if there are no more transformations in the model).
March 2016
Keywords 555
Transformation class
Define
Example
To get the transformation in model m after transformation t:
var t = t.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Transformation label.
Example
To get the next free transformation label in model m:
var label = Transformation.NextFreeLabel(m);
Previous()
Description
Returns the previous transformation in the model.
Arguments
No arguments
Return type
Transformation object (or null if there are no more transformations in the model).
Example
To get the transformation in model m before transformation t:
var t = t.Previous();
RemoveRow(row[integer])
Description
Removes the data for a row in *DEFINE_TRANSFORMATION.
Arguments
Name Type
row
Description
integer The row you want to remove the data for. Note that row indices start at 0.
Keywords 556
March 2016
Define
Transformation class
Return type
No return value.
Example
To remove the second row of data for transformation t:
t.RemoveRow(1);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only transformations from that model can be selected. If the
Flag
argument is a Flag then only transformations that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any transformations can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of transformations selected or null if menu cancelled
Example
To select transformations from model m, flagging those selected with flag f, giving the prompt Select transformations:
Transformation.Select(f, Select transformations, m);
To select transformations, flagging those selected with flag f but limiting selection to transformations flagged with flag
l, giving the prompt Select transformations:
Transformation.Select(f, Select transformations, l);
SetFlag(flag[Flag])
Description
Sets a flag on the transformation.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Keywords 557
Transformation class
Define
Example
To set flag f for transformation t:
t.SetFlag(f);
SetRow(row[integer], data[array])
Description
Sets the data for a row in *DEFINE_TRANSFORMATION.
Arguments
Name Type
Description
row
integer The row you want to set the data for. Note that row indices start at 0.
data
array
Return type
No return value.
Example
To set the second row of data for transformation t to be a translation of (0, 0, 100):
var array = ["TRANSL", 0, 0, 100];
t.SetRow(1, array);
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing transformations should be counted. If false or omitted referenced but
undefined transformations will also be included in the total.
Return type
number of transformations
Example
To get the total number of transformations in model m:
var total = Transformation.Total(m);
Keywords 558
March 2016
Define
Transformation class
Arguments
Name Type
Description
Model Model Model that the defined flag for all transformations will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the transformations in model m:
Transformation.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Transformation object.
Example
To check if Transformation property t.example is a parameter by using the Transformation.GetParameter() method:
if (t.ViewParameters().GetParameter(t.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for transformation t:
t.Warning("My custom warning");
March 2016
Keywords 559
Transformation class
Define
Xrefs()
Description
Returns the cross references for this transformation.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for transformation t:
var xrefs = t.Xrefs();
toString()
Description
Creates a string containing the transformation data in keyword format. Note that this contains the keyword header and
the keyword cards. See also Transformation.Keyword() and Transformation.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for transformation t in keyword format
var s = t.toString();
Keywords 560
March 2016
Define
Vector class
Vector class
The Vector class gives you access to define vector cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[vector property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Vector properties
Name
Type
Description
cid
int
Coordinate system ID
exists
logical true if vector exists, false if referred to but not defined. (read only)
heading string
Vector heading
include integer The Include file number that the vector is in.
label
integer Vector number. Also see the vid property which is an alternative name for this.
model
Keywords 561
Vector class
Define
nodeh
int
nodes
nodet
int
vid
integer Vector number. Also see the label property which is an alternative name for this.
xh
float
xt
float
yh
float
yt
float
zh
float
zt
float
Detailed Description
The Vector class allows you to create, modify, edit and manipulate vector cards. See the documentation below for more
details.
Constructor
new Vector(Model[Model], vid[integer], xt[float], yt[float], zt[float], xh[float],
yh[float], zh[float], cid (optional)[int], heading (optional)[string])
Description
Create a new Vector object.
Arguments
Name
Type
Model
vid
xt
float
yt
float
zt
float
xh
float
yh
float
zh
float
cid (optional)
int
Coordinate system ID
Description
Return type
Vector object
Example
To create a new vector in model m with label 200
var v = new Vector(m, 200, 1.5, 2.5, 1.0, 4.5, 4.0, 3.0);
Keywords 562
March 2016
Define
Vector class
Arguments
Name
Type
Model
vid
nodet
nodeh
Description
Return type
Vector object
Example
To create a new vector in model m with label 200 using nodes 10 for the tail and 20 for the head
var v = new Vector(m, 200, 20, 30);
Details of functions
Blank()
Description
Blanks the vector
Arguments
No arguments
Return type
No return value
Example
To blank vector v:
v.Blank();
March 2016
Keywords 563
Vector class
Define
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the vectors in model m:
Vector.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the vectors in model m flagged with f:
Vector.BlankFlagged(m, f);
Blanked()
Description
Checks if the vector is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if vector v is blanked:
if (v.Blanked() ) do_something...
Keywords 564
March 2016
Define
Vector class
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse vector v:
v.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the vector.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for vector v:
v.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the vector.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
March 2016
Keywords 565
Vector class
Define
Example
To copy vector v into vector z:
var z = v.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Vector object (or null if not made)
Example
To start creating a vector in model m:
var m = Vector.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit vector v:
v.Edit();
Keywords 566
March 2016
Define
Vector class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for vector v:
v.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first vector in the model.
Arguments
Name Type
Description
Return type
Vector object (or null if there are no vectors in the model).
Example
To get the first vector in model m:
var v = Vector.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Vector label.
March 2016
Keywords 567
Vector class
Define
Example
To get the first free vector label in model m:
var label = Vector.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the vectors with flag f in model m:
Vector.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the vector is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if vector v has flag f set on it:
if (v.Flagged(f) ) do_something...
Keywords 568
March 2016
Define
Vector class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the vectors in model m:
Vector.ForEach(m, test);
function test(v)
{
// v is Vector object
}
To call function test for all of the vectors in model m with optional object:
var data = { x:0, y:0 };
Vector.ForEach(m, test, data);
function test(v, extra)
{
// v is Vector object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Vector objects for all of the vectors in a model in Primer
Arguments
Name Type
Description
Return type
Array of Vector objects
Example
To make an array of Vector objects for all of the vectors in model m
var v = Vector.GetAll(m);
March 2016
Keywords 569
Vector class
Define
Arguments
Name Type
Description
Flag
Return type
Array of Vector objects
Example
To make an array of Vector objects for all of the vectors in model m flagged with f
var v = Vector.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the vector you want the Vector object for
Return type
Vector object (or null if vector does not exist).
Example
To get the Vector object for vector 100 in model m
var v = Vector.GetFromID(m, 100);
GetParameter(prop[vector property])
Description
Checks if a Vector 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 Vector.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Keywords 570
March 2016
Define
Vector class
Example
To check if Vector property v.example is a parameter:
Options.property_parameter_names = true;
if (v.GetParameter(v.example) ) do_something...
Options.property_parameter_names = false;
To check if Vector property v.example is a parameter by using the GetParameter method:
if (v.ViewParameters().GetParameter(v.example) ) do_something...
Keyword()
Description
Returns the keyword for this vector (*DEFINE_VECTOR). Note that a carriage return is not added. See also
Vector.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for vector m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the vector. Note that a carriage return is not added. See also Vector.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for vector v:
var cards = v.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last vector in the model.
Arguments
Name Type
Description
March 2016
Keywords 571
Vector class
Define
Return type
Vector object (or null if there are no vectors in the model).
Example
To get the last vector in model m:
var v = Vector.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Vector label.
Example
To get the last free vector label in model m:
var label = Vector.LastFreeLabel(m);
Next()
Description
Returns the next vector in the model.
Arguments
No arguments
Return type
Vector object (or null if there are no more vectors in the model).
Example
To get the vector in model m after vector v:
var v = v.Next();
Keywords 572
March 2016
Define
Vector class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Vector label.
Example
To get the next free vector label in model m:
var label = Vector.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the vector can be picked from any model.
modal
(optional)
boolean 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.
Return type
Vector object (or null if not picked)
Example
To pick a vector from model m giving the prompt Pick vector from screen:
var vector = Vector.Pick(Pick vector from screen, m);
Previous()
Description
Returns the previous vector in the model.
Arguments
No arguments
Return type
Vector object (or null if there are no more vectors in the model).
March 2016
Keywords 573
Vector class
Define
Example
To get the vector in model m before vector v:
var v = v.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the vectors in model m, from 1000000:
Vector.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged vectors will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the vectors in model m flagged with f, from 1000000:
Vector.RenumberFlagged(m, f, 1000000);
Keywords 574
March 2016
Define
Vector class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only vectors from that model can be selected. If the argument
Flag
is a Flag then only vectors that are flagged with limit can be selected (limit should be
different to flag). If omitted, or null, any vectors can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of vectors selected or null if menu cancelled
Example
To select vectors from model m, flagging those selected with flag f, giving the prompt Select vectors:
Vector.Select(f, Select vectors, m);
To select vectors, flagging those selected with flag f but limiting selection to vectors flagged with flag l, giving the
prompt Select vectors:
Vector.Select(f, Select vectors, l);
SetFlag(flag[Flag])
Description
Sets a flag on the vector.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for vector v:
v.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the vector. The vector will be sketched until you either call Vector.Unsketch(), Vector.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the vector is sketched. If omitted redraw is true. If you
want to sketch several vectors and only redraw after the last one then use false for redraw and
call View.Redraw().
March 2016
Keywords 575
Vector class
Define
Return type
No return value
Example
To sketch vector v:
v.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing vectors should be counted. If false or omitted referenced but undefined
vectors will also be included in the total.
Return type
number of vectors
Example
To get the total number of vectors in model m:
var total = Vector.Total(m);
Unblank()
Description
Unblanks the vector
Arguments
No arguments
Return type
No return value
Example
To unblank vector v:
v.Unblank();
Keywords 576
March 2016
Define
Vector class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the vectors in model m:
Vector.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the vectors in model m flagged with f:
Vector.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all vectors will be unset in
flag
Flag
Return type
No return value
March 2016
Keywords 577
Vector class
Define
Example
To unset the flag f on all the vectors in model m:
Vector.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the vector.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the vector is unsketched. If omitted redraw is true. If
you want to unsketch several vectors and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch vector v:
v.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the vectors 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().
Return type
No return value
Example
To unsketch all vectors in model m:
Vector.UnsketchAll(m);
ViewParameters()
Description
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.
Keywords 578
March 2016
Define
Vector class
Arguments
No arguments
Return type
Vector object.
Example
To check if Vector property v.example is a parameter by using the Vector.GetParameter() method:
if (v.ViewParameters().GetParameter(v.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for vector v:
v.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this vector.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for vector v:
var xrefs = v.Xrefs();
toString()
Description
Creates a string containing the vector data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Vector.Keyword() and Vector.KeywordCards().
March 2016
Keywords 579
Vector class
Define
Arguments
No arguments
Return type
string
Example
To get data for vector v in keyword format
var s = v.toString();
Keywords 580
March 2016
Element
Accelerometer class
Accelerometer class
The Accelerometer class gives you access to seatbelt accelerometer cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[accelerometer property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Accelerometer properties
Name
Type
Description
colour
exists
logical true if accelerometer exists, false if referred to but not defined. (read only)
igrav
integer Gravitational acceleration due to body force loads is included in acceleration output if igrav is
0, removed if igrav is 1.
include
intopt
integer Integration option; velocities are integrated from global accelerations and transformed into local
system if intopt is 0, they are integrated directly from local accelerations if intopt is 1.
March 2016
Keywords 581
Accelerometer class
Element
label
integer Accelerometer number. Also see the sbacid property which is an alternative name for this.
mass
real
model
nid1
nid2
nid3
sbacid
integer Accelerometer number. Also see the label property which is an alternative name for this.
transparency integer The transparency of the accelerometer (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Accelerometer class allows you to create, modify, edit and manipulate seatbelt accelerometer cards. See the
documentation below for more details.
Constructor
new Accelerometer(Model[Model], sbacid[integer], nid1[integer], nid2[integer],
nid3[integer], igrav (optional)[integer], intopt (optional)[integer], mass
(optional)[real])
Description
Create a new Seatbelt Accelerometer object.
Arguments
Name
Type
Description
Model
sbacid
integer Accelerometer number. Also see the label property which is an alternative name for this.
nid1
nid2
nid3
igrav
(optional)
integer Gravitational acceleration due to body force loads is included in acceleration output if igrav is
0, removed if igrav is 1.
intopt
(optional)
integer Integration option; velocities are integrated from global accelerations and transformed into
local system if intopt is 0, they are integrated directly from local accelerations if intopt is 1.
mass
(optional)
real
Return type
Accelerometer object
Example
To create a new seatbelt accelerometer in model m with label 100, nodes 1, 2 and 3:
var a = new Accelerometer(m, 100, 1, 2, 3);
Keywords 582
March 2016
Element
Accelerometer class
Details of functions
Blank()
Description
Blanks the accelerometer
Arguments
No arguments
Return type
No return value
Example
To blank accelerometer a:
a.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the accelerometers in model m:
Accelerometer.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
March 2016
Keywords 583
Accelerometer class
Element
Return type
No return value
Example
To blank all of the accelerometers in model m flagged with f:
Accelerometer.BlankFlagged(m, f);
Blanked()
Description
Checks if the accelerometer is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if accelerometer a is blanked:
if (a.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse accelerometer a:
a.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the accelerometer.
Arguments
Name Type Description
flag
Keywords 584
March 2016
Element
Accelerometer class
Return type
No return value
Example
To clear flag f for accelerometer a:
a.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the accelerometer.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy accelerometer a into accelerometer z:
var z = a.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Accelerometer object (or null if not made)
Example
To start creating an accelerometer in model m:
var a = Accelerometer.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
March 2016
Keywords 585
Accelerometer class
Element
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit accelerometer a:
a.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for accelerometer a:
a.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first accelerometer in the model.
Arguments
Name Type
Description
Return type
Accelerometer object (or null if there are no accelerometers in the model).
Example
To get the first accelerometer in model m:
var a = Accelerometer.First(m);
Keywords 586
March 2016
Element
Accelerometer class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Accelerometer label.
Example
To get the first free accelerometer label in model m:
var label = Accelerometer.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the accelerometers with flag f in model m:
Accelerometer.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the accelerometer is flagged or not.
Arguments
Name Type Description
flag
March 2016
Keywords 587
Accelerometer class
Element
Return type
true if flagged, false if not.
Example
To check if accelerometer a has flag f set on it:
if (a.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the accelerometers in model m:
Accelerometer.ForEach(m, test);
function test(a)
{
// a is Accelerometer object
}
To call function test for all of the accelerometers in model m with optional object:
var data = { x:0, y:0 };
Accelerometer.ForEach(m, test, data);
function test(a, extra)
{
// a is Accelerometer object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Accelerometer objects for all of the accelerometers in a model in Primer
Keywords 588
March 2016
Element
Accelerometer class
Arguments
Name Type
Description
Return type
Array of Accelerometer objects
Example
To make an array of Accelerometer objects for all of the accelerometers in model m
var a = Accelerometer.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Accelerometer objects
Example
To make an array of Accelerometer objects for all of the accelerometers in model m flagged with f
var a = Accelerometer.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the accelerometer you want the Accelerometer object for
Return type
Accelerometer object (or null if accelerometer does not exist).
Example
To get the Accelerometer object for accelerometer 100 in model m
var a = Accelerometer.GetFromID(m, 100);
March 2016
Keywords 589
Accelerometer class
Element
GetParameter(prop[accelerometer property])
Description
Checks if a Accelerometer 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 Accelerometer.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Accelerometer property a.example is a parameter:
Options.property_parameter_names = true;
if (a.GetParameter(a.example) ) do_something...
Options.property_parameter_names = false;
To check if Accelerometer property a.example is a parameter by using the GetParameter method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
Keyword()
Description
Returns the keyword for this accelerometer (*ELEMENT_SEATBELT_ACCELEROMETER) Note that a carriage
return is not added. See also Accelerometer.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for accelerometer a:
var key = a.Keyword();
KeywordCards()
Description
Returns the keyword cards for the accelerometer. Note that a carriage return is not added. See also
Accelerometer.Keyword()
Arguments
No arguments
Keywords 590
March 2016
Element
Accelerometer class
Return type
string containing the cards.
Example
To get the cards for accelerometer a:
var cards = a.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last accelerometer in the model.
Arguments
Name Type
Description
Return type
Accelerometer object (or null if there are no accelerometers in the model).
Example
To get the last accelerometer in model m:
var a = Accelerometer.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Accelerometer label.
Example
To get the last free accelerometer label in model m:
var label = Accelerometer.LastFreeLabel(m);
Next()
Description
Returns the next accelerometer in the model.
March 2016
Keywords 591
Accelerometer class
Element
Arguments
No arguments
Return type
Accelerometer object (or null if there are no more accelerometers in the model).
Example
To get the accelerometer in model m after accelerometer a:
var a = a.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Accelerometer label.
Example
To get the next free accelerometer label in model m:
var label = Accelerometer.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the accelerometer can be picked from any
model.
modal
(optional)
boolean 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.
button text
(optional)
string
Keywords 592
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.
March 2016
Element
Accelerometer class
Return type
Accelerometer object (or null if not picked)
Example
To pick a accelerometer from model m giving the prompt Pick accelerometer from screen:
var a = Accelerometer.Pick(Pick accelerometer from screen, m);
Previous()
Description
Returns the previous accelerometer in the model.
Arguments
No arguments
Return type
Accelerometer object (or null if there are no more accelerometers in the model).
Example
To get the accelerometer in model m before accelerometer a:
var a = a.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the accelerometers in model m, from 1000000:
Accelerometer.RenumberAll(m, 1000000);
March 2016
Keywords 593
Accelerometer class
Element
Arguments
Name Type
Description
Model Model Model that all the flagged accelerometers will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the accelerometers in model m flagged with f, from 1000000:
Accelerometer.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only accelerometers from that model can be selected. If the
Flag
argument is a Flag then only accelerometers that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any accelerometers can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of accelerometers selected or null if menu cancelled
Example
To select accelerometers from model m, flagging those selected with flag f, giving the prompt Select accelerometers:
Accelerometer.Select(f, Select accelerometers, m);
To select accelerometers, flagging those selected with flag f but limiting selection to accelerometers flagged with flag l,
giving the prompt Select accelerometers:
Accelerometer.Select(f, Select accelerometers, l);
SetFlag(flag[Flag])
Description
Sets a flag on the accelerometer.
Keywords 594
March 2016
Element
Accelerometer class
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for accelerometer a:
a.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the accelerometer. The accelerometer will be sketched until you either call Accelerometer.Unsketch(),
Accelerometer.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the accelerometer is sketched. If omitted redraw is
true. If you want to sketch several accelerometers and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch accelerometer a:
a.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing accelerometers should be counted. If false or omitted referenced but
undefined accelerometers will also be included in the total.
Return type
number of accelerometers
Example
To get the total number of accelerometers in model m:
var total = Accelerometer.Total(m);
March 2016
Keywords 595
Accelerometer class
Element
Unblank()
Description
Unblanks the accelerometer
Arguments
No arguments
Return type
No return value
Example
To unblank accelerometer a:
a.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the accelerometers in model m:
Accelerometer.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Keywords 596
March 2016
Element
Accelerometer class
Example
To unblank all of the accelerometers in model m flagged with f:
Accelerometer.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all accelerometers will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the accelerometers in model m:
Accelerometer.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the accelerometer.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the accelerometer is unsketched. If omitted redraw is
true. If you want to unsketch several accelerometers and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch accelerometer a:
a.Unsketch();
March 2016
Keywords 597
Accelerometer class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the accelerometers 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().
Return type
No return value
Example
To unsketch all accelerometers in model m:
Accelerometer.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Accelerometer object.
Example
To check if Accelerometer property a.example is a parameter by using the Accelerometer.GetParameter() method:
if (a.ViewParameters().GetParameter(a.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for accelerometer a:
a.Warning("My custom warning");
Keywords 598
March 2016
Element
Accelerometer class
Xrefs()
Description
Returns the cross references for this accelerometer.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for accelerometer a:
var xrefs = a.Xrefs();
toString()
Description
Creates a string containing the accelerometer data in keyword format. Note that this contains the keyword header and
the keyword cards. See also Accelerometer.Keyword() and Accelerometer.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for accelerometer a in keyword format
var str = a.toString();
March 2016
Keywords 599
Beam class
Element
Beam class
The Beam class gives you access to beam cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
ElemCut(Database cross section label[integer])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[beam property])
Keyword()
KeywordCards()
Next()
Previous()
SectionFacePoints(face[integer])
SectionFaces()
SectionPoints()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
TiedNodeCheck(Contact label[integer], Flag[Flag], Option1[integer], Option2[integer])
Timestep()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Beam properties
Name
Keywords 600
Type
Description
March 2016
Element
cid
cid
colour
d1
real
Section parameter 1
d2
real
Section parameter 2
d3
real
Section parameter 3
d4
real
Section parameter 4
d5
real
Section parameter 5
d6
real
Section parameter 6
dofn1
dofn2
dofns
eid
integer Beam number. Also see the label property which is an alternative name for this.
elbow
exists
logical true if beam exists, false if referred to but not defined. (read only)
include
iner
float
label
integer Beam number. Also see the eid property which is an alternative name for this.
local
mn
model
n1
n2
n3
nodes
offset
real
orientation
real
parm1
real
Thickness parameter 1
parm2
real
Thickness parameter 2
parm3
real
Thickness parameter 3
parm4
real
Thickness parameter 4
parm5
real
Thickness parameter 5
pid
pid1
pid2
pid_opt
rr1
rr2
Beam class
March 2016
Keywords 601
Beam class
Element
rt1
rt2
scalar
scalr
section
sn1
sn2
stype
string
thickness
Section type
transparency integer The transparency of the beam (0-100) 0% is opaque, 100% is transparent.
vol
float
Volume of beam
vx
float
vy
float
vz
float
warpage
wx1
float
wx2
float
wy1
float
wy2
float
wz1
float
wz2
float
Detailed Description
The Beam class allows you to create, modify, edit and manipulate beam cards. See the documentation below for more
details.
Constructor
new Beam(Model[Model], eid[integer], pid[integer], n1[integer], n2[integer],
n3[integer])
Description
Create a new Beam object. Use either 1, 2 or 3 nodes when creating a new beam.
Arguments
Name Type
Description
pid
n1
n2
n3
Keywords 602
March 2016
Element
Beam class
Return type
Beam object
Example
To create a new beam in model m with label 100, part 10 and nodes 1, 2, 3:
var b = new Beam(m, 100, 10, 1, 2, 3);
Details of functions
Blank()
Description
Blanks the beam
Arguments
No arguments
Return type
No return value
Example
To blank beam b:
b.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the beams in model m:
Beam.BlankAll(m);
March 2016
Keywords 603
Beam class
Element
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the beams in model m flagged with f:
Beam.BlankFlagged(m, f);
Blanked()
Description
Checks if the beam is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if beam b is blanked:
if (b.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse beam b:
b.Browse();
Keywords 604
March 2016
Element
Beam class
ClearFlag(flag[Flag])
Description
Clears a flag on the beam.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for beam b:
b.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the beam.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy beam b into beam z:
var z = b.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Beam object (or null if not made)
March 2016
Keywords 605
Beam class
Element
Example
To start creating a beam in model m:
var s = Beam.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit beam b:
b.Edit();
Arguments
Name
Type
Description
Database cross section label integer The label of the database cross section.
Return type
An array containing the x,y,z coordinates of the cut point, or NULL if it does not cut. Note this function does not check
that the beam is in the cross section definition (part set)
Example
To get the cut line coordinates between database cross section 200 and beam b:
var data = b.ElemCut(200)
Keywords 606
March 2016
Element
Beam class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for beam b:
b.Error("My custom error");
FindBeamEnd() [static]
Description
Tidy memory allocation incurred by function which finds beams within a box. See also Beam.FindBeamInit() See also
Beam.FindBeamInBox()
Arguments
No arguments
Return type
No return value
Example
Beam.FindBeamEnd();
Arguments
Name
Type
Description
Model
xmin
real
xmax
real
ymin
real
ymax
real
zmin
real
zmax
real
March 2016
Keywords 607
Beam class
Element
Return type
Array of Beam objects
Example
To get an array of Beam objects for flagged beams in model m within defined box
Beam.FindBeamInit(m, flag);
{
//loop in which boxes are formed and tested
//find beams both in box and flagged with bflag
var s = Beam.FindBeamInBox(m, xmin, xmax, ymin, ymax, zmin, zmax, bflag);
if(s.length) ...
}
Beam.FindBeamEnd();
Arguments
Name
Type
Model
Description
Optional flag that has been set on the beams, if unsupplied all beams considered
Return type
No return value
Example
To initialize find setup for beams flagged with f in model m:
Beam.FindBeamInit(m, f);
First(Model[Model]) [static]
Description
Returns the first beam in the model.
Arguments
Name Type
Description
Return type
Beam object (or null if there are no beams in the model).
Keywords 608
March 2016
Element
Beam class
Example
To get the first beam in model m:
var b = Beam.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Beam label.
Example
To get the first free beam label in model m:
var label = Beam.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the beams with flag f in model m:
Beam.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the beam is flagged or not.
March 2016
Keywords 609
Beam class
Element
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if beam b has flag f set on it:
if (b.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the beams in model m:
Beam.ForEach(m, test);
function test(b)
{
// b is Beam object
}
To call function test for all of the beams in model m with optional object:
var data = { x:0, y:0 };
Beam.ForEach(m, test, data);
function test(b, extra)
{
// b is Beam object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Beam objects for all of the beams in a model in Primer
Keywords 610
March 2016
Element
Beam class
Arguments
Name Type
Description
Return type
Array of Beam objects
Example
To make an array of Beam objects for all of the beams in model m
var b = Beam.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Beam objects
Example
To make an array of Beam objects for all of the beams in model m flagged with f
var b = Beam.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the beam you want the Beam object for
Return type
Beam object (or null if beam does not exist).
Example
To get the Beam object for beam 100 in model m
var b = Beam.GetFromID(m, 100);
March 2016
Keywords 611
Beam class
Element
GetParameter(prop[beam property])
Description
Checks if a Beam 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 Beam.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Beam property b.example is a parameter:
Options.property_parameter_names = true;
if (b.GetParameter(b.example) ) do_something...
Options.property_parameter_names = false;
To check if Beam property b.example is a parameter by using the GetParameter method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Keyword()
Description
Returns the keyword for this beam (*BEAM, *BEAM_SCALAR or *BEAM_SCALAR_VALUE). Note that a
carriage return is not added. See also Beam.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for beam s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the beam. Note that a carriage return is not added. See also Beam.Keyword()
Arguments
No arguments
Keywords 612
March 2016
Element
Beam class
Return type
string containing the cards.
Example
To get the cards for beam b:
var cards = b.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last beam in the model.
Arguments
Name Type
Description
Return type
Beam object (or null if there are no beams in the model).
Example
To get the last beam in model m:
var b = Beam.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Beam label.
Example
To get the last free beam label in model m:
var label = Beam.LastFreeLabel(m);
Next()
Description
Returns the next beam in the model.
March 2016
Keywords 613
Beam class
Element
Arguments
No arguments
Return type
Beam object (or null if there are no more beams in the model).
Example
To get the beam in model m after beam b:
var b = b.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Beam label.
Example
To get the next free beam label in model m:
var label = Beam.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the beam can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
Keywords 614
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.
March 2016
Element
Beam class
Return type
Beam object (or null if not picked)
Example
To pick a beam from model m giving the prompt Pick beam from screen:
var b = Beam.Pick(Pick beam from screen, m);
Previous()
Description
Returns the previous beam in the model.
Arguments
No arguments
Return type
Beam object (or null if there are no more beams in the model).
Example
To get the beam in model m before beam b:
var b = b.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the beams in model m, from 1000000:
Beam.RenumberAll(m, 1000000);
March 2016
Keywords 615
Beam class
Element
Arguments
Name Type
Description
Model Model Model that all the flagged beams will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the beams in model m flagged with f, from 1000000:
Beam.RenumberFlagged(m, f, 1000000);
SectionFacePoints(face[integer])
Description
Returns the indices of the points for a faces to plot the true section of the beam. Note face numbers start at 0.
Beam.SectionPoints must be called before this method.
Arguments
Name Type
face
Description
Return type
array
Example
To get the indices of the points for the second face on beam b:
var indices = b.SectionFacePoints(1);
SectionFaces()
Description
Returns the number of faces to plot the true section of the beam. Beam.SectionPoints must be called before this method.
Arguments
No arguments
Return type
integer
Example
To get the number of faces for beam b:
var faces = b.SectionFaces();
Keywords 616
March 2016
Element
Beam class
SectionPoints()
Description
Returns the point coordinates to plot the true section of the beam. They are returned in a single array of numbers.
Arguments
No arguments
Return type
array
Example
To get the point coordinates for beam b:
var points = b.SectionPoints();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only beams from that model can be selected. If the argument
Flag
is a Flag then only beams that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any beams can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of beams selected or null if menu cancelled
Example
To select beams from model m, flagging those selected with flag f, giving the prompt Select beams:
Beam.Select(f, Select beams, m);
To select beams, flagging those selected with flag f but limiting selection to beams flagged with flag l, giving the
prompt Select beams:
Beam.Select(f, Select beams, l);
SetFlag(flag[Flag])
Description
Sets a flag on the beam.
March 2016
Keywords 617
Beam class
Element
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for beam b:
b.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the beam. The beam will be sketched until you either call Beam.Unsketch(), Beam.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the beam is sketched. If omitted redraw is true. If you
want to sketch several beams and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch beam b:
b.Sketch();
Arguments
Name
Type
Description
Contact
label
integer The label of the tied contact. If zero the tied contact is found for the beam by reverse lookup.
Flag
Flag
Option1
integer Directly tied node (logical OR) 0:NONE 1:NRB/C_EXNO 2:BEAM 4:SHELL 8:SOLID
16:TSHELL
Option2
integer 0:No action 1:report error if directly attached node (acc. option1) also captured by contact
flag bit
Return type
string
Keywords 618
March 2016
Element
Beam class
Example
To check if both nodes of beam b are tied by contact 200 or attach directly to constraint, beam or shell:
var message = b.TiedNodeCheck(200, flag, 1|2|4, 1)
Timestep()
Description
Calculates the timestep for the beam
Arguments
No arguments
Return type
float
Example
To calculate the timestep for beam b:
var timestep = b.Timestep();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing beams should be counted. If false or omitted referenced but undefined
beams will also be included in the total.
Return type
number of beams
Example
To get the total number of beams in model m:
var total = Beam.Total(m);
Unblank()
Description
Unblanks the beam
Arguments
No arguments
Return type
No return value
March 2016
Keywords 619
Beam class
Element
Example
To unblank beam b:
b.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the beams in model m:
Beam.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the beams in model m flagged with f:
Beam.UnblankFlagged(m, f);
Keywords 620
March 2016
Element
Beam class
Arguments
Name Type
Description
Model Model Model that the defined flag for all beams will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the beams in model m:
Beam.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the beam.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the beam is unsketched. If omitted redraw is true. If
you want to unsketch several beams and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch beam b:
b.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the beams 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().
Return type
No return value
March 2016
Keywords 621
Beam class
Element
Example
To unsketch all beams in model m:
Beam.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Beam object.
Example
To check if Beam property b.example is a parameter by using the Beam.GetParameter() method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for beam b:
b.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this beam.
Arguments
No arguments
Keywords 622
March 2016
Element
Beam class
Return type
Xrefs object.
Example
To get the cross references for beam b:
var xrefs = b.Xrefs();
toString()
Description
Creates a string containing the beam data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Beam.Keyword() and Beam.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for beam b in keyword format
var str = b.toString();
March 2016
Keywords 623
Discrete class
Element
Discrete class
The Discrete class gives you access to element discrete cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[discrete property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Timestep()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Discrete properties
Name
Type
colour
eid
integer Discrete number. Also see the label property which is an alternative name for this.
exists
logical
include
label
integer Discrete number. Also see the eid property which is an alternative name for this.
Keywords 624
Description
true if discrete exists, false if referred to but not defined. (read only)
March 2016
Element
lcid
lciddr
lco
model
n1
n2
offset
float
pf
pid
float
Discrete class
Initial offset
transparency integer The transparency of the discrete (0-100) 0% is opaque, 100% is transparent.
vid
Detailed Description
The Discrete class allows you to create, modify, edit and manipulate discrete cards. See the documentation below for
more details.
Constructor
new Discrete(Model[Model], eid[integer], pid[integer], n1[integer], n2[integer],
vid (optional)[integer], s (optional)[float], pf (optional)[integer], offset
(optional)[float])
Description
Create a new Discrete object.
Arguments
Name
Type
Model
eid
pid
n1
n2
vid (optional)
s (optional)
float
pf (optional)
Description
Initial offset
Return type
Discrete object
Example
To create a new discrete in model m with label 200, in part 10, on nodes 1 and 2
var m = new Discrete(m, 200, 10, 1, 2);
March 2016
Keywords 625
Discrete class
Element
Details of functions
Blank()
Description
Blanks the discrete
Arguments
No arguments
Return type
No return value
Example
To blank discrete d:
d.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the discretes in model m:
Discrete.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Keywords 626
March 2016
Element
Discrete class
Return type
No return value
Example
To blank all of the discretes in model m flagged with f:
Discrete.BlankFlagged(m, f);
Blanked()
Description
Checks if the discrete is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if discrete d is blanked:
if (d.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse discrete d:
d.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the discrete.
Arguments
Name Type Description
flag
March 2016
Keywords 627
Discrete class
Element
Return type
No return value
Example
To clear flag f for discrete d:
d.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the discrete.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy discrete d into discrete z:
var z = d.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Discrete object (or null if not made)
Example
To start creating a discrete in model m:
var m = Discrete.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Keywords 628
March 2016
Element
Discrete class
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit discrete d:
d.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for discrete d:
d.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first discrete in the model.
Arguments
Name Type
Description
Return type
Discrete object (or null if there are no discretes in the model).
Example
To get the first discrete in model m:
var d = Discrete.First(m);
March 2016
Keywords 629
Discrete class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Discrete label.
Example
To get the first free discrete label in model m:
var label = Discrete.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the discretes with flag f in model m:
Discrete.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the discrete is flagged or not.
Arguments
Name Type Description
flag
Keywords 630
March 2016
Element
Discrete class
Return type
true if flagged, false if not.
Example
To check if discrete d has flag f set on it:
if (d.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the discretes in model m:
Discrete.ForEach(m, test);
function test(d)
{
// d is Discrete object
}
To call function test for all of the discretes in model m with optional object:
var data = { x:0, y:0 };
Discrete.ForEach(m, test, data);
function test(d, extra)
{
// d is Discrete object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Discrete objects for all of the discretes in a model in Primer
March 2016
Keywords 631
Discrete class
Element
Arguments
Name Type
Description
Return type
Array of Discrete objects
Example
To make an array of Discrete objects for all of the discretes in model m
var d = Discrete.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Discrete objects
Example
To make an array of Discrete objects for all of the discretes in model m flagged with f
var d = Discrete.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the discrete you want the Discrete object for
Return type
Discrete object (or null if discrete does not exist).
Example
To get the Discrete object for discrete 100 in model m
var d = Discrete.GetFromID(m, 100);
Keywords 632
March 2016
Element
Discrete class
GetParameter(prop[discrete property])
Description
Checks if a Discrete 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 Discrete.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Discrete property d.example is a parameter:
Options.property_parameter_names = true;
if (d.GetParameter(d.example) ) do_something...
Options.property_parameter_names = false;
To check if Discrete property d.example is a parameter by using the GetParameter method:
if (d.ViewParameters().GetParameter(d.example) ) do_something...
Keyword()
Description
Returns the keyword for this discrete (*ELEMENT_DISCRETE). Note that a carriage return is not added. See also
Discrete.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for discrete m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the discrete. Note that a carriage return is not added. See also Discrete.Keyword()
Arguments
No arguments
March 2016
Keywords 633
Discrete class
Element
Return type
string containing the cards.
Example
To get the cards for discrete d:
var cards = d.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last discrete in the model.
Arguments
Name Type
Description
Return type
Discrete object (or null if there are no discretes in the model).
Example
To get the last discrete in model m:
var d = Discrete.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Discrete label.
Example
To get the last free discrete label in model m:
var label = Discrete.LastFreeLabel(m);
Next()
Description
Returns the next discrete in the model.
Keywords 634
March 2016
Element
Discrete class
Arguments
No arguments
Return type
Discrete object (or null if there are no more discretes in the model).
Example
To get the discrete in model m after discrete d:
var d = d.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Discrete label.
Example
To get the next free discrete label in model m:
var label = Discrete.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the discrete can be picked from any model.
modal
(optional)
boolean 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.
Return type
Discrete object (or null if not picked)
March 2016
Keywords 635
Discrete class
Element
Example
To pick a discrete from model m giving the prompt Pick discrete from screen:
var discrete = Discrete.Pick(Pick discrete from screen, m);
Previous()
Description
Returns the previous discrete in the model.
Arguments
No arguments
Return type
Discrete object (or null if there are no more discretes in the model).
Example
To get the discrete in model m before discrete d:
var d = d.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the discretes in model m, from 1000000:
Discrete.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged discretes will be renumbered in
flag
Flag
start
Keywords 636
March 2016
Element
Discrete class
Return type
No return value
Example
To renumber all of the discretes in model m flagged with f, from 1000000:
Discrete.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only discretes from that model can be selected. If the
Flag
argument is a Flag then only discretes that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any discretes can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of discretes selected or null if menu cancelled
Example
To select discretes from model m, flagging those selected with flag f, giving the prompt Select discretes:
Discrete.Select(f, Select discretes, m);
To select discretes, flagging those selected with flag f but limiting selection to discretes flagged with flag l, giving the
prompt Select discretes:
Discrete.Select(f, Select discretes, l);
SetFlag(flag[Flag])
Description
Sets a flag on the discrete.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Keywords 637
Discrete class
Element
Example
To set flag f for discrete d:
d.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the discrete. The discrete will be sketched until you either call Discrete.Unsketch(), Discrete.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the discrete is sketched. If omitted redraw is true. If
you want to sketch several discretes and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch discrete d:
d.Sketch();
Timestep()
Description
Calculates the timestep for the discrete
Arguments
No arguments
Return type
float
Example
To calculate the timestep for discrete d:
var timestep = d.Timestep();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing discretes should be counted. If false or omitted referenced but undefined
discretes will also be included in the total.
Keywords 638
March 2016
Element
Discrete class
Return type
number of discretes
Example
To get the total number of discretes in model m:
var total = Discrete.Total(m);
Unblank()
Description
Unblanks the discrete
Arguments
No arguments
Return type
No return value
Example
To unblank discrete d:
d.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the discretes in model m:
Discrete.UnblankAll(m);
March 2016
Keywords 639
Discrete class
Element
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the discretes in model m flagged with f:
Discrete.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all discretes will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the discretes in model m:
Discrete.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the discrete.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the discrete is unsketched. If omitted redraw is true. If
you want to unsketch several discretes and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Keywords 640
March 2016
Element
Discrete class
Example
To unsketch discrete d:
d.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the discretes 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().
Return type
No return value
Example
To unsketch all discretes in model m:
Discrete.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Discrete object.
Example
To check if Discrete property d.example is a parameter by using the Discrete.GetParameter() method:
if (d.ViewParameters().GetParameter(d.example) ) do_something...
March 2016
Keywords 641
Discrete class
Element
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for discrete d:
d.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this discrete.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for discrete d:
var xrefs = d.Xrefs();
toString()
Description
Creates a string containing the discrete data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Discrete.Keyword() and Discrete.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for discrete d in keyword format
var s = d.toString();
Keywords 642
March 2016
Element
DiscreteSphere class
DiscreteSphere class
The DiscreteSphere class gives you access to element discrete sphere cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[discrete sphere property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
DiscreteSphere properties
Name
Type
Description
colour
exists
logical true if discrete sphere exists, false if referred to but not defined. (read only)
include
integer The Include file number that the discrete sphere is in.
inertia
real
mass
real
model
nid
March 2016
Keywords 643
DiscreteSphere class
Element
pid
radius
real
Particle radius.
transparency integer The transparency of the discrete sphere (0-100) 0% is opaque, 100% is transparent.
volume
logical Turns _VOLUME on or OFF. Note that this does NOT refer to the data field VOLUME. For
the latter see the mass property.
Detailed Description
The DiscreteSphere class allows you to create, modify, edit and manipulate discrete sphere cards. See the
documentation below for more details.
Constructor
new DiscreteSphere(Model[Model], nid[integer], pid[integer], mass[real],
inertia[real], radius[real])
Description
Create a new DiscreteSphere object.
Arguments
Name Type
Description
integer Node ID and Element ID are the same for discrete spheres.
pid
mass
real
inertia real
radius real
Particle radius.
Return type
DiscreteSphere object
Example
To create a new discrete sphere in model m with nid = 100, pid = 400, mass = 0.9, inertia = 2.5, radius = 2.0:
var dsph = new DiscreteSphere(m, 100, 400, 0.9, 2.5, 2.0);
Details of functions
Blank()
Description
Blanks the discrete sphere
Arguments
No arguments
Return type
No return value
Keywords 644
March 2016
Element
DiscreteSphere class
Example
To blank discrete sphere dsph:
dsph.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the discrete spheres in model m:
DiscreteSphere.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the discrete spheres in model m flagged with f:
DiscreteSphere.BlankFlagged(m, f);
Blanked()
Description
Checks if the discrete sphere is blanked or not.
March 2016
Keywords 645
DiscreteSphere class
Element
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if discrete sphere dsph is blanked:
if (dsph.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse discrete sphere dsph:
dsph.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the discrete sphere.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for discrete sphere dsph:
dsph.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the discrete sphere.
Keywords 646
March 2016
Element
DiscreteSphere class
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy discrete sphere dsph into discrete sphere z:
var z = dsph.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
DiscreteSphere object (or null if not made)
Example
To start creating a discrete sphere in model m:
var dsph = DiscreteSphere.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit discrete sphere dsph:
dsph.Edit();
March 2016
Keywords 647
DiscreteSphere class
Element
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for discrete sphere dsph:
dsph.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first discrete sphere in the model.
Arguments
Name Type
Description
Return type
DiscreteSphere object (or null if there are no discrete spheres in the model).
Example
To get the first discrete sphere in model m:
var dsph = DiscreteSphere.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Keywords 648
March 2016
Element
DiscreteSphere class
Return type
DiscreteSphere label.
Example
To get the first free discrete sphere label in model m:
var label = DiscreteSphere.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the discrete spheres with flag f in model m:
DiscreteSphere.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the discrete sphere is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if discrete sphere dsph has flag f set on it:
if (dsph.Flagged(f) ) do_something...
March 2016
Keywords 649
DiscreteSphere class
Element
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the discrete spheres in model m:
DiscreteSphere.ForEach(m, test);
function test(dsph)
{
// dsph is DiscreteSphere object
}
To call function test for all of the discrete spheres in model m with optional object:
var data = { x:0, y:0 };
DiscreteSphere.ForEach(m, test, data);
function test(dsph, extra)
{
// dsph is DiscreteSphere object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of DiscreteSphere objects for all of the discrete spheres in a model in Primer
Arguments
Name Type
Description
Return type
Array of DiscreteSphere objects
Example
To make an array of DiscreteSphere objects for all of the discrete spheres in model m
var dsph = DiscreteSphere.GetAll(m);
Keywords 650
March 2016
Element
DiscreteSphere class
Arguments
Name Type
Description
Flag
Return type
Array of DiscreteSphere objects
Example
To make an array of DiscreteSphere objects for all of the discrete spheres in model m flagged with f
var dsph = DiscreteSphere.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the discrete sphere you want the DiscreteSphere object for
Return type
DiscreteSphere object (or null if discrete sphere does not exist).
Example
To get the DiscreteSphere object for discrete sphere 100 in model m
var dsph = DiscreteSphere.GetFromID(m, 100);
Arguments
Name Type
prop
Description
March 2016
Keywords 651
DiscreteSphere class
Element
Return type
Parameter object if property is a parameter, null if not.
Example
To check if DiscreteSphere property dsph.example is a parameter:
Options.property_parameter_names = true;
if (dsph.GetParameter(dsph.example) ) do_something...
Options.property_parameter_names = false;
To check if DiscreteSphere property dsph.example is a parameter by using the GetParameter method:
if (dsph.ViewParameters().GetParameter(dsph.example) ) do_something...
Keyword()
Description
Returns the keyword for this discrete sphere (*ELEMENT_DISCRETE_SPHERE or *ELEMENT_DISCRETE_
SPHERE_VOLUME). Note that a carriage return is not added. See also DiscreteSphere.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for discrete sphere dsph:
var key = dsph.Keyword();
KeywordCards()
Description
Returns the keyword cards for the discrete sphere. Note that a carriage return is not added. See also
DiscreteSphere.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for discrete sphere dsph:
var cards = dsph.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last discrete sphere in the model.
Keywords 652
March 2016
Element
DiscreteSphere class
Arguments
Name Type
Description
Return type
DiscreteSphere object (or null if there are no discrete spheres in the model).
Example
To get the last discrete sphere in model m:
var dsph = DiscreteSphere.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
DiscreteSphere label.
Example
To get the last free discrete sphere label in model m:
var label = DiscreteSphere.LastFreeLabel(m);
Next()
Description
Returns the next discrete sphere in the model.
Arguments
No arguments
Return type
DiscreteSphere object (or null if there are no more discrete spheres in the model).
Example
To get the discrete sphere in model m after discrete sphere dsph:
var dsph = dsph.Next();
March 2016
Keywords 653
DiscreteSphere class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
DiscreteSphere label.
Example
To get the next free discrete sphere label in model m:
var label = DiscreteSphere.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the discrete sphere can be picked from any
model.
modal
(optional)
boolean 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.
Return type
DiscreteSphere object (or null if not picked)
Example
To pick a discrete sphere from model m giving the prompt Pick discrete sphere from screen:
var dsph = DiscreteSphere.Pick(Pick discrete sphere from screen, m);
Previous()
Description
Returns the previous discrete sphere in the model.
Arguments
No arguments
Keywords 654
March 2016
Element
DiscreteSphere class
Return type
DiscreteSphere object (or null if there are no more discrete spheres in the model).
Example
To get the discrete sphere in model m before discrete sphere dsph:
var dsph = dsph.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only discrete spheres from that model can be selected. If the
Flag
argument is a Flag then only discrete spheres that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any discrete spheres can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of discrete spheres selected or null if menu cancelled
Example
To select discrete spheres from model m, flagging those selected with flag f, giving the prompt Select discrete spheres:
DiscreteSphere.Select(f, Select discrete spheres, m);
To select discrete spheres, flagging those selected with flag f but limiting selection to discrete spheres flagged with flag
l, giving the prompt Select discrete spheres:
DiscreteSphere.Select(f, Select discrete spheres, l);
SetFlag(flag[Flag])
Description
Sets a flag on the discrete sphere.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Keywords 655
DiscreteSphere class
Element
Example
To set flag f for discrete sphere dsph:
dsph.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the discrete sphere. The discrete sphere will be sketched until you either call DiscreteSphere.Unsketch(),
DiscreteSphere.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the discrete sphere is sketched. If omitted redraw is
true. If you want to sketch several discrete spheres and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch discrete sphere dsph:
dsph.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing discrete spheres should be counted. If false or omitted referenced but
undefined discrete spheres will also be included in the total.
Return type
number of discrete spheres
Example
To get the total number of discrete spheres in model m:
var total = DiscreteSphere.Total(m);
Unblank()
Description
Unblanks the discrete sphere
Keywords 656
March 2016
Element
DiscreteSphere class
Arguments
No arguments
Return type
No return value
Example
To unblank discrete sphere dsph:
dsph.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the discrete spheres in model m:
DiscreteSphere.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
Keywords 657
DiscreteSphere class
Element
Example
To unblank all of the discrete spheres in model m flagged with f:
DiscreteSphere.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all discrete spheres will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the discrete spheres in model m:
DiscreteSphere.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the discrete sphere.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the discrete sphere is unsketched. If omitted redraw is
true. If you want to unsketch several discrete spheres and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch discrete sphere dsph:
dsph.Unsketch();
Keywords 658
March 2016
Element
DiscreteSphere class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the discrete spheres 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().
Return type
No return value
Example
To unsketch all discrete spheres in model m:
DiscreteSphere.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
DiscreteSphere object.
Example
To check if DiscreteSphere property dsph.example is a parameter by using the DiscreteSphere.GetParameter() method:
if (dsph.ViewParameters().GetParameter(dsph.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for discrete sphere dsph:
dsph.Warning("My custom warning");
March 2016
Keywords 659
DiscreteSphere class
Element
Xrefs()
Description
Returns the cross references for this discrete sphere.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for discrete sphere dsph:
var xrefs = dsph.Xrefs();
toString()
Description
Creates a string containing the discrete sphere data in keyword format. Note that this contains the keyword header and
the keyword cards. See also DiscreteSphere.Keyword() and DiscreteSphere.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for discrete sphere dsph in keyword format
var s = dsph.toString();
Keywords 660
March 2016
Element
Mass class
Mass class
The Mass class gives you access to element mass cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[mass property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Mass constants
Name
Description
Mass properties
Name
Type
Description
colour
eid
integer Mass number. Also see the label property which is an alternative name for this.
March 2016
Keywords 661
Mass class
Element
exists
logical true if mass exists, false if referred to but not defined. (read only)
id
include
label
integer Mass number. Also see the eid property which is an alternative name for this.
mass
float
model
node_set
integer The type of the mass. Can be false (*MASS) or Mass.NODE_SET (*MASS_NODE_SET)
pid
integer Part ID
Mass value
transparency integer The transparency of the mass (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Mass class allows you to create, modify, edit and manipulate mass cards. See the documentation below for more
details.
Constructor
new Mass(Model[Model], eid[integer], id[integer], mass[float], node set
(optional)[integer])
Description
Create a new Mass object.
Arguments
Name
Type
Description
Model
eid
id
mass
float
Mass value
Return type
Mass object
Example
To create a new mass in model m with label 200, on node 500, or node set 500, with a mass of 3.5, use one of the
following:
var m = new Mass(m, 200, 500, 3.5);
var m = new Mass(m, 200, 500, 3.5, Mass.NODE_SET);
Details of functions
Blank()
Description
Blanks the mass
Keywords 662
March 2016
Element
Mass class
Arguments
No arguments
Return type
No return value
Example
To blank mass m:
m.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the masss in model m:
Mass.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the masss in model m flagged with f:
Mass.BlankFlagged(m, f);
March 2016
Keywords 663
Mass class
Element
Blanked()
Description
Checks if the mass is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if mass m is blanked:
if (m.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse mass m:
m.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the mass.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for mass m:
m.ClearFlag(f);
Keywords 664
March 2016
Element
Mass class
Copy(range (optional)[boolean])
Description
Copies the mass.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy mass m into mass z:
var z = m.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Mass object (or null if not made)
Example
To start creating a mass in model m:
var m = Mass.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
March 2016
Keywords 665
Mass class
Element
Example
To Edit mass m:
m.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for mass m:
m.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first mass in the model.
Arguments
Name Type
Description
Return type
Mass object (or null if there are no masss in the model).
Example
To get the first mass in model m:
var m = Mass.First(m);
Keywords 666
March 2016
Element
Mass class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Mass label.
Example
To get the first free mass label in model m:
var label = Mass.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the masss with flag f in model m:
Mass.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the mass is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if mass m has flag f set on it:
if (m.Flagged(f) ) do_something...
March 2016
Keywords 667
Mass class
Element
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the masss in model m:
Mass.ForEach(m, test);
function test(m)
{
// m is Mass object
}
To call function test for all of the masss in model m with optional object:
var data = { x:0, y:0 };
Mass.ForEach(m, test, data);
function test(m, extra)
{
// m is Mass object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Mass objects for all of the masss in a model in Primer
Arguments
Name Type
Description
Return type
Array of Mass objects
Example
To make an array of Mass objects for all of the masss in model m
var m = Mass.GetAll(m);
Keywords 668
March 2016
Element
Mass class
Arguments
Name Type
Description
Flag
Return type
Array of Mass objects
Example
To make an array of Mass objects for all of the masss in model m flagged with f
var m = Mass.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the mass you want the Mass object for
Return type
Mass object (or null if mass does not exist).
Example
To get the Mass object for mass 100 in model m
var m = Mass.GetFromID(m, 100);
GetParameter(prop[mass property])
Description
Checks if a Mass 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 Mass.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
March 2016
Keywords 669
Mass class
Element
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Mass property m.example is a parameter:
Options.property_parameter_names = true;
if (m.GetParameter(m.example) ) do_something...
Options.property_parameter_names = false;
To check if Mass property m.example is a parameter by using the GetParameter method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
Keyword()
Description
Returns the keyword for this mass (*ELEMENT_MASS or *ELEMENT_MASS_NODE_SET). Note that a carriage
return is not added. See also Mass.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for mass m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the mass. Note that a carriage return is not added. See also Mass.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for mass m:
var cards = m.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last mass in the model.
Keywords 670
March 2016
Element
Mass class
Arguments
Name Type
Description
Return type
Mass object (or null if there are no masss in the model).
Example
To get the last mass in model m:
var m = Mass.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Mass label.
Example
To get the last free mass label in model m:
var label = Mass.LastFreeLabel(m);
Next()
Description
Returns the next mass in the model.
Arguments
No arguments
Return type
Mass object (or null if there are no more masss in the model).
Example
To get the mass in model m after mass m:
var m = m.Next();
March 2016
Keywords 671
Mass class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Mass label.
Example
To get the next free mass label in model m:
var label = Mass.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the mass can be picked from any model.
modal
(optional)
boolean 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.
Return type
Mass object (or null if not picked)
Example
To pick a mass from model m giving the prompt Pick mass from screen:
var mass = Mass.Pick(Pick mass from screen, m);
Previous()
Description
Returns the previous mass in the model.
Arguments
No arguments
Keywords 672
March 2016
Element
Mass class
Return type
Mass object (or null if there are no more masss in the model).
Example
To get the mass in model m before mass m:
var m = m.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the masss in model m, from 1000000:
Mass.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged masss will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the masss in model m flagged with f, from 1000000:
Mass.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 673
Mass class
Element
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only masss from that model can be selected. If the argument
Flag
is a Flag then only masss that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any masss can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of masss selected or null if menu cancelled
Example
To select masss from model m, flagging those selected with flag f, giving the prompt Select masss:
Mass.Select(f, Select masss, m);
To select masss, flagging those selected with flag f but limiting selection to masss flagged with flag l, giving the prompt
Select masss:
Mass.Select(f, Select masss, l);
SetFlag(flag[Flag])
Description
Sets a flag on the mass.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for mass m:
m.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the mass. The mass will be sketched until you either call Mass.Unsketch(), Mass.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Keywords 674
March 2016
Element
Mass class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the mass is sketched. If omitted redraw is true. If you
want to sketch several masss and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch mass m:
m.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing masss should be counted. If false or omitted referenced but undefined
masss will also be included in the total.
Return type
number of masss
Example
To get the total number of masss in model m:
var total = Mass.Total(m);
Unblank()
Description
Unblanks the mass
Arguments
No arguments
Return type
No return value
Example
To unblank mass m:
m.Unblank();
March 2016
Keywords 675
Mass class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the masss in model m:
Mass.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the masss in model m flagged with f:
Mass.UnblankFlagged(m, f);
Keywords 676
March 2016
Element
Mass class
Arguments
Name Type
Description
Model Model Model that the defined flag for all masss will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the masss in model m:
Mass.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the mass.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the mass is unsketched. If omitted redraw is true. If
you want to unsketch several masss and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To unsketch mass m:
m.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the masss 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().
Return type
No return value
March 2016
Keywords 677
Mass class
Element
Example
To unsketch all masss in model m:
Mass.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Mass object.
Example
To check if Mass property m.example is a parameter by using the Mass.GetParameter() method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for mass m:
m.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this mass.
Arguments
No arguments
Keywords 678
March 2016
Element
Mass class
Return type
Xrefs object.
Example
To get the cross references for mass m:
var xrefs = m.Xrefs();
toString()
Description
Creates a string containing the mass data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Mass.Keyword() and Mass.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for mass m in keyword format
var s = m.toString();
March 2016
Keywords 679
MassPart class
Element
MassPart class
The MassPart class gives you access to element mass part cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[element mass part property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
MassPart constants
Name
Description
Element is *ELEMENT_MASS_PART_SET.
MassPart properties
Name
Type
Description
addmass
real
Added translational mass to be distributed to the nodes of the part or part set ID.
colour
Colour
exists
logical
true if mass part exists, false if referred to but not defined. (read only)
Keywords 680
March 2016
Element
finmass
real
id
integer
include
integer
lcid
integer
model
integer
mwd
integer
option
transparency integer
MassPart class
Detailed Description
The MassPart class allows you to create, modify, edit and manipulate element mass part cards. See the documentation
below for more details.
Constructor
new MassPart(Model[Model], option[constant], id[integer], addmass
(optional)[real], finmass (optional)[real])
Description
Create a new MassPart object.
Arguments
Name
Type
Description
Model
Model
option
id
integer
Return type
MassPart object
Example
To create a new element mass part in model m with option _<BLANK> and part ID 10:
var mp = new MassPart(m, MassPart.PART, 10);
Details of functions
Blank()
Description
Blanks the element mass part
Arguments
No arguments
March 2016
Keywords 681
MassPart class
Element
Return type
No return value
Example
To blank element mass part mp:
mp.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the element mass parts in model m:
MassPart.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged element mass parts will be blanked in
flag
Flag
Flag set on the element mass parts that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the element mass parts in model m flagged with f:
MassPart.BlankFlagged(m, f);
Keywords 682
March 2016
Element
MassPart class
Blanked()
Description
Checks if the element mass part is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if element mass part mp is blanked:
if (mp.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse element mass part mp:
mp.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the element mass part.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for element mass part mp:
mp.ClearFlag(f);
March 2016
Keywords 683
MassPart class
Element
Copy(range (optional)[boolean])
Description
Copies the element mass part.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy element mass part mp into element mass part z:
var z = mp.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
MassPart object (or null if not made)
Example
To start creating a mass part in model m:
var mp = MassPart.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Keywords 684
March 2016
Element
MassPart class
Example
To Edit element mass part mp:
mp.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for element mass part mp:
mp.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first element mass part in the model.
Arguments
Name Type
Description
Return type
MassPart object (or null if there are no element mass parts in the model).
Example
To get the first element mass part in model m:
var mp = MassPart.First(m);
March 2016
Keywords 685
MassPart class
Element
Arguments
Name Type
Description
Model Model Model that all element mass parts will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the element mass parts with flag f in model m:
MassPart.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the element mass part is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if element mass part mp has flag f set on it:
if (mp.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
Keywords 686
An optional extra object/array/string etc that will appended to arguments when calling the
function
March 2016
Element
MassPart class
Return type
No return value
Example
To call function test for all of the element mass parts in model m:
MassPart.ForEach(m, test);
function test(mp)
{
// mp is MassPart object
}
To call function test for all of the element mass parts in model m with optional object:
var data = { x:0, y:0 };
MassPart.ForEach(m, test, data);
function test(mp, extra)
{
// mp is MassPart object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of MassPart objects for all of the element mass parts in a model in Primer
Arguments
Name Type
Description
Return type
Array of MassPart objects
Example
To make an array of MassPart objects for all of the element mass parts in model m
var mp = MassPart.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the element mass parts that you want to retrieve
Return type
Array of MassPart objects
March 2016
Keywords 687
MassPart class
Element
Example
To make an array of MassPart objects for all of the element mass parts in model m flagged with f
var mp = MassPart.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the element mass part you want the MassPart object for
Return type
MassPart object (or null if element mass part does not exist).
Example
To get the MassPart object for element mass part 100 in model m
var mp = MassPart.GetFromID(m, 100);
Arguments
Name Type
prop
Description
element mass part property element mass part property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if MassPart property mp.example is a parameter:
Options.property_parameter_names = true;
if (mp.GetParameter(mp.example) ) do_something...
Options.property_parameter_names = false;
To check if MassPart property mp.example is a parameter by using the GetParameter method:
if (mp.ViewParameters().GetParameter(mp.example) ) do_something...
Keywords 688
March 2016
Element
MassPart class
Keyword()
Description
Returns the keyword for this mass part (*ELEMENT_MASS_PART) Note that a carriage return is not added. See
also MassPart.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for mass part mp:
var key = mp.Keyword();
KeywordCards()
Description
Returns the keyword cards for the mass part. Note that a carriage return is not added. See also MassPart.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for mass part mp:
var cards = mp.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last element mass part in the model.
Arguments
Name Type
Description
Return type
MassPart object (or null if there are no element mass parts in the model).
Example
To get the last element mass part in model m:
var mp = MassPart.Last(m);
March 2016
Keywords 689
MassPart class
Element
Next()
Description
Returns the next element mass part in the model.
Arguments
No arguments
Return type
MassPart object (or null if there are no more element mass parts in the model).
Example
To get the element mass part in model m after element mass part mp:
var mp = mp.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the mass part can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
MassPart object (or null if not picked)
Example
To pick a mass part from model m giving the prompt Pick mass part from screen:
var mp = MassPart.Pick(Pick mass part from screen, m);
Previous()
Description
Returns the previous element mass part in the model.
Arguments
No arguments
Return type
MassPart object (or null if there are no more element mass parts in the model).
Keywords 690
March 2016
Element
MassPart class
Example
To get the element mass part in model m before element mass part mp:
var mp = mp.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only element mass parts from that model can be selected. If
Flag
the argument is a Flag then only element mass parts that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any element mass parts can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of element mass parts selected or null if menu cancelled
Example
To select element mass parts from model m, flagging those selected with flag f, giving the prompt Select element mass
parts:
MassPart.Select(f, Select element mass parts, m);
To select element mass parts, flagging those selected with flag f but limiting selection to element mass parts flagged
with flag l, giving the prompt Select element mass parts:
MassPart.Select(f, Select element mass parts, l);
SetFlag(flag[Flag])
Description
Sets a flag on the element mass part.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for element mass part mp:
mp.SetFlag(f);
March 2016
Keywords 691
MassPart class
Element
Sketch(redraw (optional)[boolean])
Description
Sketches the element mass part. The element mass part will be sketched until you either call MassPart.Unsketch(),
MassPart.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the element mass part is sketched. If omitted redraw is
true. If you want to sketch several element mass parts and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch element mass part mp:
mp.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing element mass parts should be counted. If false or omitted referenced but
undefined element mass parts will also be included in the total.
Return type
number of element mass parts
Example
To get the total number of element mass parts in model m:
var total = MassPart.Total(m);
Unblank()
Description
Unblanks the element mass part
Arguments
No arguments
Return type
No return value
Keywords 692
March 2016
Element
MassPart class
Example
To unblank element mass part mp:
mp.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the element mass parts in model m:
MassPart.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the element mass parts that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the element mass parts in model m flagged with f:
MassPart.UnblankFlagged(m, f);
Keywords 693
MassPart class
Element
Arguments
Name Type
Description
Model Model Model that the defined flag for all element mass parts will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the element mass parts in model m:
MassPart.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the element mass part.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the element mass part is unsketched. If omitted redraw
is true. If you want to unsketch several element mass parts and only redraw after the last one
then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch element mass part mp:
mp.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the element mass parts 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().
Return type
No return value
Keywords 694
March 2016
Element
MassPart class
Example
To unsketch all element mass parts in model m:
MassPart.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
MassPart object.
Example
To check if MassPart property mp.example is a parameter by using the MassPart.GetParameter() method:
if (mp.ViewParameters().GetParameter(mp.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for element mass part mp:
mp.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this element mass part.
Arguments
No arguments
March 2016
Keywords 695
MassPart class
Element
Return type
Xrefs object.
Example
To get the cross references for element mass part mp:
var xrefs = mp.Xrefs();
toString()
Description
Creates a string containing the mass part data in keyword format. Note that this contains the keyword header and the
keyword cards. See also MassPart.Keyword() and MassPart.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for mass part mp in keyword format
var str = mp.toString();
Keywords 696
March 2016
Element
Pretensioner class
Pretensioner class
The Pretensioner class gives you access to seatbelt pretensioner cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[pretensioner property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Pretensioner properties
Name
Type
Description
colour
exists
logical true if pretensioner exists, false if referred to but not defined. (read only)
include
label
integer Pretensioner number. Also see the sbprid property which is an alternative name for this.
lmtfrc
float
model
Limiting force
March 2016
Keywords 697
Pretensioner class
Element
ptlcid
sbprid
integer Pretensioner number. Also see the label property which is an alternative name for this.
sbprty
sbrid
sbsid1
sbsid2
sbsid3
sbsid4
time
float
transparency integer The transparency of the pretensioner (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Pretensioner class allows you to create, modify, edit and manipulate seatbelt pretensioner cards. See the
documentation below for more details.
Constructor
new Pretensioner(Model[Model], sbprid[integer], sbprty[integer],
sbrid[integer], ptlcid[integer], sbsid1[integer], sbsid2 (optional)[integer], sbsid3
(optional)[integer], sbsid4 (optional)[integer], time (optional)[float], lmtfrc
(optional)[float])
Description
Create a new Seatbelt Pretensioner object.
Arguments
Name
Type
Description
Model
sbprid
sbprty
sbrid
ptlcid
sbsid1
float
Return type
Pretensioner object
Keywords 698
March 2016
Element
Pretensioner class
Example
To create a new pyrotechnic seatbelt pretensioner in model m with label 100, Retractor 10, Loading curve 20 and
Sensor 30:
var p = new Pretensioner(m, 100, 1, 10, 20, 30);
Details of functions
Blank()
Description
Blanks the pretensioner
Arguments
No arguments
Return type
No return value
Example
To blank pretensioner p:
p.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the pretensioners in model m:
Pretensioner.BlankAll(m);
March 2016
Keywords 699
Pretensioner class
Element
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the pretensioners in model m flagged with f:
Pretensioner.BlankFlagged(m, f);
Blanked()
Description
Checks if the pretensioner is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if pretensioner p is blanked:
if (p.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse pretensioner p:
p.Browse();
Keywords 700
March 2016
Element
Pretensioner class
ClearFlag(flag[Flag])
Description
Clears a flag on the pretensioner.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for pretensioner p:
p.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the pretensioner.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy pretensioner p into pretensioner z:
var z = p.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Pretensioner object (or null if not made)
March 2016
Keywords 701
Pretensioner class
Element
Example
To start creating an pretensioner in model m:
var p = Pretensioner.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit pretensioner p:
p.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for pretensioner p:
p.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first pretensioner in the model.
Keywords 702
March 2016
Element
Pretensioner class
Arguments
Name Type
Description
Return type
Pretensioner object (or null if there are no pretensioners in the model).
Example
To get the first pretensioner in model m:
var p = Pretensioner.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Pretensioner label.
Example
To get the first free pretensioner label in model m:
var label = Pretensioner.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
March 2016
Keywords 703
Pretensioner class
Element
Example
To flag all of the pretensioners with flag f in model m:
Pretensioner.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the pretensioner is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if pretensioner p has flag f set on it:
if (p.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Keywords 704
March 2016
Element
Pretensioner class
Example
To call function test for all of the pretensioners in model m:
Pretensioner.ForEach(m, test);
function test(p)
{
// p is Pretensioner object
}
To call function test for all of the pretensioners in model m with optional object:
var data = { x:0, y:0 };
Pretensioner.ForEach(m, test, data);
function test(p, extra)
{
// p is Pretensioner object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Pretensioner objects for all of the pretensioners in a model in Primer
Arguments
Name Type
Description
Return type
Array of Pretensioner objects
Example
To make an array of Pretensioner objects for all of the pretensioners in model m
var p = Pretensioner.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Pretensioner objects
Example
To make an array of Pretensioner objects for all of the pretensioners in model m flagged with f
var p = Pretensioner.GetFlagged(m, f);
March 2016
Keywords 705
Pretensioner class
Element
Arguments
Name
Type
Description
Model
number integer number of the pretensioner you want the Pretensioner object for
Return type
Pretensioner object (or null if pretensioner does not exist).
Example
To get the Pretensioner object for pretensioner 100 in model m
var p = Pretensioner.GetFromID(m, 100);
GetParameter(prop[pretensioner property])
Description
Checks if a Pretensioner 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 Pretensioner.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Pretensioner property p.example is a parameter:
Options.property_parameter_names = true;
if (p.GetParameter(p.example) ) do_something...
Options.property_parameter_names = false;
To check if Pretensioner property p.example is a parameter by using the GetParameter method:
if (p.ViewParameters().GetParameter(p.example) ) do_something...
Keyword()
Description
Returns the keyword for this pretensioner (*ELEMENT_SEATBELT_PRETEROMETER) Note that a carriage
return is not added. See also Pretensioner.KeywordCards()
Keywords 706
March 2016
Element
Pretensioner class
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for pretensioner p:
var key = p.Keyword();
KeywordCards()
Description
Returns the keyword cards for the pretensioner. Note that a carriage return is not added. See also
Pretensioner.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for pretensioner a:
var cards = a.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last pretensioner in the model.
Arguments
Name Type
Description
Return type
Pretensioner object (or null if there are no pretensioners in the model).
Example
To get the last pretensioner in model m:
var p = Pretensioner.Last(m);
March 2016
Keywords 707
Pretensioner class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Pretensioner label.
Example
To get the last free pretensioner label in model m:
var label = Pretensioner.LastFreeLabel(m);
Next()
Description
Returns the next pretensioner in the model.
Arguments
No arguments
Return type
Pretensioner object (or null if there are no more pretensioners in the model).
Example
To get the pretensioner in model m after pretensioner p:
var p = p.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Pretensioner label.
Example
To get the next free pretensioner label in model m:
var label = Pretensioner.NextFreeLabel(m);
Keywords 708
March 2016
Element
Pretensioner class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the pretensioner can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Pretensioner object (or null if not picked)
Example
To pick a pretensioner from model m giving the prompt Pick pretensioner from screen:
var p = Pretensioner.Pick(Pick pretensioner from screen, m);
Previous()
Description
Returns the previous pretensioner in the model.
Arguments
No arguments
Return type
Pretensioner object (or null if there are no more pretensioners in the model).
Example
To get the pretensioner in model m before pretensioner p:
var p = p.Previous();
March 2016
Keywords 709
Pretensioner class
Element
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the pretensioners in model m, from 1000000:
Pretensioner.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged pretensioners will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the pretensioners in model m flagged with f, from 1000000:
Pretensioner.RenumberFlagged(m, f, 1000000);
Keywords 710
March 2016
Element
Pretensioner class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only pretensioners from that model can be selected. If the
Flag
argument is a Flag then only pretensioners that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any pretensioners can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of pretensioners selected or null if menu cancelled
Example
To select pretensioners from model m, flagging those selected with flag f, giving the prompt Select pretensioners:
Pretensioner.Select(f, Select pretensioners, m);
To select pretensioners, flagging those selected with flag f but limiting selection to pretensioners flagged with flag l,
giving the prompt Select pretensioners:
Pretensioner.Select(f, Select pretensioners, l);
SetFlag(flag[Flag])
Description
Sets a flag on the pretensioner.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for pretensioner p:
p.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the pretensioner. The pretensioner will be sketched until you either call Pretensioner.Unsketch(),
Pretensioner.UnsketchAll(), Model.UnsketchAll(), or delete the model
March 2016
Keywords 711
Pretensioner class
Element
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the pretensioner is sketched. If omitted redraw is true.
If you want to sketch several pretensioners and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch pretensioner p:
p.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing pretensioners should be counted. If false or omitted referenced but
undefined pretensioners will also be included in the total.
Return type
number of pretensioners
Example
To get the total number of pretensioners in model m:
var total = Pretensioner.Total(m);
Unblank()
Description
Unblanks the pretensioner
Arguments
No arguments
Return type
No return value
Example
To unblank pretensioner p:
p.Unblank();
Keywords 712
March 2016
Element
Pretensioner class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the pretensioners in model m:
Pretensioner.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the pretensioners in model m flagged with f:
Pretensioner.UnblankFlagged(m, f);
March 2016
Keywords 713
Pretensioner class
Element
Arguments
Name Type
Description
Model Model Model that the defined flag for all pretensioners will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the pretensioners in model m:
Pretensioner.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the pretensioner.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the pretensioner is unsketched. If omitted redraw is
true. If you want to unsketch several pretensioners and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch pretensioner p:
p.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the pretensioners 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().
Return type
No return value
Keywords 714
March 2016
Element
Pretensioner class
Example
To unsketch all pretensioners in model m:
Pretensioner.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Pretensioner object.
Example
To check if Pretensioner property p.example is a parameter by using the Pretensioner.GetParameter() method:
if (p.ViewParameters().GetParameter(p.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for pretensioner p:
p.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this pretensioner.
Arguments
No arguments
March 2016
Keywords 715
Pretensioner class
Element
Return type
Xrefs object.
Example
To get the cross references for pretensioner p:
var xrefs = p.Xrefs();
toString()
Description
Creates a string containing the pretensioner data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Pretensioner.Keyword() and Pretensioner.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for pretensioner p in keyword format
var str = p.toString();
Keywords 716
March 2016
Element
Retractor class
Retractor class
The Retractor class gives you access to seatbelt retractor cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[retractor property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Retractor properties
Name
Type
Description
colour
exists
logical true if retractor exists, false if referred to but not defined. (read only)
include
label
integer Retractor number. Also see the sbrid property which is an alternative name for this.
lfed
real
llcid
Fed length
March 2016
Keywords 717
Retractor class
Element
model
pull
real
sbid
sbrid
integer Retractor number. Also see the label property which is an alternative name for this.
sbrnid
Amount of pull out between time delay ending and retractor locking
shell_seatbelt logical true if retractor is used for shell (2D) seatbelt elements. (read only)
sid1
sid2
sid3
sid4
tdel
real
transparency integer The transparency of the retractor (0-100) 0% is opaque, 100% is transparent.
ulcid
Detailed Description
The Retractor class allows you to create, modify, edit and manipulate seatbelt retractor cards. See the documentation
below for more details.
Constructor
new Retractor(Model[Model], sbrid[integer], sbrnid[integer], sbid[integer],
llcid[integer], sid1[integer], sid2 (optional)[integer], sid3 (optional)[integer],
sid4 (optional)[integer], tdel (optional)[float], pull (optional)[float], ulcid
(optional)[integer], lfed (optional)[float])
Description
Create a new Seatbelt Retractor object.
Keywords 718
March 2016
Element
Retractor class
Arguments
Name
Type
Description
Model
sbrid
sbrnid
sbid
llcid
sid1
float
pull (optional)
float
Amount of pull out between time delay ending and retractor locking.
float
Fed length
Return type
Retractor object
Example
To create a new seatbelt retractor in model m with label 100, retractor Node 10, Seatbelt 20, Loading curve 30 and
Sensor 40:
var a = new Retractor(m, 100, 10, 20, 30, 40);
Details of functions
Blank()
Description
Blanks the retractor
Arguments
No arguments
Return type
No return value
Example
To blank retractor r:
r.Blank();
March 2016
Keywords 719
Retractor class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the retractors in model m:
Retractor.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the retractors in model m flagged with f:
Retractor.BlankFlagged(m, f);
Blanked()
Description
Checks if the retractor is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if retractor r is blanked:
if (r.Blanked() ) do_something...
Keywords 720
March 2016
Element
Retractor class
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse retractor r:
r.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the retractor.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for retractor r:
r.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the retractor.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
March 2016
Keywords 721
Retractor class
Element
Example
To copy retractor r into retractor z:
var z = r.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Retractor object (or null if not made)
Example
To start creating an retractor in model m:
var r = Retractor.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit retractor r:
r.Edit();
Keywords 722
March 2016
Element
Retractor class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for retractor r:
r.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first retractor in the model.
Arguments
Name Type
Description
Return type
Retractor object (or null if there are no retractors in the model).
Example
To get the first retractor in model m:
var r = Retractor.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Retractor label.
March 2016
Keywords 723
Retractor class
Element
Example
To get the first free retractor label in model m:
var label = Retractor.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the retractors with flag f in model m:
Retractor.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the retractor is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if retractor r has flag f set on it:
if (r.Flagged(f) ) do_something...
Keywords 724
March 2016
Element
Retractor class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the retractors in model m:
Retractor.ForEach(m, test);
function test(r)
{
// r is Retractor object
}
To call function test for all of the retractors in model m with optional object:
var data = { x:0, y:0 };
Retractor.ForEach(m, test, data);
function test(r, extra)
{
// r is Retractor object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Retractor objects for all of the retractors in a model in Primer
Arguments
Name Type
Description
Return type
Array of Retractor objects
Example
To make an array of Retractor objects for all of the retractors in model m
var r = Retractor.GetAll(m);
March 2016
Keywords 725
Retractor class
Element
Arguments
Name Type
Description
Flag
Return type
Array of Retractor objects
Example
To make an array of Retractor objects for all of the retractors in model m flagged with f
var r = Retractor.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the retractor you want the Retractor object for
Return type
Retractor object (or null if retractor does not exist).
Example
To get the Retractor object for retractor 100 in model m
var r = Retractor.GetFromID(m, 100);
GetParameter(prop[retractor property])
Description
Checks if a Retractor 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 Retractor.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Keywords 726
March 2016
Element
Retractor class
Example
To check if Retractor property r.example is a parameter:
Options.property_parameter_names = true;
if (r.GetParameter(r.example) ) do_something...
Options.property_parameter_names = false;
To check if Retractor property r.example is a parameter by using the GetParameter method:
if (r.ViewParameters().GetParameter(r.example) ) do_something...
Keyword()
Description
Returns the keyword for this retractor (*ELEMENT_SEATBELT_RETREROMETER) Note that a carriage return is
not added. See also Retractor.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for retractor r:
var key = r.Keyword();
KeywordCards()
Description
Returns the keyword cards for the retractor. Note that a carriage return is not added. See also Retractor.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for retractor r:
var cards = r.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last retractor in the model.
Arguments
Name Type
Description
March 2016
Keywords 727
Retractor class
Element
Return type
Retractor object (or null if there are no retractors in the model).
Example
To get the last retractor in model m:
var r = Retractor.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Retractor label.
Example
To get the last free retractor label in model m:
var label = Retractor.LastFreeLabel(m);
Next()
Description
Returns the next retractor in the model.
Arguments
No arguments
Return type
Retractor object (or null if there are no more retractors in the model).
Example
To get the retractor in model m after retractor r:
var r = r.Next();
Keywords 728
March 2016
Element
Retractor class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Retractor label.
Example
To get the next free retractor label in model m:
var label = Retractor.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the retractor can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Retractor object (or null if not picked)
Example
To pick a retractor from model m giving the prompt Pick retractor from screen:
var r = Retractor.Pick(Pick retractor from screen, m);
Previous()
Description
Returns the previous retractor in the model.
Arguments
No arguments
Return type
Retractor object (or null if there are no more retractors in the model).
March 2016
Keywords 729
Retractor class
Element
Example
To get the retractor in model m before retractor r:
var r = r.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the retractors in model m, from 1000000:
Retractor.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged retractors will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the retractors in model m flagged with f, from 1000000:
Retractor.RenumberFlagged(m, f, 1000000);
Keywords 730
March 2016
Element
Retractor class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only retractors from that model can be selected. If the
Flag
argument is a Flag then only retractors that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any retractors can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of retractors selected or null if menu cancelled
Example
To select retractors from model m, flagging those selected with flag f, giving the prompt Select retractors:
Retractor.Select(f, Select retractors, m);
To select retractors, flagging those selected with flag f but limiting selection to retractors flagged with flag l, giving the
prompt Select retractors:
Retractor.Select(f, Select retractors, l);
SetFlag(flag[Flag])
Description
Sets a flag on the retractor.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for retractor r:
r.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the retractor. The retractor will be sketched until you either call Retractor.Unsketch(),
Retractor.UnsketchAll(), Model.UnsketchAll(), or delete the model
March 2016
Keywords 731
Retractor class
Element
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the retractor is sketched. If omitted redraw is true. If
you want to sketch several retractors and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch retractor r:
r.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing retractors should be counted. If false or omitted referenced but undefined
retractors will also be included in the total.
Return type
number of retractors
Example
To get the total number of retractors in model m:
var total = Retractor.Total(m);
Unblank()
Description
Unblanks the retractor
Arguments
No arguments
Return type
No return value
Example
To unblank retractor r:
r.Unblank();
Keywords 732
March 2016
Element
Retractor class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the retractors in model m:
Retractor.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the retractors in model m flagged with f:
Retractor.UnblankFlagged(m, f);
March 2016
Keywords 733
Retractor class
Element
Arguments
Name Type
Description
Model Model Model that the defined flag for all retractors will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the retractors in model m:
Retractor.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the retractor.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the retractor is unsketched. If omitted redraw is true. If
you want to unsketch several retractors and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch retractor r:
r.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the retractors 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().
Return type
No return value
Keywords 734
March 2016
Element
Retractor class
Example
To unsketch all retractors in model m:
Retractor.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Retractor object.
Example
To check if Retractor property r.example is a parameter by using the Retractor.GetParameter() method:
if (r.ViewParameters().GetParameter(r.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for retractor r:
r.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this retractor.
Arguments
No arguments
March 2016
Keywords 735
Retractor class
Element
Return type
Xrefs object.
Example
To get the cross references for retractor r:
var xrefs = r.Xrefs();
toString()
Description
Creates a string containing the retractor data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Retractor.Keyword() and Retractor.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for retractor r in keyword format
var str = r.toString();
Keywords 736
March 2016
Element
Seatbelt1D class
Seatbelt1D class
The Seatbelt1D class gives you access to 2 noded (1D) element seatbelt cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[seatbelt property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Timestep()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Seatbelt1D properties
Name
Type
Description
colour
eid
integer Seatbelt1D number. Also see the label property which is an alternative name for this.
exists
logical true if seatbelt exists, false if referred to but not defined. (read only)
include
label
integer Seatbelt1D number. Also see the eid property which is an alternative name for this.
March 2016
Keywords 737
Seatbelt1D class
Element
model
n1
integer Node 1 ID
n2
integer Node 2 ID
pid
integer Part ID
sbrid
integer Retractor ID
slen
real
transparency integer The transparency of the seatbelt (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Seatbelt1D class allows you to create, modify, edit and manipulate 2 noded (1D) element seatbelt cards. See the
documentation below for more details.
Constructor
new Seatbelt1D(Model[Model], eid[integer], pid[integer], n1[integer],
n2[integer])
Description
Create a new Seatbelt1D object.
Arguments
Name Type
Description
pid
n1
integer Node 1 ID
n2
integer Node 2 ID
Return type
Seatbelt1D object
Example
To create a new 2 noded element seatbelt in model m with label 100, part 10 and nodes 20, 21:
var a = new Seatbelt1D(m, 100, 10, 20, 21);
Details of functions
Blank()
Description
Blanks the seatbelt
Arguments
No arguments
Return type
No return value
Keywords 738
March 2016
Element
Seatbelt1D class
Example
To blank seatbelt s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the seatbelts in model m:
Seatbelt1D.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the seatbelts in model m flagged with f:
Seatbelt1D.BlankFlagged(m, f);
Blanked()
Description
Checks if the seatbelt is blanked or not.
March 2016
Keywords 739
Seatbelt1D class
Element
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if seatbelt s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse seatbelt s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the seatbelt.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for seatbelt s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the seatbelt.
Keywords 740
March 2016
Element
Seatbelt1D class
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy seatbelt s into seatbelt z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Seatbelt1D object (or null if not made)
Example
To start creating a seatbelt in model m:
var s = Seatbelt1D.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit seatbelt s:
s.Edit();
March 2016
Keywords 741
Seatbelt1D class
Element
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for seatbelt s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first seatbelt in the model.
Arguments
Name Type
Description
Return type
Seatbelt1D object (or null if there are no seatbelts in the model).
Example
To get the first seatbelt in model m:
var s = Seatbelt1D.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Keywords 742
March 2016
Element
Seatbelt1D class
Return type
Seatbelt1D label.
Example
To get the first free seatbelt label in model m:
var label = Seatbelt1D.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the seatbelts with flag f in model m:
Seatbelt1D.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the seatbelt is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if seatbelt s has flag f set on it:
if (s.Flagged(f) ) do_something...
March 2016
Keywords 743
Seatbelt1D class
Element
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the seatbelts in model m:
Seatbelt1D.ForEach(m, test);
function test(s)
{
// s is Seatbelt1D object
}
To call function test for all of the seatbelts in model m with optional object:
var data = { x:0, y:0 };
Seatbelt1D.ForEach(m, test, data);
function test(s, extra)
{
// s is Seatbelt1D object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Seatbelt1D objects for all of the seatbelts in a model in Primer
Arguments
Name Type
Description
Return type
Array of Seatbelt1D objects
Example
To make an array of Seatbelt1D objects for all of the seatbelts in model m
var s = Seatbelt1D.GetAll(m);
Keywords 744
March 2016
Element
Seatbelt1D class
Arguments
Name Type
Description
Flag
Return type
Array of Seatbelt1D objects
Example
To make an array of Seatbelt1D objects for all of the seatbelts in model m flagged with f
var s = Seatbelt1D.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the seatbelt you want the Seatbelt1D object for
Return type
Seatbelt1D object (or null if seatbelt does not exist).
Example
To get the Seatbelt1D object for seatbelt 100 in model m
var s = Seatbelt1D.GetFromID(m, 100);
GetParameter(prop[seatbelt property])
Description
Checks if a Seatbelt1D 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 Seatbelt1D.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
March 2016
Keywords 745
Seatbelt1D class
Element
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Seatbelt1D property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Seatbelt1D property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this seatbelt (*ELEMENT_SEATBELT) Note that a carriage return is not added. See also
Seatbelt1D.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for seatbelt s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the seatbelt. Note that a carriage return is not added. See also Seatbelt1D.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for seatbelt s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last seatbelt in the model.
Keywords 746
March 2016
Element
Seatbelt1D class
Arguments
Name Type
Description
Return type
Seatbelt1D object (or null if there are no seatbelts in the model).
Example
To get the last seatbelt in model m:
var s = Seatbelt1D.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Seatbelt1D label.
Example
To get the last free seatbelt label in model m:
var label = Seatbelt1D.LastFreeLabel(m);
Next()
Description
Returns the next seatbelt in the model.
Arguments
No arguments
Return type
Seatbelt1D object (or null if there are no more seatbelts in the model).
Example
To get the seatbelt in model m after seatbelt s:
var s = s.Next();
March 2016
Keywords 747
Seatbelt1D class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Seatbelt1D label.
Example
To get the next free seatbelt label in model m:
var label = Seatbelt1D.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the seatbelt can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Seatbelt1D object (or null if not picked)
Example
To pick a seatbelt from model m giving the prompt Pick seatbelt from screen:
var s = Seatbelt1D.Pick(Pick seatbelt from screen, m);
Previous()
Description
Returns the previous seatbelt in the model.
Keywords 748
March 2016
Element
Seatbelt1D class
Arguments
No arguments
Return type
Seatbelt1D object (or null if there are no more seatbelts in the model).
Example
To get the seatbelt in model m before seatbelt s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the seatbelts in model m, from 1000000:
Seatbelt1D.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged seatbelts will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the seatbelts in model m flagged with f, from 1000000:
Seatbelt1D.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 749
Seatbelt1D class
Element
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only seatbelts from that model can be selected. If the
Flag
argument is a Flag then only seatbelts that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any seatbelts can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of seatbelts selected or null if menu cancelled
Example
To select seatbelts from model m, flagging those selected with flag f, giving the prompt Select seatbelts:
Seatbelt1D.Select(f, Select seatbelts, m);
To select seatbelts, flagging those selected with flag f but limiting selection to seatbelts flagged with flag l, giving the
prompt Select seatbelts:
Seatbelt1D.Select(f, Select seatbelts, l);
SetFlag(flag[Flag])
Description
Sets a flag on the seatbelt.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for seatbelt s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the seatbelt. The seatbelt will be sketched until you either call Seatbelt1D.Unsketch(),
Seatbelt1D.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 750
March 2016
Element
Seatbelt1D class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the seatbelt is sketched. If omitted redraw is true. If
you want to sketch several seatbelts and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To sketch seatbelt s:
s.Sketch();
Timestep()
Description
Calculates the timestep for the seatbelt
Arguments
No arguments
Return type
float
Example
To calculate the timestep for seatbelt s:
var timestep = s.Timestep();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing seatbelts should be counted. If false or omitted referenced but undefined
seatbelts will also be included in the total.
Return type
number of seatbelts
Example
To get the total number of seatbelts in model m:
var total = Seatbelt1D.Total(m);
March 2016
Keywords 751
Seatbelt1D class
Element
Unblank()
Description
Unblanks the seatbelt
Arguments
No arguments
Return type
No return value
Example
To unblank seatbelt s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the seatbelts in model m:
Seatbelt1D.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Keywords 752
March 2016
Element
Seatbelt1D class
Example
To unblank all of the seatbelts in model m flagged with f:
Seatbelt1D.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all seatbelts will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the seatbelts in model m:
Seatbelt1D.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the seatbelt.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the seatbelt is unsketched. If omitted redraw is true. If
you want to unsketch several seatbelts and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch seatbelt s:
s.Unsketch();
March 2016
Keywords 753
Seatbelt1D class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the seatbelts 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().
Return type
No return value
Example
To unsketch all seatbelts in model m:
Seatbelt1D.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Seatbelt1D object.
Example
To check if Seatbelt1D property s.example is a parameter by using the Seatbelt1D.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for seatbelt s:
s.Warning("My custom warning");
Keywords 754
March 2016
Element
Seatbelt1D class
Xrefs()
Description
Returns the cross references for this seatbelt.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for seatbelt s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the seatbelt data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Seatbelt1D.Keyword() and Seatbelt1D.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for seatbelt s in keyword format
var str = s.toString();
March 2016
Keywords 755
Seatbelt2D class
Element
Seatbelt2D class
The Seatbelt2D class gives you access to 4 noded (2D) element seatbelt cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[seatbelt property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Seatbelt2D properties
Name
Type
colour
eid
integer Seatbelt2D number. Also see the label property which is an alternative name for this.
exists
logical true if seatbelt exists, false if referred to but not defined. (read only)
include
label
integer Seatbelt2D number. Also see the eid property which is an alternative name for this.
model
n1
integer Node 1 ID
Keywords 756
Description
March 2016
Element
n2
integer Node 2 ID
n3
integer Node 3 ID
n4
integer Node 4 ID
pid
integer Part ID
sbrid
integer Retractor ID
slen
real
Seatbelt2D class
transparency integer The transparency of the seatbelt (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Seatbelt2D class allows you to create, modify, edit and manipulate 4 noded element seatbelt cards. See the
documentation below for more details.
Constructor
new Seatbelt2D(Model[Model], eid[integer], pid[integer], n1[integer],
n2[integer], n3[integer], n4[integer])
Description
Create a new Seatbelt2D object.
Arguments
Name Type
Description
pid
n1
integer Node 1 ID
n2
integer Node 2 ID
n3
integer Node 3 ID
n4
integer Node 4 ID
Return type
Seatbelt2D object
Example
To create a new 4 noded element seatbelt in model m with label 100, part 10 and nodes 20, 21, 22, 23:
var a = new Seatbelt2D(m, 100, 10, 20, 21, 22, 23);
Details of functions
Blank()
Description
Blanks the seatbelt
Arguments
No arguments
March 2016
Keywords 757
Seatbelt2D class
Element
Return type
No return value
Example
To blank seatbelt s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the seatbelts in model m:
Seatbelt2D.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the seatbelts in model m flagged with f:
Seatbelt2D.BlankFlagged(m, f);
Keywords 758
March 2016
Element
Seatbelt2D class
Blanked()
Description
Checks if the seatbelt is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if seatbelt s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse seatbelt s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the seatbelt.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for seatbelt s:
s.ClearFlag(f);
March 2016
Keywords 759
Seatbelt2D class
Element
Copy(range (optional)[boolean])
Description
Copies the seatbelt.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy seatbelt s into seatbelt z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Seatbelt2D object (or null if not made)
Example
To start creating a seatbelt in model m:
var s = Seatbelt2D.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Keywords 760
March 2016
Element
Seatbelt2D class
Example
To Edit seatbelt s:
s.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for seatbelt s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first seatbelt in the model.
Arguments
Name Type
Description
Return type
Seatbelt2D object (or null if there are no seatbelts in the model).
Example
To get the first seatbelt in model m:
var s = Seatbelt2D.First(m);
March 2016
Keywords 761
Seatbelt2D class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Seatbelt2D label.
Example
To get the first free seatbelt label in model m:
var label = Seatbelt2D.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the seatbelts with flag f in model m:
Seatbelt2D.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the seatbelt is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if seatbelt s has flag f set on it:
if (s.Flagged(f) ) do_something...
Keywords 762
March 2016
Element
Seatbelt2D class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the seatbelts in model m:
Seatbelt2D.ForEach(m, test);
function test(s)
{
// s is Seatbelt2D object
}
To call function test for all of the seatbelts in model m with optional object:
var data = { x:0, y:0 };
Seatbelt2D.ForEach(m, test, data);
function test(s, extra)
{
// s is Seatbelt2D object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Seatbelt2D objects for all of the seatbelts in a model in Primer
Arguments
Name Type
Description
Return type
Array of Seatbelt2D objects
Example
To make an array of Seatbelt2D objects for all of the seatbelts in model m
var s = Seatbelt2D.GetAll(m);
March 2016
Keywords 763
Seatbelt2D class
Element
Arguments
Name Type
Description
Flag
Return type
Array of Seatbelt2D objects
Example
To make an array of Seatbelt2D objects for all of the seatbelts in model m flagged with f
var s = Seatbelt2D.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the seatbelt you want the Seatbelt2D object for
Return type
Seatbelt2D object (or null if seatbelt does not exist).
Example
To get the Seatbelt2D object for seatbelt 100 in model m
var s = Seatbelt2D.GetFromID(m, 100);
GetParameter(prop[seatbelt property])
Description
Checks if a Seatbelt2D 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 Seatbelt2D.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Keywords 764
March 2016
Element
Seatbelt2D class
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Seatbelt2D property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Seatbelt2D property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this seatbelt (*ELEMENT_SEATBELT) Note that a carriage return is not added. See also
Seatbelt2D.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for seatbelt s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the seatbelt. Note that a carriage return is not added. See also Seatbelt2D.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for seatbelt s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last seatbelt in the model.
March 2016
Keywords 765
Seatbelt2D class
Element
Arguments
Name Type
Description
Return type
Seatbelt2D object (or null if there are no seatbelts in the model).
Example
To get the last seatbelt in model m:
var s = Seatbelt2D.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Seatbelt2D label.
Example
To get the last free seatbelt label in model m:
var label = Seatbelt2D.LastFreeLabel(m);
Next()
Description
Returns the next seatbelt in the model.
Arguments
No arguments
Return type
Seatbelt2D object (or null if there are no more seatbelts in the model).
Example
To get the seatbelt in model m after seatbelt s:
var s = s.Next();
Keywords 766
March 2016
Element
Seatbelt2D class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Seatbelt2D label.
Example
To get the next free seatbelt label in model m:
var label = Seatbelt2D.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the seatbelt can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Seatbelt2D object (or null if not picked)
Example
To pick a seatbelt from model m giving the prompt Pick seatbelt from screen:
var s = Seatbelt2D.Pick(Pick seatbelt from screen, m);
Previous()
Description
Returns the previous seatbelt in the model.
March 2016
Keywords 767
Seatbelt2D class
Element
Arguments
No arguments
Return type
Seatbelt2D object (or null if there are no more seatbelts in the model).
Example
To get the seatbelt in model m before seatbelt s:
var s = s.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only seatbelts from that model can be selected. If the
Flag
argument is a Flag then only seatbelts that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any seatbelts can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of seatbelts selected or null if menu cancelled
Example
To select seatbelts from model m, flagging those selected with flag f, giving the prompt Select seatbelts:
Seatbelt2D.Select(f, Select seatbelts, m);
To select seatbelts, flagging those selected with flag f but limiting selection to seatbelts flagged with flag l, giving the
prompt Select seatbelts:
Seatbelt2D.Select(f, Select seatbelts, l);
SetFlag(flag[Flag])
Description
Sets a flag on the seatbelt.
Arguments
Name Type Description
flag
Return type
No return value
Keywords 768
March 2016
Element
Seatbelt2D class
Example
To set flag f for seatbelt s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the seatbelt. The seatbelt will be sketched until you either call Seatbelt2D.Unsketch(),
Seatbelt2D.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the seatbelt is sketched. If omitted redraw is true. If
you want to sketch several seatbelts and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To sketch seatbelt s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing seatbelts should be counted. If false or omitted referenced but undefined
seatbelts will also be included in the total.
Return type
number of seatbelts
Example
To get the total number of seatbelts in model m:
var total = Seatbelt2D.Total(m);
Unblank()
Description
Unblanks the seatbelt
Arguments
No arguments
March 2016
Keywords 769
Seatbelt2D class
Element
Return type
No return value
Example
To unblank seatbelt s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the seatbelts in model m:
Seatbelt2D.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the seatbelts in model m flagged with f:
Seatbelt2D.UnblankFlagged(m, f);
Keywords 770
March 2016
Element
Seatbelt2D class
Arguments
Name Type
Description
Model Model Model that the defined flag for all seatbelts will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the seatbelts in model m:
Seatbelt2D.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the seatbelt.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the seatbelt is unsketched. If omitted redraw is true. If
you want to unsketch several seatbelts and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch seatbelt s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the seatbelts 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().
March 2016
Keywords 771
Seatbelt2D class
Element
Return type
No return value
Example
To unsketch all seatbelts in model m:
Seatbelt2D.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Seatbelt2D object.
Example
To check if Seatbelt2D property s.example is a parameter by using the Seatbelt2D.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for seatbelt s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this seatbelt.
Keywords 772
March 2016
Element
Seatbelt2D class
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for seatbelt s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the seatbelt data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Seatbelt2D.Keyword() and Seatbelt2D.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for seatbelt s in keyword format
var str = s.toString();
March 2016
Keywords 773
Sensor class
Element
Sensor class
The Sensor class gives you access to seatbelt sensor cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[sensor property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Sensor properties
Name
Type
Description
acc
real
Activating acceleration.
atime
real
colour
dmn
real
Minimum distance
dmx
real
Maximum distance
dof
Keywords 774
March 2016
Element
exists
logical true if sensor exists, false if referred to but not defined. (read only)
include
label
integer Sensor number. Also see the sbacid property which is an alternative name for this.
model
nid
nid1
nid2
pulrat
real
pultim
real
sbrid
sbsfl
sbsid
integer Sensor number. Also see the label property which is an alternative name for this.
sbstyp
time
real
Sensor class
transparency integer The transparency of the sensor (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Sensor class allows you to create, modify, edit and manipulate seatbelt sensor cards. See the documentation below
for more details.
Constructor
new Sensor(Model[Model], sbsid[integer], sbstyp[integer], sbsfl
(optional)[real])
Description
Create a new Seatbelt Sensor object.
Arguments
Name
Type
Model
sbsid
sbstyp
Description
Sensor flag
Return type
Sensor object
Example
To create a new seatbelt sensor in model m with label 100 and type 1:
var s = new Sensor(m, 100, 1);
March 2016
Keywords 775
Sensor class
Element
Details of functions
Blank()
Description
Blanks the sensor
Arguments
No arguments
Return type
No return value
Example
To blank sensor s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sensors in model m:
Sensor.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Keywords 776
March 2016
Element
Sensor class
Return type
No return value
Example
To blank all of the sensors in model m flagged with f:
Sensor.BlankFlagged(m, f);
Blanked()
Description
Checks if the sensor is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if sensor s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse sensor s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the sensor.
Arguments
Name Type Description
flag
March 2016
Keywords 777
Sensor class
Element
Return type
No return value
Example
To clear flag f for sensor s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the sensor.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy sensor s into sensor z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Sensor object (or null if not made)
Example
To start creating an sensor in model m:
var s = Sensor.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Keywords 778
March 2016
Element
Sensor class
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit sensor s:
s.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for sensor s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first sensor in the model.
Arguments
Name Type
Description
Return type
Sensor object (or null if there are no sensors in the model).
Example
To get the first sensor in model m:
var s = Sensor.First(m);
March 2016
Keywords 779
Sensor class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Sensor label.
Example
To get the first free sensor label in model m:
var label = Sensor.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the sensors with flag f in model m:
Sensor.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the sensor is flagged or not.
Arguments
Name Type Description
flag
Keywords 780
March 2016
Element
Sensor class
Return type
true if flagged, false if not.
Example
To check if sensor s has flag f set on it:
if (s.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the sensors in model m:
Sensor.ForEach(m, test);
function test(s)
{
// s is Sensor object
}
To call function test for all of the sensors in model m with optional object:
var data = { x:0, y:0 };
Sensor.ForEach(m, test, data);
function test(s, extra)
{
// s is Sensor object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Sensor objects for all of the sensors in a model in Primer
March 2016
Keywords 781
Sensor class
Element
Arguments
Name Type
Description
Return type
Array of Sensor objects
Example
To make an array of Sensor objects for all of the sensors in model m
var s = Sensor.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Sensor objects
Example
To make an array of Sensor objects for all of the sensors in model m flagged with f
var s = Sensor.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the sensor you want the Sensor object for
Return type
Sensor object (or null if sensor does not exist).
Example
To get the Sensor object for sensor 100 in model m
var s = Sensor.GetFromID(m, 100);
Keywords 782
March 2016
Element
Sensor class
GetParameter(prop[sensor property])
Description
Checks if a Sensor 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 Sensor.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Sensor property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Sensor property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this sensor (*ELEMENT_SEATBELT_SENSEROMETER) Note that a carriage return is
not added. See also Sensor.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for sensor s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the sensor. Note that a carriage return is not added. See also Sensor.Keyword()
Arguments
No arguments
March 2016
Keywords 783
Sensor class
Element
Return type
string containing the cards.
Example
To get the cards for sensor s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last sensor in the model.
Arguments
Name Type
Description
Return type
Sensor object (or null if there are no sensors in the model).
Example
To get the last sensor in model m:
var s = Sensor.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Sensor label.
Example
To get the last free sensor label in model m:
var label = Sensor.LastFreeLabel(m);
Next()
Description
Returns the next sensor in the model.
Keywords 784
March 2016
Element
Sensor class
Arguments
No arguments
Return type
Sensor object (or null if there are no more sensors in the model).
Example
To get the sensor in model m after sensor s:
var s = s.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Sensor label.
Example
To get the next free sensor label in model m:
var label = Sensor.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the sensor can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
March 2016
Keywords 785
Sensor class
Element
Return type
Sensor object (or null if not picked)
Example
To pick a sensor from model m giving the prompt Pick sensor from screen:
var s = Sensor.Pick(Pick sensor from screen, m);
Previous()
Description
Returns the previous sensor in the model.
Arguments
No arguments
Return type
Sensor object (or null if there are no more sensors in the model).
Example
To get the sensor in model m before sensor s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the sensors in model m, from 1000000:
Sensor.RenumberAll(m, 1000000);
Keywords 786
March 2016
Element
Sensor class
Arguments
Name Type
Description
Model Model Model that all the flagged sensors will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the sensors in model m flagged with f, from 1000000:
Sensor.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only sensors from that model can be selected. If the argument
Flag
is a Flag then only sensors that are flagged with limit can be selected (limit should be
different to flag). If omitted, or null, any sensors can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of sensors selected or null if menu cancelled
Example
To select sensors from model m, flagging those selected with flag f, giving the prompt Select sensors:
Sensor.Select(f, Select sensors, m);
To select sensors, flagging those selected with flag f but limiting selection to sensors flagged with flag l, giving the
prompt Select sensors:
Sensor.Select(f, Select sensors, l);
SetFlag(flag[Flag])
Description
Sets a flag on the sensor.
March 2016
Keywords 787
Sensor class
Element
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for sensor s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the sensor. The sensor will be sketched until you either call Sensor.Unsketch(), Sensor.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the sensor is sketched. If omitted redraw is true. If you
want to sketch several sensors and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch sensor s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing sensors should be counted. If false or omitted referenced but undefined
sensors will also be included in the total.
Return type
number of sensors
Example
To get the total number of sensors in model m:
var total = Sensor.Total(m);
Keywords 788
March 2016
Element
Sensor class
Unblank()
Description
Unblanks the sensor
Arguments
No arguments
Return type
No return value
Example
To unblank sensor s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sensors in model m:
Sensor.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
Keywords 789
Sensor class
Element
Example
To unblank all of the sensors in model m flagged with f:
Sensor.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all sensors will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the sensors in model m:
Sensor.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the sensor.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the sensor is unsketched. If omitted redraw is true. If
you want to unsketch several sensors and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch sensor s:
s.Unsketch();
Keywords 790
March 2016
Element
Sensor class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the sensors 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().
Return type
No return value
Example
To unsketch all sensors in model m:
Sensor.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Sensor object.
Example
To check if Sensor property s.example is a parameter by using the Sensor.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for sensor s:
s.Warning("My custom warning");
March 2016
Keywords 791
Sensor class
Element
Xrefs()
Description
Returns the cross references for this sensor.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for sensor s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the sensor data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Sensor.Keyword() and Sensor.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for sensor s in keyword format
var str = s.toString();
Keywords 792
March 2016
Element
Shell class
Shell class
The Shell class gives you access to shell cards in PRIMER. More...
Class functions
Member functions
Angles()
AspectRatio()
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
CoordsToIsoparametric(x[float], y[float], z[float])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
ElemCut(Database cross section label[integer])
Error(message[string], details (optional)[string])
FillAttachedHole(pid[integer], size[float])
Flagged(flag[Flag])
GetAttachedShells(tolerance (optional)[float], recursive (optional)[boolean])
GetCompositeData(ipt[integer])
GetNodeIDs()
GetNodes()
GetParameter(prop[shell property])
GetShellReferenceGeometry()
IsoparametricToCoords(s[float], t[float])
Jacobian()
Keyword()
KeywordCards()
Length()
Next()
NormalVector()
Previous()
RemoveCompositeData(ipt[integer])
ReverseNormal(redraw (optional)[boolean])
SetCompositeData(ipt[integer], mid[integer], thick[real], beta[real], plyid (optional)[integer])
March 2016
Keywords 793
Shell class
Element
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Skew()
TiedNodeCheck(Contact label[integer], Flag[Flag], Option1[integer], Option2[integer])
Timestep()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Warpage()
WeightingFactors(s[float], t[float])
Xrefs()
toString()
Shell constants
Name
Description
Shell properties
Name
Type
Description
beta
real
Offset angle. If non zero then the _BETA option is assumed. Note: If this option is set then
mcid should be 0
colour
Colour
composite
logical
composite_
long
logical
dof
logical
edges
eid
integer
Shell number. Also see the label property which is an alternative name for this.
exists
logical
true if shell exists, false if referred to but not defined. (read only)
include
integer
label
integer
Shell number. Also see the eid property which is an alternative name for this.
mcid
integer
Material coordinate system ID. If non zero then the _MCID option is assumed. Note: If this
option is set then beta should be 0.
model
integer
n1
integer
Node number 1
n2
integer
Node number 2
n3
integer
Node number 3
n4
integer
Node number 4
n5
integer
Node number 5
n6
integer
Node number 6
n7
integer
Node number 7
Keywords 794
March 2016
Element
n8
integer
Node number 8
nip
logical
nodes
integer
ns1
integer
ns2
integer
ns3
integer
ns4
integer
offset
real
pid
integer
Part number
shl4_to_shl8
logical
thic1
real
Thickness at node 1
thic2
real
Thickness at node 2
thic3
real
Thickness at node 3
thic4
real
Thickness at node 4
thickness
logical
transparency
integer
Shell class
Detailed Description
The Shell class allows you to create, modify, edit and manipulate shell cards. See the documentation below for more
details.
Constructor
new Shell(Model[Model], eid[integer], pid[integer], n1[integer], n2[integer],
n3[integer], n4 (optional)[integer], n5 (optional)[integer], n6 (optional)[integer],
n7 (optional)[integer], n8 (optional)[integer])
Description
Create a new Shell object. Use either 3, 4, 6 or 8 nodes when creating a new shell. If you are creating a 3 noded shell
either only give 3 nodes or give 4 nodes but make nodes 3 and 4 the same number. Similarly, 6 noded shells can be
created with 6 node arguments or with 8 nodes but nodes 3 and 4 the same number and nodes 7 and 8 the same number.
March 2016
Keywords 795
Shell class
Element
Arguments
Name
Type
Description
Model
eid
pid
n1
n2
n3
Return type
Shell object
Example
To create a new shell in model m with label 100, part 10 and nodes 1, 2, 3, 4:
var s = new Shell(m, 100, 10, 1, 2, 3, 4);
Details of functions
Angles()
Description
Calculates the minimum and maximum internal angles (in degrees) for the shell
Arguments
No arguments
Return type
Array containing min and max angles
Example
To calculate the maximum and minimum internal angles for shell s:
var angles = s.Angles();
var min = angles[0];
var max = angles[1];
AspectRatio()
Description
Calculates the aspect ratio for the shell
Keywords 796
March 2016
Element
Shell class
Arguments
No arguments
Return type
float
Example
To calculate the aspect ratio for shell s:
var ratio = s.AspectRatio();
Blank()
Description
Blanks the shell
Arguments
No arguments
Return type
No return value
Example
To blank shell s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the shells in model m:
Shell.BlankAll(m);
March 2016
Keywords 797
Shell class
Element
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the shells in model m flagged with f:
Shell.BlankFlagged(m, f);
Blanked()
Description
Checks if the shell is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if shell s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse shell s:
s.Browse();
Keywords 798
March 2016
Element
Shell class
ClearFlag(flag[Flag])
Description
Clears a flag on the shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for shell s:
s.ClearFlag(f);
Arguments
Name Type Description
x
Return type
Array containing s and t isoparametric coordinates and the distance the point is from the shell (positive in direction of
shell normal). If it is not possible to calculate the isoparametric coordinates null is returned.
Example
To calculate the isoparametric coordinates of point (10, 20, 30) on shell s:
var isocoords = s.CoordsToIsoparametric(10, 20, 30);
Copy(range (optional)[boolean])
Description
Copies the shell.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
March 2016
Keywords 799
Shell class
Element
Return type
Return class object
Example
To copy shell s into shell z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Shell object (or null if not made)
Example
To start creating a shell in model m:
var s = Shell.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit shell s:
s.Edit();
Keywords 800
March 2016
Element
Shell class
Arguments
Name
Type
Description
Database cross section label integer The label of the database cross section.
Return type
An array containing the x1,y1,z1,x2,y2,z2 coordinates of the cut line, or NULL if it does not cut. Note this function
does not check that the shell is in the cross section definition (part set)
Example
To get the cut line coordinates between database cross section 200 and shell s:
var data = s.ElemCut(200)
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for shell s:
s.Error("My custom error");
FillAttachedHole(pid[integer], size[float])
Description
Fills in (meshes) a hole attached to the shell.
Arguments
Name Type
Description
pid
integer The Part number that the new shells will be created in.
size
float
Return type
No return value.
Example
To fill in a hole attached to shell s, putting new shells with size 5.0 into part 100:
s.FillAttachedHole(100, 5.0);
March 2016
Keywords 801
Shell class
Element
FindShellEnd() [static]
Description
Tidy memory allocation incurred by function which finds shells within a box. See also Shell.FindShellInit() See also
Shell.FindShellInBox()
Arguments
No arguments
Return type
No return value
Example
Shell.FindShellEnd();
Arguments
Name
Type
Description
Model
xmin
real
xmax
real
ymin
real
ymax
real
zmin
real
zmax
real
Return type
Array of Shell objects
Keywords 802
March 2016
Element
Shell class
Example
To get an array of Shell objects for flagged shells in model m within defined box.
Shell.FindShellInit(m);
{
//loop in which boxes are formed and tested
//find shells both in box and flagged with sflag
var s = Shell.FindShellInBox(m, xmin, xmax, ymin, ymax, zmin, zmax, sflag);
if(s.length) ...
}
Shell.FindShellEnd();
Arguments
Name
Type
Model
Description
Optional flag that has been set on the shells, if unsupplied all shells considered
Return type
No return value
Example
To initialize find setup for shells flagged with f in model m:
Shell.FindShellInit(m, f);
First(Model[Model]) [static]
Description
Returns the first shell in the model.
Arguments
Name Type
Description
Return type
Shell object (or null if there are no shells in the model).
March 2016
Keywords 803
Shell class
Element
Example
To get the first shell in model m:
var s = Shell.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Shell label.
Example
To get the first free shell label in model m:
var label = Shell.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the shells with flag f in model m:
Shell.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the shell is flagged or not.
Keywords 804
March 2016
Element
Shell class
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if shell s has flag f set on it:
if (s.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the shells in model m:
Shell.ForEach(m, test);
function test(s)
{
// s is Shell object
}
To call function test for all of the shells in model m with optional object:
var data = { x:0, y:0 };
Shell.ForEach(m, test, data);
function test(s, extra)
{
// s is Shell object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Shell objects for all of the shells in a model in Primer
March 2016
Keywords 805
Shell class
Element
Arguments
Name Type
Description
Return type
Array of Shell objects
Example
To make an array of Shell objects for all of the shells in model m
var s = Shell.GetAll(m);
Arguments
Name
Type
Description
tolerance
(optional)
float
This tolerance can be used to limit the selection to shells whose normal vector is within this
tolerance (in degrees) of the original shell. If omitted the tolerance is 180 degrees.
recursive
(optional)
boolean If recursive is false then only the shells actually attached to the shell will be returned (this
could also be done by using the Xrefs class but this method is provided for convenience. If
recursive is true then PRIMER will keep finding attached shells until no more can be found. If
omitted recursive will be false.
Return type
Array of Shell objects (or null if there are no attached shells).
Example
To find the shells attached to shell s with a 10 degree tolerance, growing the selection until no more shells can be found:
var shell_array = s.GetAttachedShells(true, 10);
GetCompositeData(ipt[integer])
Description
Returns the composite data for an integration point in *ELEMENT_SHELL_COMPOSITE.
Arguments
Name Type
ipt
Description
integer The integration point you want the data for. Note that integration points start at 0, not 1.
Return type
An array containing the material ID, thickness and beta angle. If the _COMPOSITE_LONG option is set, then the array
returned will also contain the ply ID.
Keywords 806
March 2016
Element
Shell class
Example
To get the composite data for the 3rd integration point for shell s:
if (s.composite && s.nip >= 3)
{
var ipt_data = s.GetCompositeData(2);
}
Arguments
Name Type
Description
Flag
Return type
Array of Shell objects
Example
To make an array of Shell objects for all of the shells in model m flagged with f
var s = Shell.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the shell you want the Shell object for
Return type
Shell object (or null if shell does not exist).
Example
To get the Shell object for shell 100 in model m
var s = Shell.GetFromID(m, 100);
GetNodeIDs()
Description
Returns the labels of the nodes on the shell as an array. See also Shell.GetNodes()
March 2016
Keywords 807
Shell class
Element
Arguments
No arguments
Return type
Array of node labels (integers)
Example
To return the node labels of shell s as an array
var nodes = s.GetNodeIDs();
GetNodes()
Description
Returns the nodes on the shell as an array of Node objects. See also Shell.GetNodeIDs()
Arguments
No arguments
Return type
Array of Node objects
Example
To return the nodes of shell s as an array
var nodes = s.GetNodes();
GetParameter(prop[shell property])
Description
Checks if a Shell 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 Shell.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Shell property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Shell property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keywords 808
March 2016
Element
Shell class
GetShellReferenceGeometry()
Description
Returns the airbag shell reference geometry of the shell
Arguments
No arguments
Return type
The shell reference geometry ID (or 0 if it hasnt got any)
Example
To get the shell reference geometry of the shell s:
var a = s.GetShellReferenceGeometry();
IsoparametricToCoords(s[float], t[float])
Description
Calculates the coordinates for a point on the shell from the isoparametric coords.
Arguments
Name Type Description
s
Return type
Array containing x, y and z or null if not possible to calculate.
Example
To calculate the coordinates of isoparametric point (0.5, -0.5) on shell s:
var coords = s.IsoparametricToCoords(0.5, -0.5);
Jacobian()
Description
Calculates the jacobian for the shell
Arguments
No arguments
Return type
float
Example
To calculate the jacobian for shell s:
var jacobian = s.Jacobian();
March 2016
Keywords 809
Shell class
Element
Keyword()
Description
Returns the keyword for this shell (*SHELL, *SHELL_SCALAR or *SHELL_SCALAR_VALUE). Note that a
carriage return is not added. See also Shell.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for shell s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the shell. Note that a carriage return is not added. See also Shell.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for shell s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last shell in the model.
Arguments
Name Type
Description
Return type
Shell object (or null if there are no shells in the model).
Example
To get the last shell in model m:
var s = Shell.Last(m);
Keywords 810
March 2016
Element
Shell class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Shell label.
Example
To get the last free shell label in model m:
var label = Shell.LastFreeLabel(m);
Length()
Description
Calculates the minimum length for the shell
Arguments
No arguments
Return type
float
Example
To calculate the minimum length for shell s:
var length = s.Length();
Arguments
Name
Type
Description
Model
Flag
Flag
Shell label
(optional)
integer The label of the sheed shell. If omitted, or null, the first flagged shell is used as the
sheed shell.
flag bit
March 2016
Keywords 811
Shell class
Element
Return type
No return value.
Example
To make all flagged shell normals consistent:
Shell.MakeConsistentNormalsFlagged(m, flag, 1001);
Next()
Description
Returns the next shell in the model.
Arguments
No arguments
Return type
Shell object (or null if there are no more shells in the model).
Example
To get the shell in model m after shell s:
var s = s.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Shell label.
Example
To get the next free shell label in model m:
var label = Shell.NextFreeLabel(m);
NormalVector()
Description
Calculates the unit normal vector for the shell.
Arguments
No arguments
Keywords 812
March 2016
Element
Shell class
Return type
Array containing x, y and z components of unit normal vector.
Example
To calculate the normal vector of shell s:
var nvector = s.NormalVector();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the shell can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Shell object (or null if not picked)
Example
To pick a shell from model m giving the prompt Pick shell from screen:
var s = Shell.Pick(Pick shell from screen, m);
March 2016
Keywords 813
Shell class
Element
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the shell can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Array containing Shell object and isoparametric coordinates (or null if not picked or the point is not on a shell)
Example
To pick a point on a shell from model m giving the prompt Pick a point on a shell on the screen:
var a = Shell.PickIsoparametric(Pick a point on a shell on the screen, m);
if (a != null)
{
Message("You picked point "+a[1]+","+a[2]+" on shell "+a[0].label);
}
Previous()
Description
Returns the previous shell in the model.
Arguments
No arguments
Return type
Shell object (or null if there are no more shells in the model).
Example
To get the shell in model m before shell s:
var s = s.Previous();
RemoveCompositeData(ipt[integer])
Description
Removes the composite data for an integration point in *ELEMENT_SHELL_COMPOSITE.
Arguments
Name Type
ipt
Description
integer The integration point you want to remove. Note that integration points start at 0, not 1.
Return type
No return value.
Keywords 814
March 2016
Element
Shell class
Example
To remove the composite data for the 3rd integration point for shell s:
s.RemoveCompositeData(2);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the shells in model m, from 1000000:
Shell.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged shells will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the shells in model m flagged with f, from 1000000:
Shell.RenumberFlagged(m, f, 1000000);
ReverseNormal(redraw (optional)[boolean])
Description
Reverse shell normal.
March 2016
Keywords 815
Shell class
Element
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not. If omitted redraw is false. If you want to reverse several
shell normals and only redraw after the last one then use false for all redraws apart from the
last one.
Return type
No return value.
Example
To Reverse shell normal for shell s:
s.ReverseNormal();
Arguments
Name Type
Description
Flag
flag bit
Return type
No return value.
Example
To Reverse all flagged shell normals:
Shell.ReverseNormalFlagged(m, flag);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only shells from that model can be selected. If the argument
Flag
is a Flag then only shells that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any shells can be selected. from any model.
modal
(optional)
boolean
Keywords 816
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.
March 2016
Element
Shell class
Return type
Number of shells selected or null if menu cancelled
Example
To select shells from model m, flagging those selected with flag f, giving the prompt Select shells:
Shell.Select(f, Select shells, m);
To select shells, flagging those selected with flag f but limiting selection to shells flagged with flag l, giving the prompt
Select shells:
Shell.Select(f, Select shells, l);
Arguments
Name
Type
Description
ipt
integer The integration point you want to set the data for. Note that integration points start at 0,
not 1.
mid
thick
real
beta
real
plyid
(optional)
integer Ply ID for the integration point. This should be used if the _COMPOSITE_LONG option is
set for the shell.
Return type
No return value.
Example
To set the composite data for the 3rd integration point to mat 1, thickness 0.5 and angle 45, for shell s:
s.SetCompositeData(2, 1, 0.5, 45);
SetFlag(flag[Flag])
Description
Sets a flag on the shell.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Keywords 817
Shell class
Element
Example
To set flag f for shell s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the shell. The shell will be sketched until you either call Shell.Unsketch(), Shell.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the shell is sketched. If omitted redraw is true. If you
want to sketch several shells and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch shell s:
s.Sketch();
Skew()
Description
Calculates the skew for the shell
Arguments
No arguments
Return type
float
Example
To calculate the skew for shell s:
var skew = s.Skew();
Keywords 818
March 2016
Element
Shell class
Arguments
Name
Type
Description
Contact
label
integer The label of the tied contact. If zero the tied contact is found for the shell by reverse lookup.
Flag
Flag
Option1
integer Directly tied node (logical OR) 0:NONE 1:NRB/C_EXNO 2:BEAM 4:SHELL 8:SOLID
16:TSHELL
Option2
integer 0:No action 1: report error if directly attached node (acc. option1) captured by contact
flag bit
Return type
string
Example
To check if all nodes of shell s are tied by contact 200 or attach directly to constraint:
var message = s.TiedNodeCheck(200, flag, 1, 1)
Timestep()
Description
Calculates the timestep for the shell
Arguments
No arguments
Return type
float
Example
To calculate the timestep for shell s:
var timestep = s.Timestep();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing shells should be counted. If false or omitted referenced but undefined
shells will also be included in the total.
Return type
number of shells
March 2016
Keywords 819
Shell class
Element
Example
To get the total number of shells in model m:
var total = Shell.Total(m);
Unblank()
Description
Unblanks the shell
Arguments
No arguments
Return type
No return value
Example
To unblank shell s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the shells in model m:
Shell.UnblankAll(m);
Keywords 820
March 2016
Element
Shell class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the shells in model m flagged with f:
Shell.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all shells will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the shells in model m:
Shell.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the shell.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the shell is unsketched. If omitted redraw is true. If
you want to unsketch several shells and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
March 2016
Keywords 821
Shell class
Element
Example
To unsketch shell s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the shells 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().
Return type
No return value
Example
To unsketch all shells in model m:
Shell.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Shell object.
Example
To check if Shell property s.example is a parameter by using the Shell.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keywords 822
March 2016
Element
Shell class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for shell s:
s.Warning("My custom warning");
Warpage()
Description
Calculates the warpage for the shell
Arguments
No arguments
Return type
float
Example
To calculate the warpage for shell s:
var warpage = s.Warpage();
WeightingFactors(s[float], t[float])
Description
Calculates the weighting factors for a point on the shell from the isoparametric coords.
Arguments
Name Type Description
s
Return type
Array containing weighting factors or null if not possible to calculate.
Example
To calculate the weighting factors of isoparametric point (0.5, -0.5) on shell s:
var weights = s.WeightingFactors(0.5, -0.5);
March 2016
Keywords 823
Shell class
Element
Xrefs()
Description
Returns the cross references for this shell.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for shell s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the shell data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Shell.Keyword() and Shell.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for shell s in keyword format
var str = s.toString();
Keywords 824
March 2016
Element
Slipring class
Slipring class
The Slipring class gives you access to seatbelt slipring cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[slipring property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Slipring properties
Name
Type
Description
colour
dc
real
direct
exists
logical true if slipring exists, false if referred to but not defined. (read only)
fc
real
Optional decay constant to allow a smooth transition between the static and dynamic friction
coefficients.
March 2016
Keywords 825
Slipring class
Element
fcs
real
funcid
include
real
label
integer Slipring number. Also see the sbsrid property which is an alternative name for this.
lcnffd
lcnffs
ltime
real
model
onid
sbid1
sbid2
sbrnid
sbsrid
integer Slipring number. Also see the label property which is an alternative name for this.
shell_
seatbelt
logical true if slipring is used for shell (2D) seatbelt elements. (read only)
Optional coefficient for determining the Coulomb friction coefficient related to angle alpha
transparency integer The transparency of the slipring (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Slipring class allows you to create, modify, edit and manipulate seatbelt slipring cards. See the documentation
below for more details.
Constructor
new Slipring(Model[Model], sbsrid[integer], sbid1[integer], sbid2[integer],
sbrnid[integer])
Description
Create a new Seatbelt Slipring object.
Arguments
Name Type
Description
sbid2
Return type
Slipring object
Example
To create a new seatbelt slipring in model m with label 100, seatbelts 10, 11 and node 20:
var a = new Slipring(m, 100, 10, 11, 20);
Keywords 826
March 2016
Element
Slipring class
Details of functions
Blank()
Description
Blanks the slipring
Arguments
No arguments
Return type
No return value
Example
To blank slipring s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sliprings in model m:
Slipring.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
March 2016
Keywords 827
Slipring class
Element
Return type
No return value
Example
To blank all of the sliprings in model m flagged with f:
Slipring.BlankFlagged(m, f);
Blanked()
Description
Checks if the slipring is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if slipring s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse slipring s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the slipring.
Arguments
Name Type Description
flag
Keywords 828
March 2016
Element
Slipring class
Return type
No return value
Example
To clear flag f for slipring s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the slipring.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy slipring s into slipring z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Slipring object (or null if not made)
Example
To start creating an slipring in model m:
var s = Slipring.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
March 2016
Keywords 829
Slipring class
Element
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit slipring s:
s.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for slipring s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first slipring in the model.
Arguments
Name Type
Description
Return type
Slipring object (or null if there are no sliprings in the model).
Example
To get the first slipring in model m:
var s = Slipring.First(m);
Keywords 830
March 2016
Element
Slipring class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Slipring label.
Example
To get the first free slipring label in model m:
var label = Slipring.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the sliprings with flag f in model m:
Slipring.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the slipring is flagged or not.
Arguments
Name Type Description
flag
March 2016
Keywords 831
Slipring class
Element
Return type
true if flagged, false if not.
Example
To check if slipring s has flag f set on it:
if (s.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the sliprings in model m:
Slipring.ForEach(m, test);
function test(s)
{
// s is Slipring object
}
To call function test for all of the sliprings in model m with optional object:
var data = { x:0, y:0 };
Slipring.ForEach(m, test, data);
function test(s, extra)
{
// s is Slipring object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Slipring objects for all of the sliprings in a model in Primer
Keywords 832
March 2016
Element
Slipring class
Arguments
Name Type
Description
Return type
Array of Slipring objects
Example
To make an array of Slipring objects for all of the sliprings in model m
var s = Slipring.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Slipring objects
Example
To make an array of Slipring objects for all of the sliprings in model m flagged with f
var s = Slipring.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the slipring you want the Slipring object for
Return type
Slipring object (or null if slipring does not exist).
Example
To get the Slipring object for slipring 100 in model m
var s = Slipring.GetFromID(m, 100);
March 2016
Keywords 833
Slipring class
Element
GetParameter(prop[slipring property])
Description
Checks if a Slipring 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 Slipring.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Slipring property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Slipring property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this slipring (*ELEMENT_SEATBELT_SLIPEROMETER) Note that a carriage return is
not added. See also Slipring.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for slipring s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the slipring. Note that a carriage return is not added. See also Slipring.Keyword()
Arguments
No arguments
Keywords 834
March 2016
Element
Slipring class
Return type
string containing the cards.
Example
To get the cards for slipring s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last slipring in the model.
Arguments
Name Type
Description
Return type
Slipring object (or null if there are no sliprings in the model).
Example
To get the last slipring in model m:
var s = Slipring.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Slipring label.
Example
To get the last free slipring label in model m:
var label = Slipring.LastFreeLabel(m);
Next()
Description
Returns the next slipring in the model.
March 2016
Keywords 835
Slipring class
Element
Arguments
No arguments
Return type
Slipring object (or null if there are no more sliprings in the model).
Example
To get the slipring in model m after slipring s:
var s = s.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Slipring label.
Example
To get the next free slipring label in model m:
var label = Slipring.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the slipring can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
Keywords 836
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.
March 2016
Element
Slipring class
Return type
Slipring object (or null if not picked)
Example
To pick a slipring from model m giving the prompt Pick slipring from screen:
var s = Slipring.Pick(Pick slipring from screen, m);
Previous()
Description
Returns the previous slipring in the model.
Arguments
No arguments
Return type
Slipring object (or null if there are no more sliprings in the model).
Example
To get the slipring in model m before slipring s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the sliprings in model m, from 1000000:
Slipring.RenumberAll(m, 1000000);
March 2016
Keywords 837
Slipring class
Element
Arguments
Name Type
Description
Model Model Model that all the flagged sliprings will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the sliprings in model m flagged with f, from 1000000:
Slipring.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only sliprings from that model can be selected. If the
Flag
argument is a Flag then only sliprings that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any sliprings can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of sliprings selected or null if menu cancelled
Example
To select sliprings from model m, flagging those selected with flag f, giving the prompt Select sliprings:
Slipring.Select(f, Select sliprings, m);
To select sliprings, flagging those selected with flag f but limiting selection to sliprings flagged with flag l, giving the
prompt Select sliprings:
Slipring.Select(f, Select sliprings, l);
SetFlag(flag[Flag])
Description
Sets a flag on the slipring.
Keywords 838
March 2016
Element
Slipring class
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for slipring s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the slipring. The slipring will be sketched until you either call Slipring.Unsketch(), Slipring.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the slipring is sketched. If omitted redraw is true. If
you want to sketch several sliprings and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To sketch slipring s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing sliprings should be counted. If false or omitted referenced but undefined
sliprings will also be included in the total.
Return type
number of sliprings
Example
To get the total number of sliprings in model m:
var total = Slipring.Total(m);
March 2016
Keywords 839
Slipring class
Element
Unblank()
Description
Unblanks the slipring
Arguments
No arguments
Return type
No return value
Example
To unblank slipring s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sliprings in model m:
Slipring.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Keywords 840
March 2016
Element
Slipring class
Return type
No return value
Example
To unblank all of the sliprings in model m flagged with f:
Slipring.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all sliprings will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the sliprings in model m:
Slipring.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the slipring.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the slipring is unsketched. If omitted redraw is true. If
you want to unsketch several sliprings and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch slipring s:
s.Unsketch();
March 2016
Keywords 841
Slipring class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the sliprings 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().
Return type
No return value
Example
To unsketch all sliprings in model m:
Slipring.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Slipring object.
Example
To check if Slipring property s.example is a parameter by using the Slipring.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for slipring s:
s.Warning("My custom warning");
Keywords 842
March 2016
Element
Slipring class
Xrefs()
Description
Returns the cross references for this slipring.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for slipring s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the slipring data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Slipring.Keyword() and Slipring.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for slipring s in keyword format
var str = s.toString();
March 2016
Keywords 843
Solid class
Element
Solid class
The Solid class gives you access to solid cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
ElemCut(Database cross section label[integer])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[solid property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
TiedNodeCheck(Contact label[integer], Flag[Flag], Option1[integer], Option2[integer])
Timestep()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Solid constants
Name
Description
Keywords 844
March 2016
Element
Solid class
Solid properties
Name
Type
Description
a1
real
a2
real
a3
real
colour
Colour
d1
real
d2
real
d3
real
dof
logical
edges
eid
integer
Solid number. Also see the label property which is an alternative name for this.
exists
logical
true if solid exists, false if referred to but not defined. (read only)
faces
h20
logical
h8toh20
logical
include
integer
label
integer
Solid number. Also see the eid property which is an alternative name for this.
model
integer
n1
integer
Node number 1
n10
integer
Node number 10
n11
integer
Node number 11
n12
integer
Node number 12
n13
integer
Node number 13
n14
integer
Node number 14
n15
integer
Node number 15
n16
integer
Node number 16
n17
integer
Node number 17
n18
integer
Node number 18
n19
integer
Node number 19
n2
integer
Node number 2
March 2016
Keywords 845
Solid class
Element
n20
integer
Node number 20
n3
integer
Node number 3
n4
integer
Node number 4
n5
integer
Node number 5
n6
integer
Node number 6
n7
integer
Node number 7
n8
integer
Node number 8
n9
integer
Node number 9
nodes
integer
ns1
integer
ns2
integer
ns3
integer
ns4
integer
ns5
integer
ns6
integer
ns7
integer
ns8
integer
ortho
logical
pid
integer
Part number
tet4totet10
logical
transparency integer
Detailed Description
The Solid class allows you to create, modify, edit and manipulate solid cards. See the documentation below for more
details.
Constructor
new Solid(Model[Model], eid[integer], pid[integer], n1[integer], n2[integer],
n3[integer], n4[integer], n5 (optional)[integer], n6 (optional)[integer], n7
(optional)[integer], n8 (optional)[integer], n9 (optional)[integer], n10
(optional)[integer], n11 (optional)[integer], n12 (optional)[integer], n13
(optional)[integer], n14 (optional)[integer], n15 (optional)[integer], n16
(optional)[integer], n17 (optional)[integer], n18 (optional)[integer], n19
(optional)[integer], n20 (optional)[integer])
Description
Create a new Solid object. Use either 4, 6, 8 or 10 nodes when creating a new solid. If you are creating a 4 noded solid
either only give 4 nodes or give 8 nodes but make nodes 4 to 8 the same number. If you are creating a 6 noded solid
either only give 6 nodes or give 8 nodes but make nodes 5 and 6 the same number and nodes 7 and 8 the same number.
Keywords 846
March 2016
Element
Solid class
Arguments
Name
Type
Description
Model
eid
pid
n1
n2
n3
n4
n5 (optional)
n6 (optional)
n7 (optional)
n8 (optional)
n9 (optional)
Return type
Solid object
Example
To create a new solid in model m with label 100, part 10 and nodes 1, 2, 3, 4, 5, 6, 7, 8:
var s = new Solid(m, 100, 10, 1, 2, 3, 4, 5, 6, 7, 8);
Details of functions
Blank()
Description
Blanks the solid
Arguments
No arguments
March 2016
Keywords 847
Solid class
Element
Return type
No return value
Example
To blank solid s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the solids in model m:
Solid.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the solids in model m flagged with f:
Solid.BlankFlagged(m, f);
Keywords 848
March 2016
Element
Solid class
Blanked()
Description
Checks if the solid is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if solid s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse solid s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the solid.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for solid s:
s.ClearFlag(f);
March 2016
Keywords 849
Solid class
Element
Copy(range (optional)[boolean])
Description
Copies the solid.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy solid s into solid z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Solid object (or null if not made)
Example
To start creating a solid in model m:
var s = Solid.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Keywords 850
March 2016
Element
Solid class
Example
To Edit solid s:
s.Edit();
Arguments
Name
Type
Description
Database cross section label integer The label of the database cross section.
Return type
An object containing face cut information. Each face references an array containing the x1,y1,z1,x2,y2,z2 coordinates
of the cut line. The properties of the returned object are face1, face2...face6. Returns NULL if there is no cut. If no cut
on a face, then the entry for that face array is NULL. Note this function does not check that the solid is in the cross
section definition (part set)
Example
To see if the database cross section 200 cuts solid s and at which points it cuts face 3 of the solid:
var data = s.ElemCut(200);
var face = data.face3;
if(face)
{
var point1_x = face[0];
var point1_y = face[1];
var point1_z = face[2];
var point2_x = face[3];
var point2_y = face[4];
var point2_z = face[5];
}
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for solid s:
s.Error("My custom error");
March 2016
Keywords 851
Solid class
Element
FindSolidEnd() [static]
Description
Tidy memory allocation incurred by function which finds solids within a box. See also Solid.FindSolidInit() See also
Solid.FindSolidInBox()
Arguments
No arguments
Return type
No return value
Example
Solid.FindSolidEnd();
Arguments
Name
Type
Description
Model
xmin
real
xmax
real
ymin
real
ymax
real
zmin
real
zmax
real
Return type
Array of Solid objects
Keywords 852
March 2016
Element
Solid class
Example
To get an array of Solid objects for flagged solids in model m within defined box
Solid.FindSolidInit(m, flag);
{
//loop in which boxes are formed and tested
//find solids both in box and flagged with hflag
var s = Solid.FindSolidInBox(m, xmin, xmax, ymin, ymax, zmin, zmax, hflag);
if(s.length) ...
}
Solid.FindSolidEnd();
Arguments
Name
Type
Model
Description
Optional flag that has been set on the solids, if unsupplied all solids considered
Return type
No return value
Example
To initialize find setup for solids flagged with f in model m:
Solid.FindSolidInit(m, f);
First(Model[Model]) [static]
Description
Returns the first solid in the model.
Arguments
Name Type
Description
Return type
Solid object (or null if there are no solids in the model).
March 2016
Keywords 853
Solid class
Element
Example
To get the first solid in model m:
var s = Solid.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Solid label.
Example
To get the first free solid label in model m:
var label = Solid.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the solids with flag f in model m:
Solid.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the solid is flagged or not.
Keywords 854
March 2016
Element
Solid class
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if solid s has flag f set on it:
if (s.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the solids in model m:
Solid.ForEach(m, test);
function test(s)
{
// s is Solid object
}
To call function test for all of the solids in model m with optional object:
var data = { x:0, y:0 };
Solid.ForEach(m, test, data);
function test(s, extra)
{
// s is Solid object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Solid objects for all of the solids in a model in Primer
March 2016
Keywords 855
Solid class
Element
Arguments
Name Type
Description
Return type
Array of Solid objects
Example
To make an array of Solid objects for all of the solids in model m
var s = Solid.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Solid objects
Example
To make an array of Solid objects for all of the solids in model m flagged with f
var s = Solid.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the solid you want the Solid object for
Return type
Solid object (or null if solid does not exist).
Example
To get the Solid object for solid 100 in model m
var s = Solid.GetFromID(m, 100);
Keywords 856
March 2016
Element
Solid class
GetParameter(prop[solid property])
Description
Checks if a Solid 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 Solid.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Solid property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Solid property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this solid (*SOLID, *SOLID_SCALAR or *SOLID_SCALAR_VALUE). Note that a
carriage return is not added. See also Solid.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for solid s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the solid. Note that a carriage return is not added. See also Solid.Keyword()
Arguments
No arguments
March 2016
Keywords 857
Solid class
Element
Return type
string containing the cards.
Example
To get the cards for solid s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last solid in the model.
Arguments
Name Type
Description
Return type
Solid object (or null if there are no solids in the model).
Example
To get the last solid in model m:
var s = Solid.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Solid label.
Example
To get the last free solid label in model m:
var label = Solid.LastFreeLabel(m);
Next()
Description
Returns the next solid in the model.
Keywords 858
March 2016
Element
Solid class
Arguments
No arguments
Return type
Solid object (or null if there are no more solids in the model).
Example
To get the solid in model m after solid s:
var s = s.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Solid label.
Example
To get the next free solid label in model m:
var label = Solid.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the solid can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
March 2016
Keywords 859
Solid class
Element
Return type
Solid object (or null if not picked)
Example
To pick a solid from model m giving the prompt Pick solid from screen:
var s = Solid.Pick(Pick solid from screen, m);
Previous()
Description
Returns the previous solid in the model.
Arguments
No arguments
Return type
Solid object (or null if there are no more solids in the model).
Example
To get the solid in model m before solid s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the solids in model m, from 1000000:
Solid.RenumberAll(m, 1000000);
Keywords 860
March 2016
Element
Solid class
Arguments
Name Type
Description
Model Model Model that all the flagged solids will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the solids in model m flagged with f, from 1000000:
Solid.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only solids from that model can be selected. If the argument
Flag
is a Flag then only solids that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any solids can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of solids selected or null if menu cancelled
Example
To select solids from model m, flagging those selected with flag f, giving the prompt Select solids:
Solid.Select(f, Select solids, m);
To select solids, flagging those selected with flag f but limiting selection to solids flagged with flag l, giving the prompt
Select solids:
Solid.Select(f, Select solids, l);
SetFlag(flag[Flag])
Description
Sets a flag on the solid.
March 2016
Keywords 861
Solid class
Element
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for solid s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the solid. The solid will be sketched until you either call Solid.Unsketch(), Solid.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the solid is sketched. If omitted redraw is true. If you
want to sketch several solids and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch solid s:
s.Sketch();
Arguments
Name
Type
Description
Contact
label
integer The label of the tied contact. If zero the tied contact is found for the solid by reverse lookup.
Flag
Flag
Option1
integer Directly tied node (logical OR) 0:NONE 1:NRB/C_EXNO 2:BEAM 4:SHELL 8:SOLID
16:TSHELL
Option2
integer 0:No action 1:report error if directly attached node (acc. option1) also captured by contact
flag bit
Return type
string
Keywords 862
March 2016
Element
Solid class
Example
To check if all nodes of solid h are tied by contact 200 or attach directly to constraint or shell:
var message = h.TiedNodeCheck(200, flag, 1|4, 1)
Timestep()
Description
Calculates the timestep for the solid
Arguments
No arguments
Return type
float
Example
To calculate the timestep for solid s:
var timestep = s.Timestep();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing solids should be counted. If false or omitted referenced but undefined
solids will also be included in the total.
Return type
number of solids
Example
To get the total number of solids in model m:
var total = Solid.Total(m);
Unblank()
Description
Unblanks the solid
Arguments
No arguments
Return type
No return value
March 2016
Keywords 863
Solid class
Element
Example
To unblank solid s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the solids in model m:
Solid.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the solids in model m flagged with f:
Solid.UnblankFlagged(m, f);
Keywords 864
March 2016
Element
Solid class
Arguments
Name Type
Description
Model Model Model that the defined flag for all solids will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the solids in model m:
Solid.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the solid.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the solid is unsketched. If omitted redraw is true. If
you want to unsketch several solids and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To unsketch solid s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the solids 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().
Return type
No return value
March 2016
Keywords 865
Solid class
Element
Example
To unsketch all solids in model m:
Solid.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Solid object.
Example
To check if Solid property s.example is a parameter by using the Solid.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for solid s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this solid.
Arguments
No arguments
Keywords 866
March 2016
Element
Solid class
Return type
Xrefs object.
Example
To get the cross references for solid s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the solid data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Solid.Keyword() and Solid.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for solid s in keyword format
var str = s.toString();
March 2016
Keywords 867
Sph class
Element
Sph class
The Sph class gives you access to Element SPH cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[sph property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Sph properties
Name
Type
colour
exists
logical true if sph exists, false if referred to but not defined. (read only)
include
mass
real
model
nid
Keywords 868
Description
Mass value.
March 2016
Element
pid
Sph class
transparency integer The transparency of the sph (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Sph class allows you to create, modify, edit and manipulate SPH cards. See the documentation below for more
details.
Constructor
new Sph(Model[Model], nid[integer], pid[integer], mass[real])
Description
Create a new object.
Arguments
Name Type
Description
integer Node ID and Element ID are the same for the SPH option.
pid
mass
real
Mass value.
Return type
Sph object
Example
To create a new sph element in model m with nid = 100, pid = 400, mass = 0.9:
var s = new Sph(m, 100, 400, 0.9);
Details of functions
Blank()
Description
Blanks the sph
Arguments
No arguments
Return type
No return value
Example
To blank sph s:
s.Blank();
March 2016
Keywords 869
Sph class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sphs in model m:
Sph.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sphs in model m flagged with f:
Sph.BlankFlagged(m, f);
Blanked()
Description
Checks if the sph is blanked or not.
Arguments
No arguments
Keywords 870
March 2016
Element
Sph class
Return type
true if blanked, false if not.
Example
To check if sph s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse sph s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the sph.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for sph s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the sph.
March 2016
Keywords 871
Sph class
Element
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy sph s into sph z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Sph object (or null if not made)
Example
To start creating an sph in model m:
var s = Sph.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit sph s:
s.Edit();
Keywords 872
March 2016
Element
Sph class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for sph s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first sph in the model.
Arguments
Name Type
Description
Return type
Sph object (or null if there are no sphs in the model).
Example
To get the first sph in model m:
var s = Sph.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
March 2016
Keywords 873
Sph class
Element
Return type
Sph label.
Example
To get the first free sph label in model m:
var label = Sph.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the sphs with flag f in model m:
Sph.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the sph is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if sph s has flag f set on it:
if (s.Flagged(f) ) do_something...
Keywords 874
March 2016
Element
Sph class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the sphs in model m:
Sph.ForEach(m, test);
function test(s)
{
// s is Sph object
}
To call function test for all of the sphs in model m with optional object:
var data = { x:0, y:0 };
Sph.ForEach(m, test, data);
function test(s, extra)
{
// s is Sph object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Sph objects for all of the sphs in a model in Primer
Arguments
Name Type
Description
Return type
Array of Sph objects
Example
To make an array of Sph objects for all of the sphs in model m
var s = Sph.GetAll(m);
March 2016
Keywords 875
Sph class
Element
Arguments
Name Type
Description
Flag
Return type
Array of Sph objects
Example
To make an array of Sph objects for all of the sphs in model m flagged with f
var s = Sph.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the sph you want the Sph object for
Return type
Sph object (or null if sph does not exist).
Example
To get the Sph object for sph 100 in model m
var s = Sph.GetFromID(m, 100);
GetParameter(prop[sph property])
Description
Checks if a Sph 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 Sph.ViewParameters() method and method chaining (see
the examples below).
Arguments
Name Type
prop
Description
Keywords 876
March 2016
Element
Sph class
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Sph property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Sph property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keyword()
Description
Returns the keyword for this sph (*ELEMENT_SPH) Note that a carriage return is not added. See also
Sph.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for sph s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the sph. Note that a carriage return is not added. See also Sph.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for sph s:
var cards = s.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last sph in the model.
March 2016
Keywords 877
Sph class
Element
Arguments
Name Type
Description
Return type
Sph object (or null if there are no sphs in the model).
Example
To get the last sph in model m:
var s = Sph.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Sph label.
Example
To get the last free sph label in model m:
var label = Sph.LastFreeLabel(m);
Next()
Description
Returns the next sph in the model.
Arguments
No arguments
Return type
Sph object (or null if there are no more sphs in the model).
Example
To get the sph in model m after sph s:
var s = s.Next();
Keywords 878
March 2016
Element
Sph class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Sph label.
Example
To get the next free sph label in model m:
var label = Sph.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the sph can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Sph object (or null if not picked)
Example
To pick an sph from model m giving the prompt Pick sph from screen:
var s = Sph.Pick(Pick sph from screen, m);
Previous()
Description
Returns the previous sph in the model.
March 2016
Keywords 879
Sph class
Element
Arguments
No arguments
Return type
Sph object (or null if there are no more sphs in the model).
Example
To get the sph in model m before sph s:
var s = s.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the sphs in model m, from 1000000:
Sph.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged sphs will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the sphs in model m flagged with f, from 1000000:
Sph.RenumberFlagged(m, f, 1000000);
Keywords 880
March 2016
Element
Sph class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only sphs from that model can be selected. If the argument is
Flag
a Flag then only sphs that are flagged with limit can be selected (limit should be different to
flag). If omitted, or null, any sphs can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of sphs selected or null if menu cancelled
Example
To select sphs from model m, flagging those selected with flag f, giving the prompt Select sphs:
Sph.Select(f, Select sphs, m);
To select sphs, flagging those selected with flag f but limiting selection to sphs flagged with flag l, giving the prompt
Select sphs:
Sph.Select(f, Select sphs, l);
SetFlag(flag[Flag])
Description
Sets a flag on the sph.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for sph s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the sph. The sph will be sketched until you either call Sph.Unsketch(), Sph.UnsketchAll(),
Model.UnsketchAll(), or delete the model
March 2016
Keywords 881
Sph class
Element
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the sph is sketched. If omitted redraw is true. If you
want to sketch several sphs and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch sph s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing sphs should be counted. If false or omitted referenced but undefined sphs
will also be included in the total.
Return type
number of sphs
Example
To get the total number of sphs in model m:
var total = Sph.Total(m);
Unblank()
Description
Unblanks the sph
Arguments
No arguments
Return type
No return value
Example
To unblank sph s:
s.Unblank();
Keywords 882
March 2016
Element
Sph class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sphs in model m:
Sph.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sphs in model m flagged with f:
Sph.UnblankFlagged(m, f);
March 2016
Keywords 883
Sph class
Element
Arguments
Name Type
Description
Model Model Model that the defined flag for all sphs will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the sphs in model m:
Sph.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the sph.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the sph is unsketched. If omitted redraw is true. If you
want to unsketch several sphs and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To unsketch sph s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the sphs 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().
Return type
No return value
Keywords 884
March 2016
Element
Sph class
Example
To unsketch all sphs in model m:
Sph.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Sph object.
Example
To check if Sph property s.example is a parameter by using the Sph.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for sph s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this sph.
Arguments
No arguments
March 2016
Keywords 885
Sph class
Element
Return type
Xrefs object.
Example
To get the cross references for sph s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the sph data in keyword format. Note that this contains the keyword header and the keyword
cards. See also Sph.Keyword() and Sph.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for sph s in keyword format
var str = s.toString();
Keywords 886
March 2016
Element
Tshell class
Tshell class
The Tshell class gives you access to thick shell cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
ElemCut(Database cross section label[integer])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetCompositeData(ipt[integer])
GetNodeIDs()
GetNodes()
GetParameter(prop[thick shell property])
Keyword()
KeywordCards()
Next()
Previous()
RemoveCompositeData(ipt[integer])
SetCompositeData(ipt[integer], mid[integer], thick[real], beta[real])
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Timestep()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Tshell properties
Name
Type
Description
beta
beta_angle
float
March 2016
Keywords 887
Tshell class
Element
colour
composite
eid
integer Tshell number. Also see the label property which is an alternative name for this.
exists
logical true if thick shell exists, false if referred to but not defined. (read only)
include
integer The Include file number that the thick shell is in.
label
integer Tshell number. Also see the eid property which is an alternative name for this.
model
n1
n2
n3
n4
n5
n6
n7
n8
nip
nodes
pid
transparency integer The transparency of the thick shell (0-100) 0% is opaque, 100% is transparent.
Detailed Description
The Tshell class allows you to create, modify, edit and manipulate thich shell cards. See the documentation below for
more details.
Constructor
new Tshell(Model[Model], eid[integer], pid[integer], n1[integer], n2[integer],
n3[integer], n4[integer], n5[integer], n6[integer], n7 (optional)[integer], n8
(optional)[integer])
Description
Create a new Tshell object. Use either 6 or 8 nodes when creating a new thick shell.
Keywords 888
March 2016
Element
Tshell class
Arguments
Name
Type
Description
Model
eid
pid
n1
n2
n3
n4
n5
n6
Return type
Tshell object
Example
To create a new thick shell in model m with label 100, part 10 and nodes 1, 2, 3, 4, 5, 6, 7, 8:
var t = new Tshell(m, 100, 10, 1, 2, 3, 4, 5, 6, 7, 8);
Details of functions
Blank()
Description
Blanks the thick shell
Arguments
No arguments
Return type
No return value
Example
To blank thick shell t:
t.Blank();
March 2016
Keywords 889
Tshell class
Element
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the thick shells in model m:
Tshell.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the thick shells in model m flagged with f:
Tshell.BlankFlagged(m, f);
Blanked()
Description
Checks if the thick shell is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if thick shell t is blanked:
if (t.Blanked() ) do_something...
Keywords 890
March 2016
Element
Tshell class
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse thick shell t:
t.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the thick shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for thick shell t:
t.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the thick shell.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
March 2016
Keywords 891
Tshell class
Element
Example
To copy thick shell t into thick shell z:
var z = t.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Tshell object (or null if not made)
Example
To start creating a thick shell in model m:
var t = Tshell.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit thick shell t:
t.Edit();
Keywords 892
March 2016
Element
Tshell class
Arguments
Name
Type
Description
Database cross section label integer The label of the database cross section.
Return type
An object containing face cut information. Each face references an array containing the x1,y1,z1,x2,y2,z2 coordinates
of the cut line. The properties of the returned object are face1, face2...face6. Returns NULL if there is no cut. If no cut
on a face, then the entry for that face array is NULL. Note this function does not check that the thick shell is in the cross
section definition (part set)
Example
To see if the database cross section 200 cuts thick shell s and at which points it cuts face 3 of the thick shell:
var data = s.ElemCut(200);
var face = data.face3;
if(face)
{
var point1_x = face[0];
var point1_y = face[1];
var point1_z = face[2];
var point2_x = face[3];
var point2_y = face[4];
var point2_z = face[5];
}
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for thick shell t:
t.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first thick shell in the model.
March 2016
Keywords 893
Tshell class
Element
Arguments
Name Type
Description
Return type
Tshell object (or null if there are no thick shells in the model).
Example
To get the first thick shell in model m:
var t = Tshell.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Tshell label.
Example
To get the first free thick shell label in model m:
var label = Tshell.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 894
March 2016
Element
Tshell class
Example
To flag all of the thick shells with flag f in model m:
Tshell.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the thick shell is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if thick shell t has flag f set on it:
if (t.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 895
Tshell class
Element
Example
To call function test for all of the thick shells in model m:
Tshell.ForEach(m, test);
function test(t)
{
// t is Tshell object
}
To call function test for all of the thick shells in model m with optional object:
var data = { x:0, y:0 };
Tshell.ForEach(m, test, data);
function test(t, extra)
{
// t is Tshell object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Tshell objects for all of the thick shells in a model in Primer
Arguments
Name Type
Description
Return type
Array of Tshell objects
Example
To make an array of Tshell objects for all of the thick shells in model m
var t = Tshell.GetAll(m);
GetCompositeData(ipt[integer])
Description
Returns the composite data for an integration point in *ELEMENT_TSHELL_COMPOSITE.
Arguments
Name Type
ipt
Description
integer The integration point you want the data for. Note that integration points start at 0, not 1.
Return type
An array containing the material id, thickness and beta angle.
Example
To get the composite data for the 3rd integration point for thick shell t:
if (t.composite && s.nip >= 3)
{
var ipt_data = t.GetCompositeData(2);
}
Keywords 896
March 2016
Element
Tshell class
Arguments
Name Type
Description
Flag
Return type
Array of Tshell objects
Example
To make an array of Tshell objects for all of the thick shells in model m flagged with f
var t = Tshell.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the thick shell you want the Tshell object for
Return type
Tshell object (or null if thick shell does not exist).
Example
To get the Tshell object for thick shell 100 in model m
var t = Tshell.GetFromID(m, 100);
GetNodeIDs()
Description
Returns the labels of the nodes on the thick shell as an array. See also Tshell.GetNodes()
Arguments
No arguments
Return type
Array of node labels (integers)
March 2016
Keywords 897
Tshell class
Element
Example
To return the node labels of thick shell t as an array
var nodes = t.GetNodeIDs();
GetNodes()
Description
Returns the nodes on the thick shell as an array of Node objects. See also Tshell.GetNodeIDs()
Arguments
No arguments
Return type
Array of Node objects
Example
To return the nodes of thick shell t as an array
var nodes = t.GetNodes();
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Tshell property t.example is a parameter:
Options.property_parameter_names = true;
if (t.GetParameter(t.example) ) do_something...
Options.property_parameter_names = false;
To check if Tshell property t.example is a parameter by using the GetParameter method:
if (t.ViewParameters().GetParameter(t.example) ) do_something...
Keywords 898
March 2016
Element
Tshell class
Keyword()
Description
Returns the keyword for this thick shell (*ELEMENT_TSHELL or *ELEMENT_TSHELL_COMPOSITE). Note that
a carriage return is not added. See also Tshell.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for thick shell t:
var key = t.Keyword();
KeywordCards()
Description
Returns the keyword cards for the thick shell. Note that a carriage return is not added. See also Tshell.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for thick shell t:
var cards = t.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last thick shell in the model.
Arguments
Name Type
Description
Return type
Tshell object (or null if there are no thick shells in the model).
Example
To get the last thick shell in model m:
var t = Tshell.Last(m);
March 2016
Keywords 899
Tshell class
Element
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Tshell label.
Example
To get the last free thick shell label in model m:
var label = Tshell.LastFreeLabel(m);
Next()
Description
Returns the next thick shell in the model.
Arguments
No arguments
Return type
Tshell object (or null if there are no more thick shells in the model).
Example
To get the thick shell in model m after thick shell t:
var t = t.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Tshell label.
Keywords 900
March 2016
Element
Tshell class
Example
To get the next free thick shell label in model m:
var label = Tshell.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the thick shell can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Tshell object (or null if not picked)
Example
To pick a thick shell from model m giving the prompt Pick thick shell from screen:
var t = Tshell.Pick(Pick thick shell from screen, m);
Previous()
Description
Returns the previous thick shell in the model.
Arguments
No arguments
Return type
Tshell object (or null if there are no more thick shells in the model).
Example
To get the thick shell in model m before thick shell t:
var t = t.Previous();
RemoveCompositeData(ipt[integer])
Description
Removes the composite data for an integration point in *ELEMENT_TSHELL_COMPOSITE.
March 2016
Keywords 901
Tshell class
Element
Arguments
Name Type
ipt
Description
integer The integration point you want to remove. Note that integration points start at 0, not 1.
Return type
No return value.
Example
To remove the composite data for the 3rd integration point for thick shell t:
t.RemoveCompositeData(2);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the thick shells in model m, from 1000000:
Tshell.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged thick shells will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the thick shells in model m flagged with f, from 1000000:
Tshell.RenumberFlagged(m, f, 1000000);
Keywords 902
March 2016
Element
Tshell class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only thick shells from that model can be selected. If the
Flag
argument is a Flag then only thick shells that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any thick shells can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of thick shells selected or null if menu cancelled
Example
To select thick shells from model m, flagging those selected with flag f, giving the prompt Select thick shells:
Tshell.Select(f, Select thick shells, m);
To select thick shells, flagging those selected with flag f but limiting selection to thick shells flagged with flag l, giving
the prompt Select thick shells:
Tshell.Select(f, Select thick shells, l);
Arguments
Name Type
Description
ipt
integer The integration point you want to set the data for. Note that integration points start at 0, not 1.
mid
thick
real
beta
real
Return type
No return value.
Example
To set the composite data for the 3rd integration point to mat 1, thickness 0.5 and angle 45, for thick shell t:
t.SetCompositeData(2, 1, 0.5, 45);
March 2016
Keywords 903
Tshell class
Element
SetFlag(flag[Flag])
Description
Sets a flag on the thick shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for thick shell t:
t.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the thick shell. The thick shell will be sketched until you either call Tshell.Unsketch(), Tshell.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the thick shell is sketched. If omitted redraw is true. If
you want to sketch several thick shells and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch thick shell t:
t.Sketch();
Timestep()
Description
Calculates the timestep for the thick shell
Arguments
No arguments
Return type
float
Example
To calculate the timestep for thick shell t:
var timestep = t.Timestep();
Keywords 904
March 2016
Element
Tshell class
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing thick shells should be counted. If false or omitted referenced but
undefined thick shells will also be included in the total.
Return type
number of thick shells
Example
To get the total number of thick shells in model m:
var total = Tshell.Total(m);
Unblank()
Description
Unblanks the thick shell
Arguments
No arguments
Return type
No return value
Example
To unblank thick shell t:
t.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
Keywords 905
Tshell class
Element
Example
To unblank all of the thick shells in model m:
Tshell.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the thick shells in model m flagged with f:
Tshell.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all thick shells will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the thick shells in model m:
Tshell.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the thick shell.
Keywords 906
March 2016
Element
Tshell class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the thick shell is unsketched. If omitted redraw is true.
If you want to unsketch several thick shells and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch thick shell t:
t.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the thick shells 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().
Return type
No return value
Example
To unsketch all thick shells in model m:
Tshell.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Tshell object.
Example
To check if Tshell property t.example is a parameter by using the Tshell.GetParameter() method:
if (t.ViewParameters().GetParameter(t.example) ) do_something...
March 2016
Keywords 907
Tshell class
Element
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for thick shell t:
t.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this thick shell.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for thick shell t:
var xrefs = t.Xrefs();
toString()
Description
Creates a string containing the thick shell data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Tshell.Keyword() and Tshell.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for thick shell t in keyword format
var str = t.toString();
Keywords 908
March 2016
Hourglass
Hourglass class
Hourglass class
The Hourglass class gives you access to hourglass cards in PRIMER. More...
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[hourglass property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Hourglass properties
Name
Type
Description
exists
logical true if hourglass exists, false if referred to but not defined. (read only)
hgid
integer Hourglass number. Also see the label property which is an alternative name for this.
ibq
ihq
include integer The Include file number that the hourglass is in.
label
integer Hourglass number. Also see the hgid property which is an alternative name for this.
model
q1
float
q2
float
qb
float
qm
float
Hourglass coefficient
qw
float
March 2016
Keywords 909
Hourglass class
Hourglass
title
string
vdc
float
Detailed Description
The Hourglass class allows you to create, modify, edit and manipulate hourglass cards. See the documentation below
for more details.
Constructor
new Hourglass(Model[Model], hgid[integer], title (optional)[string])
Description
Create a new Hourglass object.
Arguments
Name
Type
Model
hgid
Description
Return type
Hourglass object
Example
To create a new hourglass in model m with label 100:
var h = new Hourglass(m, 100);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse hourglass n:
n.Browse();
Keywords 910
March 2016
Hourglass
Hourglass class
ClearFlag(flag[Flag])
Description
Clears a flag on the hourglass.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for hourglass n:
n.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the hourglass.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy hourglass n into hourglass z:
var z = n.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Hourglass object (or null if not made)
March 2016
Keywords 911
Hourglass class
Hourglass
Example
To start creating a hourglass in model m:
var h = Hourglass.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit hourglass n:
n.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for hourglass n:
n.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first hourglass in the model.
Keywords 912
March 2016
Hourglass
Hourglass class
Arguments
Name Type
Description
Return type
Hourglass object (or null if there are no hourglasses in the model).
Example
To get the first hourglass in model m:
var n = Hourglass.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Hourglass label.
Example
To get the first free hourglass label in model m:
var label = Hourglass.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
March 2016
Keywords 913
Hourglass class
Hourglass
Example
To flag all of the hourglasses with flag f in model m:
Hourglass.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the hourglass is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if hourglass n has flag f set on it:
if (n.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Keywords 914
March 2016
Hourglass
Hourglass class
Example
To call function test for all of the hourglasses in model m:
Hourglass.ForEach(m, test);
function test(n)
{
// n is Hourglass object
}
To call function test for all of the hourglasses in model m with optional object:
var data = { x:0, y:0 };
Hourglass.ForEach(m, test, data);
function test(n, extra)
{
// n is Hourglass object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Hourglass objects for all of the hourglasses in a model in Primer
Arguments
Name Type
Description
Return type
Array of Hourglass objects
Example
To make an array of Hourglass objects for all of the hourglasses in model m
var n = Hourglass.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Hourglass objects
Example
To make an array of Hourglass objects for all of the hourglasses in model m flagged with f
var n = Hourglass.GetFlagged(m, f);
March 2016
Keywords 915
Hourglass class
Hourglass
Arguments
Name
Type
Description
Model
number integer number of the hourglass you want the Hourglass object for
Return type
Hourglass object (or null if hourglass does not exist).
Example
To get the Hourglass object for hourglass 100 in model m
var n = Hourglass.GetFromID(m, 100);
GetParameter(prop[hourglass property])
Description
Checks if a Hourglass 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 Hourglass.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Hourglass property n.example is a parameter:
Options.property_parameter_names = true;
if (n.GetParameter(n.example) ) do_something...
Options.property_parameter_names = false;
To check if Hourglass property n.example is a parameter by using the GetParameter method:
if (n.ViewParameters().GetParameter(n.example) ) do_something...
Keyword()
Description
Returns the keyword for this hourglass (*HOURGLASS). Note that a carriage return is not added. See also
Hourglass.KeywordCards()
Keywords 916
March 2016
Hourglass
Hourglass class
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for hourglass h:
var key = h.Keyword();
KeywordCards()
Description
Returns the keyword cards for the hourglass. Note that a carriage return is not added. See also Hourglass.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for hourglass h:
var cards = h.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last hourglass in the model.
Arguments
Name Type
Description
Return type
Hourglass object (or null if there are no hourglasses in the model).
Example
To get the last hourglass in model m:
var n = Hourglass.Last(m);
March 2016
Keywords 917
Hourglass class
Hourglass
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Hourglass label.
Example
To get the last free hourglass label in model m:
var label = Hourglass.LastFreeLabel(m);
Next()
Description
Returns the next hourglass in the model.
Arguments
No arguments
Return type
Hourglass object (or null if there are no more hourglasses in the model).
Example
To get the hourglass in model m after hourglass n:
var n = n.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Hourglass label.
Example
To get the next free hourglass label in model m:
var label = Hourglass.NextFreeLabel(m);
Keywords 918
March 2016
Hourglass
Hourglass class
Previous()
Description
Returns the previous hourglass in the model.
Arguments
No arguments
Return type
Hourglass object (or null if there are no more hourglasses in the model).
Example
To get the hourglass in model m before hourglass n:
var n = n.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the hourglasses in model m, from 1000000:
Hourglass.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged hourglasses will be renumbered in
flag
Flag
start
Return type
No return value
March 2016
Keywords 919
Hourglass class
Hourglass
Example
To renumber all of the hourglasses in model m flagged with f, from 1000000:
Hourglass.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only hourglasses from that model can be selected. If the
Flag
argument is a Flag then only hourglasses that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any hourglasses can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of hourglasses selected or null if menu cancelled
Example
To select hourglasses from model m, flagging those selected with flag f, giving the prompt Select hourglasses:
Hourglass.Select(f, Select hourglasses, m);
To select hourglasses, flagging those selected with flag f but limiting selection to hourglasses flagged with flag l, giving
the prompt Select hourglasses:
Hourglass.Select(f, Select hourglasses, l);
SetFlag(flag[Flag])
Description
Sets a flag on the hourglass.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for hourglass n:
n.SetFlag(f);
Keywords 920
March 2016
Hourglass
Hourglass class
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing hourglasses should be counted. If false or omitted referenced but
undefined hourglasses will also be included in the total.
Return type
number of hourglasses
Example
To get the total number of hourglasses in model m:
var total = Hourglass.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all hourglasses will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the hourglasses in model m:
Hourglass.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Hourglass object.
March 2016
Keywords 921
Hourglass class
Hourglass
Example
To check if Hourglass property n.example is a parameter by using the Hourglass.GetParameter() method:
if (n.ViewParameters().GetParameter(n.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for hourglass n:
n.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this hourglass.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for hourglass n:
var xrefs = n.Xrefs();
toString()
Description
Creates a string containing the hourglass data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Hourglass.Keyword() and Hourglass.KeywordCards().
Arguments
No arguments
Return type
string
Keywords 922
March 2016
Hourglass
Hourglass class
March 2016
Keywords 923
Example
To get data for hourglass h in keyword format
var s = h.toString();
Include class
Include
Include class
The Include class allows you to access the include files in a model. More...
Class functions
Member functions
Include constants
Name
Description
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.SUBDIR
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()
March 2016
Include
Name
Include class
Description
Include.ENDOFF (read only) Offset applied to Primer post end keywords (Dummy, Mechanism etc.)
Include.IDDOFF (read only) Offset to define ID (used in Include.SetTransformOffset() )
Include.IDEOFF (read only) Offset to element ID (used in Include.SetTransformOffset() )
Include.IDFOFF (read only)
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()
Include properties
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.
fctlen
float
Length transformation factor. Note that this property is not supported for master include file.
fctmas
float
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
float
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
genmin
iddoff (read integer Offset to define ID. To set property use Include.SetTransformOffset(). Note that this property is
only)
not supported for master include file.
ideoff (read integer Offset to element ID. To set property use Include.SetTransformOffset(). Note that this property
only)
is not supported for master include file.
idfoff (read integer Offset to function and table ID. To set property use Include.SetTransformOffset(). Note that this
only)
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 integer Offset to node ID. To set property use Include.SetTransformOffset(). Note that this property is
only)
not supported for master include file.
idpoff (read integer Offset to part, nodal rigid body and constrained node set ID. To set property use
only)
Include.SetTransformOffset(). Note that this property is not supported for master include file.
idroff (read integer Offset to other ID. To set property use Include.SetTransformOffset(). Note that this property is
only)
not supported for master include file.
March 2016
Keywords 925
Include class
Include
idsoff (read integer Offset to set ID. To set property use Include.SetTransformOffset(). Note that this property is not
only)
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
name
string
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
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.
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.
The path for this include file. Note that this property is not supported for master include file.
Also see the file and name properties.
Detailed Description
The Include class allows to create and query include files in a model. See the documentation below for more details.
Constructor
new Include(Model[Model], name[string], parent (optional)[integer])
Description
Create a new Include object.
Arguments
Name
Type
Description
Model
name
string
Include filename
parent (optional) integer Parent include file number. If omitted parent will be 0 (main file).
Return type
Include object
Example
To create a new include file /path/to/include.key in model m
var i = new Include(m, "/path/to/include.key");
Keywords 926
March 2016
Include
Include class
Details of functions
BlankAll(Model[Model], redraw (optional)[boolean], masterInclude
(optional)[boolean]) [static]
Description
Blanks all of the includes in the model.
Arguments
Name
Type
Description
Model
Model
redraw (optional) boolean 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().
masterInclude
(optional)
boolean If masterInclude file should be blanked or not. If omitted masterInclude is false. The
master file is include file number 0.
Return type
No return value
Example
To blank all of the includes in model m:
Include.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the include files in model m flagged with f:
Include.BlankFlagged(m, f);
Keywords 927
Include class
Include
Arguments
Name
Type
Description
flag
Flag
clear contents
(optional)
boolean 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.
Return type
Number of item flags cleared
Example
To clear flag f for include i:
i.ClearFlag(f);
To clear flag f for include i and all of the items inside the include file, returning the number of item flags cleared in the
include file:
var ncleared = i.ClearFlag(f, true);
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for include i:
i.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first include file in the model.
Arguments
Name Type
Description
Return type
Include object (or null if there are no includes in the model).
Keywords 928
March 2016
Include
Include class
Example
To get the first include in model m:
var i = Include.First(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
masterInclude
(optional)
boolean If masterInclude file should be flagged or not. If omitted masterInclude is false. The
master file is include file number 0.
Return type
No return value
Example
To flag all of the includes with flag f in model m:
Include.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the include is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if include i has flag f set on it:
if (i.Flagged(f) ) do_something...
March 2016
Keywords 929
Include class
Include
Arguments
Name
Type
Description
Model
Model
masterInclude
(optional)
boolean If masterInclude file should be included or not. If omitted masterInclude is false. The
master file is include file number 0.
Return type
Array of Include objects
Example
To make an array of Include objects for all of the includes in model m
var i = Include.GetAll(m);
GetDetailedRange(type argument[string])
Description
Gets detailed min and max label ranges for specified type from the include.
Arguments
Name
Type Description
type argument string Entity type for which ranges are returned
Return type
An array containing the min and max label ranges for the specified type.
Example
To get node ranges for include i:
var ranges = i.GetDetailedRange("NODE");
var min = ranges[0];
var max = ranges[1];
Arguments
Name
Type
Description
Model
include number integer number of the include you want the Include object for
Return type
Include object (or null if include does not exist).
Keywords 930
March 2016
Include
Include class
Example
To get the Include object for include 10 in model m
var i = Include.GetFromID(m, 10);
Keyword()
Description
Returns 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.
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for include i:
var key = i.Keyword();
KeywordCards()
Description
Returns 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.
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for include i:
var cards = i.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last include file in the model.
Arguments
Name Type
Description
Return type
Include object (or null if there are no includes in the model).
March 2016
Keywords 931
Include class
Include
Example
To get the last include in model m:
var i = Include.Last(m);
MakeCurrentLayer()
Description
Sets 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.
Arguments
No arguments
Return type
No return value
Example
To make include i the current layer:
i.MakeCurrentLayer();
Modified(listing[boolean])
Description
Returns true if include has been modified.
Arguments
Name Type
Description
listing boolean false for no listing output, true for listing output
Return type
logical
Example
To see if include inc is modified
if(inc.Modified(false)) ... (no listing output)
Next()
Description
Returns the next include in the model. Note that this function is not supported for the master include file.
Arguments
No arguments
Return type
Include object (or null if there are no more includes in the model).
Keywords 932
March 2016
Include
Include class
Example
To get the include in model m after include i:
var i = i.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the include can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Include object (or null if not picked)
Example
To pick an includee from model m giving the prompt Pick include from screen:
var i = Include.Pick(Pick include from screen, m);
Previous()
Description
Returns the previous include in the model. Note that this function is not supported for the master include file.
Arguments
No arguments
Return type
Include object (or null if there are no more includes in the model).
Example
To get the include in model m before include i:
var i = i.Previous();
Keywords 933
Include class
Include
Arguments
Name
Type
Description
flag
Flag
prompt
string
Model
(optional)
Model
modal
(optional)
boolean 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.
Return type
Number of items selected or null if menu cancelled
Example
To select an include from model m, flagging those selected with flag f, giving the prompt Select include:
Include.Select(f, Select include, m);
Arguments
Name
Type
Description
Entity type for which ranges are to be defined
min label
max label
Return type
No return value
Example
To set node ranges for include i:
i.SetDetailedRange("NODE", 50000, 60000);
Arguments
Name
Type
Description
flag
Flag
flag contents
(optional)
boolean If true then the items in the include file will also be flagged. If false (default) then the
include file contents are not flagged.
Keywords 934
March 2016
Include
Include class
Return type
Number of items flagged
Example
To set flag f for include i:
i.SetFlag(f);
To set flag f for include i and all of the items inside the include file, returning the number of items flagged in the include
file:
var nflagged = i.SetFlag(f, true);
Arguments
Name
Type
Description
offset
value
integer
check_only boolean 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
(optional)
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.
Return type
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.
Example
To set idpoff for include i to 1000, checking that the change is successful:
var success = i.SetTransformOffset(Include.IDPOFF, 1000);
Total(Model[Model]) [static]
Description
Returns the total number of include files in the model.
Arguments
Name Type
Description
March 2016
Keywords 935
Include class
Include
Return type
integer
Example
To get the number of include files in model m:
var t = Include.Total(m);
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the includes in model m:
Include.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the include files in model m flagged with f:
Include.UnblankFlagged(m, f);
Keywords 936
March 2016
Include
Include class
Arguments
Name Type
Description
Model Model Model that the defined flag for all includes will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all of the includes in model m:
Include.UnflagAll(m, f);
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for include i:
i.Warning("My custom warning");
March 2016
Keywords 937
Include class
Include
Arguments
Name
Type
Description
filename
string
path
(optional)
constant The method used to write include paths. Can be Include.ABSOLUTE (default) or
Include.RELATIVE
separator
(optional)
constant The directory separator used when writing include files. Can be Include.NATIVE (default),
Include.UNIX or Include.WINDOWS
version
(optional)
string
large
(optional)
boolean If true then large format will be used to write the file. If false (default) then the normal
LS-DYNA format will be used. Note that large format is only available from version R7.1
and above.
The LS-DYNA version used to write the file. Can be "971R5", "971R4", "971R3",
"970v6763" etc. (see the version popup in Model->Write >>> LS-Dyna output options for a
full list). See also Options.dyna_version
Return type
No return value
Example
To write include file i to file /data/test/file.key
i.Write("/data/test/file.key");
toString()
Description
Creates 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.
Arguments
No arguments
Return type
string
Example
To get data for include i in keyword format
var s = i.toString();
Keywords 938
March 2016
Initial
AxialForceBeam class
AxialForceBeam class
The AxialForceBeam class gives you access to initial axial force beam cards in PRIMER. More...
Class functions
First(Model[Model])
FlagAll(Model[Model], flag[Flag])
ForEach(Model[Model], func[function], extra (optional)[any])
GetAll(Model[Model])
GetFlagged(Model[Model], flag[Flag])
GetFromID(Model[Model], number[integer])
Last(Model[Model])
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean])
Total(Model[Model], exists (optional)[boolean])
UnflagAll(Model[Model], flag[Flag])
UnsketchAll(Model[Model], redraw (optional)[boolean])
Member functions
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[axial force beam property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
AxialForceBeam properties
Name
Type
Description
bsid
exists
logical true if axial force beam exists, false if referred to but not defined. (read only)
id (read only) integer ID of the axial force beam. Only used in Primer.
include
integer The Include file number that the axial force beam is in.
lcid
model
integer The Model number that the axial force beam is in.
scale
float
Detailed Description
The AxialForceBeam class allows you to create, modify, edit and manipulate initial axial force beam cards. See the
documentation below for more details.
March 2016
Keywords 939
AxialForceBeam class
Initial
Constructor
new AxialForceBeam(Model[Model], bsid[integer], lcid[integer], scale
(optional)[float])
Description
Create a new AxialForceBeam object.
Arguments
Name
Type
Model
bsid
lcid
Description
Return type
AxialForceBeam object
Example
To create a new axial force beam in model m using beam set 10, load curve 100:
var afb = new AxialForceBeam(m, 10, 100);
Details of functions
ClearFlag(flag[Flag])
Description
Clears a flag on the axial force beam.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for axial force beam afb:
afb.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the axial force beam.
Keywords 940
March 2016
Initial
AxialForceBeam class
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy axial force beam afb into axial force beam z:
var z = afb.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for axial force beam afb:
afb.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first axial force beam in the model.
Arguments
Name Type
Description
Return type
AxialForceBeam object (or null if there are no axial force beams in the model).
Example
To get the first axial force beam in model m:
var afb = AxialForceBeam.First(m);
March 2016
Keywords 941
AxialForceBeam class
Initial
Arguments
Name Type
Description
Model Model Model that all axial force beams will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the axial force beams with flag f in model m:
AxialForceBeam.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the axial force beam is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if axial force beam afb has flag f set on it:
if (afb.Flagged(f) ) do_something...
Keywords 942
March 2016
Initial
AxialForceBeam class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the axial force beams in model m:
AxialForceBeam.ForEach(m, test);
function test(afb)
{
// afb is AxialForceBeam object
}
To call function test for all of the axial force beams in model m with optional object:
var data = { x:0, y:0 };
AxialForceBeam.ForEach(m, test, data);
function test(afb, extra)
{
// afb is AxialForceBeam object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of AxialForceBeam objects for all of the axial force beams in a model in Primer
Arguments
Name Type
Description
Return type
Array of AxialForceBeam objects
Example
To make an array of AxialForceBeam objects for all of the axial force beams in model m
var afb = AxialForceBeam.GetAll(m);
March 2016
Keywords 943
AxialForceBeam class
Initial
Arguments
Name Type
Description
Flag
Flag set on the axial force beams that you want to retrieve
Return type
Array of AxialForceBeam objects
Example
To make an array of AxialForceBeam objects for all of the axial force beams in model m flagged with f
var afb = AxialForceBeam.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the axial force beam you want the AxialForceBeam object for
Return type
AxialForceBeam object (or null if axial force beam does not exist).
Example
To get the AxialForceBeam object for axial force beam 100 in model m
var afb = AxialForceBeam.GetFromID(m, 100);
Arguments
Name Type
prop
Description
axial force beam property axial force beam property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Keywords 944
March 2016
Initial
AxialForceBeam class
Example
To check if AxialForceBeam property afb.example is a parameter:
Options.property_parameter_names = true;
if (afb.GetParameter(afb.example) ) do_something...
Options.property_parameter_names = false;
To check if AxialForceBeam property afb.example is a parameter by using the GetParameter method:
if (afb.ViewParameters().GetParameter(afb.example) ) do_something...
Keyword()
Description
Returns the keyword for this axial force beam (*INITIAL_AXIAL_FORCE_BEAM). Note that a carriage return is
not added. See also AxialForceBeam.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for axial force beam afb:
var key = afb.Keyword();
KeywordCards()
Description
Returns the keyword cards for the axial force beam. Note that a carriage return is not added. See also
AxialForceBeam.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for axial force beam afb:
var cards = afb.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last axial force beam in the model.
Arguments
Name Type
Description
March 2016
Keywords 945
AxialForceBeam class
Initial
Return type
AxialForceBeam object (or null if there are no axial force beams in the model).
Example
To get the last axial force beam in model m:
var afb = AxialForceBeam.Last(m);
Next()
Description
Returns the next axial force beam in the model.
Arguments
No arguments
Return type
AxialForceBeam object (or null if there are no more axial force beams in the model).
Example
To get the axial force beam in model m after axial force beam afb:
var afb = afb.Next();
Previous()
Description
Returns the previous axial force beam in the model.
Arguments
No arguments
Return type
AxialForceBeam object (or null if there are no more axial force beams in the model).
Example
To get the axial force beam in model m before axial force beam afb:
var afb = afb.Previous();
Keywords 946
March 2016
Initial
AxialForceBeam class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only axial force beams from that model can be selected. If the
Flag
argument is a Flag then only axial force beams that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any axial force beams can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of axial force beams selected or null if menu cancelled
Example
To select axial force beams from model m, flagging those selected with flag f, giving the prompt Select axial force
beams:
AxialForceBeam.Select(f, Select axial force beams, m);
To select axial force beams, flagging those selected with flag f but limiting selection to axial force beams flagged with
flag l, giving the prompt Select axial force beams:
AxialForceBeam.Select(f, Select axial force beams, l);
SetFlag(flag[Flag])
Description
Sets a flag on the axial force beam.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for axial force beam afb:
afb.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the axial force beam. The axial force beam will be sketched until you either call AxialForceBeam.Unsketch(),
AxialForceBeam.UnsketchAll(), Model.UnsketchAll(), or delete the model
March 2016
Keywords 947
AxialForceBeam class
Initial
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the axial force beam is sketched. If omitted redraw is
true. If you want to sketch several axial force beams and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch axial force beam afb:
afb.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing axial force beams should be counted. If false or omitted referenced but
undefined axial force beams will also be included in the total.
Return type
number of axial force beams
Example
To get the total number of axial force beams in model m:
var total = AxialForceBeam.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all axial force beams will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the axial force beams in model m:
AxialForceBeam.UnflagAll(m, f);
Keywords 948
March 2016
Initial
AxialForceBeam class
Unsketch(redraw (optional)[boolean])
Description
Unsketches the axial force beam.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the axial force beam is unsketched. If omitted redraw
is true. If you want to unsketch several axial force beams and only redraw after the last one
then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch axial force beam afb:
afb.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the axial force beams 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().
Return type
No return value
Example
To unsketch all axial force beams in model m:
AxialForceBeam.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
AxialForceBeam object.
March 2016
Keywords 949
AxialForceBeam class
Initial
Example
To check if AxialForceBeam property afb.example is a parameter by using the AxialForceBeam.GetParameter()
method:
if (afb.ViewParameters().GetParameter(afb.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for axial force beam afb:
afb.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this axial force beam.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for axial force beam afb:
var xrefs = afb.Xrefs();
toString()
Description
Creates a string containing the axial force data in keyword format. Note that this contains the keyword header and the
keyword cards. See also AxialForceBeam.Keyword() and AxialForceBeam.KeywordCards().
Arguments
No arguments
Return type
string
Keywords 950
March 2016
Initial
AxialForceBeam class
Example
To get data for axial force beam afb in keyword format
var s = afb.toString();
March 2016
Keywords 951
StressSection class
Initial
StressSection class
The StressSection class gives you access to define *INITIAL_STRESS_SECTION cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[stress section property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
StressSection properties
Name
Type
Description
csid
exists
logical true if stress section exists, false if referred to but not defined. (read only)
include integer The Include file number that the stress section is in.
issid
integer StressSection number. Also see the label property which is an alternative name for this.
label
integer StressSection number. Also see the issid property which is an alternative name for this.
lcid
Keywords 952
March 2016
Initial
model
psid
vid
StressSection class
Detailed Description
The StressSection class allows you to create, modify, edit and manipulate initial stress section cards. See the
documentation below for more details.
Constructor
new StressSection(Model[Model], issid[integer], csid[integer], lcid[integer],
psid[integer])
Description
Create a new StressSection object.
Arguments
Name Type
Description
csid
lcid
psid
Return type
StressSection object
Example
To create a new stress section in model m with label 11, cross section 12, load curve 13 and part set 14:
var iss = new StressSection(m, 11, 12, 13, 14);
Details of functions
Blank()
Description
Blanks the stress section
Arguments
No arguments
Return type
No return value
Example
To blank stress section iss:
iss.Blank();
March 2016
Keywords 953
StressSection class
Initial
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the stress sections in model m:
StressSection.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the stress sections in model m flagged with f:
StressSection.BlankFlagged(m, f);
Blanked()
Description
Checks if the stress section is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Keywords 954
March 2016
Initial
StressSection class
Example
To check if stress section iss is blanked:
if (iss.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse stress section iss:
iss.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the stress section.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for stress section iss:
iss.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the stress section.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
March 2016
Keywords 955
StressSection class
Initial
Return type
Return class object
Example
To copy stress section iss into stress section z:
var z = iss.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
StressSection object (or null if not made)
Example
To start creating a initial stress section definition in model m:
var iss = StressSection.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit stress section iss:
iss.Edit();
Keywords 956
March 2016
Initial
StressSection class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for stress section iss:
iss.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first stress section in the model.
Arguments
Name Type
Description
Return type
StressSection object (or null if there are no stress sections in the model).
Example
To get the first stress section in model m:
var iss = StressSection.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
StressSection label.
March 2016
Keywords 957
StressSection class
Initial
Example
To get the first free stress section label in model m:
var label = StressSection.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the stress sections with flag f in model m:
StressSection.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the stress section is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if stress section iss has flag f set on it:
if (iss.Flagged(f) ) do_something...
Keywords 958
March 2016
Initial
StressSection class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the stress sections in model m:
StressSection.ForEach(m, test);
function test(iss)
{
// iss is StressSection object
}
To call function test for all of the stress sections in model m with optional object:
var data = { x:0, y:0 };
StressSection.ForEach(m, test, data);
function test(iss, extra)
{
// iss is StressSection object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of StressSection objects for all of the stress sections in a model in Primer
Arguments
Name Type
Description
Return type
Array of StressSection objects
Example
To make an array of StressSection objects for all of the stress sections in model m
var iss = StressSection.GetAll(m);
March 2016
Keywords 959
StressSection class
Initial
Arguments
Name Type
Description
Flag
Return type
Array of StressSection objects
Example
To make an array of StressSection objects for all of the stress sections in model m flagged with f
var iss = StressSection.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the stress section you want the StressSection object for
Return type
StressSection object (or null if stress section does not exist).
Example
To get the StressSection object for stress section 100 in model m
var iss = StressSection.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Keywords 960
March 2016
Initial
StressSection class
Example
To check if StressSection property iss.example is a parameter:
Options.property_parameter_names = true;
if (iss.GetParameter(iss.example) ) do_something...
Options.property_parameter_names = false;
To check if StressSection property iss.example is a parameter by using the GetParameter method:
if (iss.ViewParameters().GetParameter(iss.example) ) do_something...
Keyword()
Description
Returns the keyword for this stress section. Note that a carriage return is not added. See also
StressSection.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for stress section iss:
var key = iss.Keyword();
KeywordCards()
Description
Returns the keyword cards for the stress section. Note that a carriage return is not added. See also
StressSection.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for stress section iss:
var cards = iss.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last stress section in the model.
Arguments
Name Type
Description
March 2016
Keywords 961
StressSection class
Initial
Return type
StressSection object (or null if there are no stress sections in the model).
Example
To get the last stress section in model m:
var iss = StressSection.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
StressSection label.
Example
To get the last free stress section label in model m:
var label = StressSection.LastFreeLabel(m);
Next()
Description
Returns the next stress section in the model.
Arguments
No arguments
Return type
StressSection object (or null if there are no more stress sections in the model).
Example
To get the stress section in model m after stress section iss:
var iss = iss.Next();
Keywords 962
March 2016
Initial
StressSection class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
StressSection label.
Example
To get the next free stress section label in model m:
var label = StressSection.NextFreeLabel(m);
Previous()
Description
Returns the previous stress section in the model.
Arguments
No arguments
Return type
StressSection object (or null if there are no more stress sections in the model).
Example
To get the stress section in model m before stress section iss:
var iss = iss.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the stress sections in model m, from 1000000:
StressSection.RenumberAll(m, 1000000);
March 2016
Keywords 963
StressSection class
Initial
Arguments
Name Type
Description
Model Model Model that all the flagged stress sections will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the stress sections in model m flagged with f, from 1000000:
StressSection.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only stress sections from that model can be selected. If the
Flag
argument is a Flag then only stress sections that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any stress sections can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of stress sections selected or null if menu cancelled
Example
To select stress sections from model m, flagging those selected with flag f, giving the prompt Select stress sections:
StressSection.Select(f, Select stress sections, m);
To select stress sections, flagging those selected with flag f but limiting selection to stress sections flagged with flag l,
giving the prompt Select stress sections:
StressSection.Select(f, Select stress sections, l);
Keywords 964
March 2016
Initial
StressSection class
SetFlag(flag[Flag])
Description
Sets a flag on the stress section.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for stress section iss:
iss.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the stress section. The stress section will be sketched until you either call StressSection.Unsketch(),
StressSection.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the stress section is sketched. If omitted redraw is true.
If you want to sketch several stress sections and only redraw after the last one then use false
for redraw and call View.Redraw().
Return type
No return value
Example
To sketch stress section iss:
iss.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing stress sections should be counted. If false or omitted referenced but
undefined stress sections will also be included in the total.
Return type
number of stress sections
March 2016
Keywords 965
StressSection class
Initial
Example
To get the total number of stress sections in model m:
var total = StressSection.Total(m);
Unblank()
Description
Unblanks the stress section
Arguments
No arguments
Return type
No return value
Example
To unblank stress section iss:
iss.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the stress sections in model m:
StressSection.UnblankAll(m);
Keywords 966
March 2016
Initial
StressSection class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the stress sections in model m flagged with f:
StressSection.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all stress sections will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the stress sections in model m:
StressSection.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the stress section.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the stress section is unsketched. If omitted redraw is
true. If you want to unsketch several stress sections and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
March 2016
Keywords 967
StressSection class
Initial
Example
To unsketch stress section iss:
iss.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the stress sections 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().
Return type
No return value
Example
To unsketch all stress sections in model m:
StressSection.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
StressSection object.
Example
To check if StressSection property iss.example is a parameter by using the StressSection.GetParameter() method:
if (iss.ViewParameters().GetParameter(iss.example) ) do_something...
Keywords 968
March 2016
Initial
StressSection class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for stress section iss:
iss.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this stress section.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for stress section iss:
var xrefs = iss.Xrefs();
toString()
Description
Creates a string containing the stress section data in keyword format. Note that this contains the keyword header and the
keyword cards. See also StressSection.Keyword() and StressSection.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for stress section iss in keyword format
var s = iss.toString();
March 2016
Keywords 969
StressShell class
Initial
StressShell class
The StressShell class gives you access to define initial stress shell cards in PRIMER. More...
Class functions
First(Model[Model])
FlagAll(Model[Model], flag[Flag])
ForEach(Model[Model], func[function], extra (optional)[any])
GetAll(Model[Model])
GetFlagged(Model[Model], flag[Flag])
GetFromID(Model[Model], number[integer])
Last(Model[Model])
Pick(prompt[string], Model (optional)[Model], modal (optional)[boolean])
Select(flag[Flag], prompt[string], limit (optional)[Model or Flag], modal (optional)[boolean])
Total(Model[Model], exists (optional)[boolean])
UnflagAll(Model[Model], flag[Flag])
UnsketchAll(Model[Model], redraw (optional)[boolean])
Member functions
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetHisvData() [deprecated]
GetIntegrationPoint(index[integer])
GetParameter(prop[initial stress shell property])
GetStressData() [deprecated]
GetTensrData() [deprecated]
GetThermalIntegrationPoint(index[integer])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
SetHisvData() [deprecated]
SetIntegrationPoint(index[integer], data[array])
SetStressData() [deprecated]
SetTensrData() [deprecated]
SetThermalIntegrationPoint(index[integer], data[array])
Sketch(redraw (optional)[boolean])
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
StressShell constants
Name
Description
StressShell.SET
Initial is *INITIAL_STRESS_SHELL_SET.
StressShell properties
Name
Type
Description
eid
integer
exists
logical
true if stress_shell exists, false if referred to but not defined. (read only)
include integer
Keywords 970
The Include file number that the initial stress shell is in.
March 2016
Initial
large
logical
model
integer
nhisv
integer
StressShell class
nplane integer
ntensr
Number of components of tensor data taken from the element history variables stored
integer
nthhsv integer
nthick
integer
nthint
integer
type
Detailed Description
The StressShell class allows you to create, modify, edit and manipulate stress_shell cards. See the documentation below
for more details.
Constructor
new StressShell(Model[Model], type[constant], eid[integer], nplane[integer],
nthick[integer], nhisv[integer], ntensr[integer])
Description
Create a new StressShell object.
Arguments
Name Type
Description
Model Model
type
constant Specify the type of initial stress shell (Can be StressShell.SHELL or StressShell.SET)
eid
integer
nplane integer
nthick integer
nhisv
integer
ntensr integer
Number of components of tensor data taken from the element history variables stored
Return type
StressShell object
Example
To create a new stress_shell in model m, of type SET
var s = new StressShell(m, StressShell.SET, 1, 3, 0, 0);
Details of functions
ClearFlag(flag[Flag])
Description
Clears a flag on the initial stress shell.
March 2016
Keywords 971
StressShell class
Initial
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for initial stress shell iss:
iss.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the initial stress shell.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy initial stress shell iss into initial stress shell z:
var z = iss.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for initial stress shell iss:
iss.Error("My custom error");
Keywords 972
March 2016
Initial
StressShell class
First(Model[Model]) [static]
Description
Returns the first initial stress shell in the model.
Arguments
Name Type
Description
Return type
StressShell object (or null if there are no initial stress shells in the model).
Example
To get the first initial stress shell in model m:
var iss = StressShell.First(m);
Arguments
Name Type
Description
Model Model Model that all initial stress shells will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the initial stress shells with flag f in model m:
StressShell.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the initial stress shell is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
March 2016
Keywords 973
StressShell class
Initial
Example
To check if initial stress shell iss has flag f set on it:
if (iss.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the initial stress shells in model m:
StressShell.ForEach(m, test);
function test(iss)
{
// iss is StressShell object
}
To call function test for all of the initial stress shells in model m with optional object:
var data = { x:0, y:0 };
StressShell.ForEach(m, test, data);
function test(iss, extra)
{
// iss is StressShell object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of StressShell objects for all of the initial stress shells in a model in Primer
Arguments
Name Type
Description
Keywords 974
March 2016
Initial
StressShell class
Return type
Array of StressShell objects
Example
To make an array of StressShell objects for all of the initial stress shells in model m
var iss = StressShell.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the initial stress shells that you want to retrieve
Return type
Array of StressShell objects
Example
To make an array of StressShell objects for all of the initial stress shells in model m flagged with f
var iss = StressShell.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the initial stress shell you want the StressShell object for
Return type
StressShell object (or null if initial stress shell does not exist).
Example
To get the StressShell object for initial stress shell 100 in model m
var iss = StressShell.GetFromID(m, 100);
GetHisvData() [deprecated]
This function is deprecated in version 11.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.
Please use StressShell.GetIntegrationPoint() instead.
March 2016
Keywords 975
StressShell class
Initial
GetIntegrationPoint(index[integer])
Description
Returns the data for a specific integration point as an array. For each integration point there will be 8 + nhisv + (6 x
ntensr) values. There are nplane x nthick integration points.
Arguments
Name Type
Description
index integer Index you want the integration point data for. Note that indices start at 0.
Return type
An array containing the integration point data.
Example
To get the data for the 3rd integration point for initial stress shell iss:
var data = iss.GetIntegrationPoint(2);
Arguments
Name Type
prop
Description
initial stress shell property initial stress shell property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if StressShell property iss.example is a parameter:
Options.property_parameter_names = true;
if (iss.GetParameter(iss.example) ) do_something...
Options.property_parameter_names = false;
To check if StressShell property iss.example is a parameter by using the GetParameter method:
if (iss.ViewParameters().GetParameter(iss.example) ) do_something...
GetStressData() [deprecated]
This function is deprecated in version 11.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.
Please use StressShell.GetIntegrationPoint() instead.
Keywords 976
March 2016
Initial
StressShell class
GetTensrData() [deprecated]
This function is deprecated in version 11.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.
Please use StressShell.GetIntegrationPoint() instead.
GetThermalIntegrationPoint(index[integer])
Description
Returns the thermal data for a specific integration point as an array. For each integration point there will be nthhsv
values. There are nthint integration points.
Arguments
Name Type
Description
index integer Index you want the integration point data for. Note that indices start at 0.
Return type
An array containing the integration point data.
Example
To get the data for the 3rd thermal integration point for initial stress shell iss:
var data = iss.GetThermalIntegrationPoint(2);
Keyword()
Description
Returns the keyword for this initial stress shell (*INITIAL_STRESS_SHELL). Note that a carriage return is not
added. See also StressShell.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for stress_shell i:
var key = i.Keyword();
KeywordCards()
Description
Returns the keyword cards for the initial stress shell. Note that a carriage return is not added. See also
StressShell.Keyword()
Arguments
No arguments
Return type
string containing the cards.
March 2016
Keywords 977
StressShell class
Initial
Example
To get the cards for stress_shell i:
var cards = i.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last initial stress shell in the model.
Arguments
Name Type
Description
Return type
StressShell object (or null if there are no initial stress shells in the model).
Example
To get the last initial stress shell in model m:
var iss = StressShell.Last(m);
Next()
Description
Returns the next initial stress shell in the model.
Arguments
No arguments
Return type
StressShell object (or null if there are no more initial stress shells in the model).
Example
To get the initial stress shell in model m after initial stress shell iss:
var iss = iss.Next();
Keywords 978
March 2016
Initial
StressShell class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the initial stress shell can be picked from any
model.
modal
(optional)
boolean 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.
Return type
StressShell object (or null if not picked)
Example
To pick an initial stress shell from model m giving the prompt Pick stress_shell from screen:
var stress_shell = StressShell.Pick(Pick stress_shell from screen, m);
Previous()
Description
Returns the previous initial stress shell in the model.
Arguments
No arguments
Return type
StressShell object (or null if there are no more initial stress shells in the model).
Example
To get the initial stress shell in model m before initial stress shell iss:
var iss = iss.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only initial stress shells from that model can be selected. If
Flag
the argument is a Flag then only initial stress shells that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any initial stress shells can be selected.
from any model.
modal
(optional)
boolean
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.
March 2016
Keywords 979
StressShell class
Initial
Return type
Number of initial stress shells selected or null if menu cancelled
Example
To select initial stress shells from model m, flagging those selected with flag f, giving the prompt Select initial stress
shells:
StressShell.Select(f, Select initial stress shells, m);
To select initial stress shells, flagging those selected with flag f but limiting selection to initial stress shells flagged with
flag l, giving the prompt Select initial stress shells:
StressShell.Select(f, Select initial stress shells, l);
SetFlag(flag[Flag])
Description
Sets a flag on the initial stress shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for initial stress shell iss:
iss.SetFlag(f);
SetHisvData() [deprecated]
This function is deprecated in version 11.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.
Please use StressShell.SetIntegrationPoint() instead.
SetIntegrationPoint(index[integer], data[array])
Description
Set the data for a specific integration point. For each integration point there will be 8 + nhisv + (6 x ntensr) values.
There are nplane x nthick integration points.
Arguments
Name Type
Description
index integer Index you want the integration point data for. Note that indices start at 0.
data
array
Array containing the integration point data. The array length should be 8 + nhisv + (6 x ntensr).
Return type
No return value.
Keywords 980
March 2016
Initial
StressShell class
Example
To set the 3rd integration point data for initial stress shell iss to the values in array adata:
iss.SetIntegrationPoint(2, adata);
SetStressData() [deprecated]
This function is deprecated in version 11.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.
Please use StressShell.SetIntegrationPoint() instead.
SetTensrData() [deprecated]
This function is deprecated in version 11.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.
Please use StressShell.SetIntegrationPoint() instead.
SetThermalIntegrationPoint(index[integer], data[array])
Description
Set the thermal data for a specific integration point. For each integration point there will be nthhsv values. There are
nthint thermal integration points.
Arguments
Name Type
Description
index integer Index you want the thermal integration point data for. Note that indices start at 0.
data
array
Array containing the thermal integration point data. The array length should be nthint.
Return type
No return value.
Example
To set the 3rd thermal integration point data for initial stress shell iss to the values in array adata:
iss.SetThermalIntegrationPoint(2, adata);
Sketch(redraw (optional)[boolean])
Description
Sketches the initial stress shell. The initial stress shell will be sketched until you either call StressShell.Unsketch(),
StressShell.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the initial stress shell is sketched. If omitted redraw is
true. If you want to sketch several initial stress shells and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
March 2016
Keywords 981
StressShell class
Initial
Example
To sketch initial stress shell iss:
iss.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing initial stress shells should be counted. If false or omitted referenced but
undefined initial stress shells will also be included in the total.
Return type
number of initial stress shells
Example
To get the total number of initial stress shells in model m:
var total = StressShell.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all initial stress shells will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the initial stress shells in model m:
StressShell.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the initial stress shell.
Keywords 982
March 2016
Initial
StressShell class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the initial stress shell is unsketched. If omitted redraw
is true. If you want to unsketch several initial stress shells and only redraw after the last one
then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch initial stress shell iss:
iss.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the initial stress shells 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().
Return type
No return value
Example
To unsketch all initial stress shells in model m:
StressShell.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
StressShell object.
Example
To check if StressShell property iss.example is a parameter by using the StressShell.GetParameter() method:
if (iss.ViewParameters().GetParameter(iss.example) ) do_something...
March 2016
Keywords 983
StressShell class
Initial
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for initial stress shell iss:
iss.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this initial stress shell.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for initial stress shell iss:
var xrefs = iss.Xrefs();
toString()
Description
Creates a string containing the initial stress shell data in keyword format. Note that this contains the keyword header
and the keyword cards. See also StressShell.Keyword() and StressShell.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for stress_shell i in keyword format
var s = i.toString();
Keywords 984
March 2016
Initial
Velocity class
Velocity class
The Velocity class gives you access to define initial velocity cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[initial velocity property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Velocity properties
Name
Type
Description
boxid
exists
logical true if velocity exists, false if referred to but not defined. (read only)
icid
include integer The Include file number that the initial velocity is in.
irigid
model
nsid
float
vxe
float
March 2016
Keywords 985
Velocity class
Initial
vxr
float
vxre
float
vy
float
vye
float
vyr
float
vyre
float
vz
float
vze
float
vzr
float
vzre
float
Detailed Description
The Velocity class allows you to create, modify, edit and manipulate velocity cards. See the documentation below for
more details.
Constructor
new Velocity(Model[Model], nsid[integer], vx[float], vy[float], vz[float],
vxr[float], vyr[float], vzr[float], boxid (optional)[integer], irigid
(optional)[integer], nsidex (optional)[integer], vxe (optional)[float], vye
(optional)[float], vze (optional)[float], vxre (optional)[float], vyre
(optional)[float], vzre (optional)[float], icid (optional)[float])
Description
Create a new Velocity object.
Keywords 986
March 2016
Initial
Velocity class
Arguments
Name
Type
Description
Model
nsid
vx
float
vy
float
vz
float
vxr
float
vyr
float
vzr
float
float
vye (optional)
float
vze (optional)
float
vxre (optional)
float
vyre (optional)
float
vzre (optional)
float
icid (optional)
float
Return type
Velocity object
Example
To create a new velocity in model m
var s = new Velocity(m, 1, 2.4, 3.7, 7.9, 0.0, 0.0, 0.0);
Details of functions
Blank()
Description
Blanks the initial velocity
Arguments
No arguments
Return type
No return value
Example
To blank initial velocity v:
v.Blank();
March 2016
Keywords 987
Velocity class
Initial
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the initial velocities in model m:
Velocity.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the initial velocities in model m flagged with f:
Velocity.BlankFlagged(m, f);
Blanked()
Description
Checks if the initial velocity is blanked or not.
Arguments
No arguments
Keywords 988
March 2016
Initial
Velocity class
Return type
true if blanked, false if not.
Example
To check if initial velocity v is blanked:
if (v.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the initial velocity.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for initial velocity v:
v.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the initial velocity.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy initial velocity v into initial velocity z:
var z = v.Copy();
March 2016
Keywords 989
Velocity class
Initial
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for initial velocity v:
v.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first initial velocity in the model.
Arguments
Name Type
Description
Return type
Velocity object (or null if there are no initial velocities in the model).
Example
To get the first initial velocity in model m:
var v = Velocity.First(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the initial velocities with flag f in model m:
Velocity.FlagAll(m, f);
Keywords 990
March 2016
Initial
Velocity class
Flagged(flag[Flag])
Description
Checks if the initial velocity is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if initial velocity v has flag f set on it:
if (v.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the initial velocities in model m:
Velocity.ForEach(m, test);
function test(v)
{
// v is Velocity object
}
To call function test for all of the initial velocities in model m with optional object:
var data = { x:0, y:0 };
Velocity.ForEach(m, test, data);
function test(v, extra)
{
// v is Velocity object
// extra is data
}
March 2016
Keywords 991
Velocity class
Initial
GetAll(Model[Model]) [static]
Description
Returns an array of Velocity objects for all of the initial velocities in a model in Primer
Arguments
Name Type
Description
Return type
Array of Velocity objects
Example
To make an array of Velocity objects for all of the initial velocities in model m
var v = Velocity.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Velocity objects
Example
To make an array of Velocity objects for all of the initial velocities in model m flagged with f
var v = Velocity.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the initial velocity you want the Velocity object for
Return type
Velocity object (or null if initial velocity does not exist).
Keywords 992
March 2016
Initial
Velocity class
Example
To get the Velocity object for initial velocity 100 in model m
var v = Velocity.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Velocity property v.example is a parameter:
Options.property_parameter_names = true;
if (v.GetParameter(v.example) ) do_something...
Options.property_parameter_names = false;
To check if Velocity property v.example is a parameter by using the GetParameter method:
if (v.ViewParameters().GetParameter(v.example) ) do_something...
Keyword()
Description
Returns the keyword for this initial velocity (*INITIAL_VELOCITY). Note that a carriage return is not added. See
also Velocity.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for velocity i:
var key = i.Keyword();
March 2016
Keywords 993
Velocity class
Initial
KeywordCards()
Description
Returns the keyword cards for the initial velocity. Note that a carriage return is not added. See also
Velocity.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for velocity i:
var cards = i.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last initial velocity in the model.
Arguments
Name Type
Description
Return type
Velocity object (or null if there are no initial velocities in the model).
Example
To get the last initial velocity in model m:
var v = Velocity.Last(m);
Next()
Description
Returns the next initial velocity in the model.
Arguments
No arguments
Return type
Velocity object (or null if there are no more initial velocities in the model).
Example
To get the initial velocity in model m after initial velocity v:
var v = v.Next();
Keywords 994
March 2016
Initial
Velocity class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the initial velocity can be picked from any
model.
modal
(optional)
boolean 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.
Return type
Velocity object (or null if not picked)
Example
To pick an initial velocity from model m giving the prompt Pick velocity from screen:
var velocity = Velocity.Pick(Pick velocity from screen, m);
Previous()
Description
Returns the previous initial velocity in the model.
Arguments
No arguments
Return type
Velocity object (or null if there are no more initial velocities in the model).
Example
To get the initial velocity in model m before initial velocity v:
var v = v.Previous();
March 2016
Keywords 995
Velocity class
Initial
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only initial velocities from that model can be selected. If the
Flag
argument is a Flag then only initial velocities that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any initial velocities can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of initial velocities selected or null if menu cancelled
Example
To select initial velocities from model m, flagging those selected with flag f, giving the prompt Select initial velocities:
Velocity.Select(f, Select initial velocities, m);
To select initial velocities, flagging those selected with flag f but limiting selection to initial velocities flagged with flag
l, giving the prompt Select initial velocities:
Velocity.Select(f, Select initial velocities, l);
SetFlag(flag[Flag])
Description
Sets a flag on the initial velocity.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for initial velocity v:
v.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the initial velocity. The initial velocity will be sketched until you either call Velocity.Unsketch(),
Velocity.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 996
March 2016
Initial
Velocity class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the initial velocity is sketched. If omitted redraw is
true. If you want to sketch several initial velocities and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch initial velocity v:
v.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing initial velocities should be counted. If false or omitted referenced but
undefined initial velocities will also be included in the total.
Return type
number of initial velocities
Example
To get the total number of initial velocities in model m:
var total = Velocity.Total(m);
Unblank()
Description
Unblanks the initial velocity
Arguments
No arguments
Return type
No return value
Example
To unblank initial velocity v:
v.Unblank();
March 2016
Keywords 997
Velocity class
Initial
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the initial velocities in model m:
Velocity.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the initial velocities in model m flagged with f:
Velocity.UnblankFlagged(m, f);
Keywords 998
March 2016
Initial
Velocity class
Arguments
Name Type
Description
Model Model Model that the defined flag for all initial velocities will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the initial velocities in model m:
Velocity.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the initial velocity.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the initial velocity is unsketched. If omitted redraw is
true. If you want to unsketch several initial velocities and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch initial velocity v:
v.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the initial velocities 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().
Return type
No return value
March 2016
Keywords 999
Velocity class
Initial
Example
To unsketch all initial velocities in model m:
Velocity.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Velocity object.
Example
To check if Velocity property v.example is a parameter by using the Velocity.GetParameter() method:
if (v.ViewParameters().GetParameter(v.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for initial velocity v:
v.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this initial velocity.
Arguments
No arguments
Keywords 1000
March 2016
Initial
Velocity class
Return type
Xrefs object.
Example
To get the cross references for initial velocity v:
var xrefs = v.Xrefs();
toString()
Description
Creates a string containing the initial velocity data in keyword format. Note that this contains the keyword header and
the keyword cards. See also Velocity.Keyword() and Velocity.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for velocity i in keyword format
var s = i.toString();
March 2016
Keywords 1001
VelocityGeneration class
Initial
VelocityGeneration class
The VelocityGeneration class gives you access to define initial velocity generation cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[initial velocity generation property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
VelocityGeneration constants
Name
Description
VelocityGeneration.NODE_SET ID is a NODE_SET
VelocityGeneration.PART
ID is a PART
VelocityGeneration.PART_SET ID is a PART_SET
VelocityGeneration properties
Name
Type
Description
exists
logical
true if velocity exists, false if referred to but not defined. (read only)
icid
integer
Keywords 1002
March 2016
Initial
id
integer
VelocityGeneration class
include integer
irigid
integer
ivatn
integer
model
integer
nx
float
x-direction cosine
ny
float
y-direction cosine
nz
float
z-direction cosine
omega float
phase
integer
type
vx
float
vy
float
vz
float
xc
float
yc
float
zc
float
Detailed Description
The VelocityGeneration class allows you to create, modify, edit and manipulate velocity cards. See the documentation
below for more details.
Constructor
new VelocityGeneration(Model[Model], type[constant], id[integer],
omega[float], vx[float], vy[float], vz[float], ivatn[integer], xc[float], yc[float],
zc[float], nx[float], ny[float], nz[float], phase[integer], irigid[integer],
icid[integer])
Description
Create a new VelocityGeneration object.
March 2016
Keywords 1003
VelocityGeneration class
Initial
Arguments
Name Type
Description
Model Model
type
id
integer
omega float
vx
float
vy
float
vz
float
ivatn
integer
xc
float
yc
float
zc
float
nx
float
x-direction cosine
ny
float
y-direction cosine
nz
float
z-direction cosine
phase integer
irigid
integer
icid
integer
Return type
VelocityGeneration object
Example
To create a new velocity in model m
var s = new VelocityGeneration(m, VelocityGeneration.PART, 500, 3.4, 2.4, 3.7,
7.9, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1, 0);
Details of functions
Blank()
Description
Blanks the initial velocity generation
Arguments
No arguments
Return type
No return value
Example
To blank initial velocity generation ivg:
ivg.Blank();
Keywords 1004
March 2016
Initial
VelocityGeneration class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the initial velocity generations in model m:
VelocityGeneration.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged initial velocity generations will be blanked in
flag
Flag
Flag set on the initial velocity generations that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the initial velocity generations in model m flagged with f:
VelocityGeneration.BlankFlagged(m, f);
Blanked()
Description
Checks if the initial velocity generation is blanked or not.
Arguments
No arguments
March 2016
Keywords 1005
VelocityGeneration class
Initial
Return type
true if blanked, false if not.
Example
To check if initial velocity generation ivg is blanked:
if (ivg.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse initial velocity generation ivg:
ivg.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the initial velocity generation.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for initial velocity generation ivg:
ivg.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the initial velocity generation.
Keywords 1006
March 2016
Initial
VelocityGeneration class
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy initial velocity generation ivg into initial velocity generation z:
var z = ivg.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
VelocityGeneration object (or null if not made)
Example
To start creating an initial velocity generation definition in model m:
var v = VelocityGeneration.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit initial velocity generation ivg:
ivg.Edit();
March 2016
Keywords 1007
VelocityGeneration class
Initial
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for initial velocity generation ivg:
ivg.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first initial velocity generation in the model.
Arguments
Name Type
Description
Return type
VelocityGeneration object (or null if there are no initial velocity generations in the model).
Example
To get the first initial velocity generation in model m:
var ivg = VelocityGeneration.First(m);
Arguments
Name Type
Description
Model Model Model that all initial velocity generations will be flagged in
flag
Flag
Return type
No return value
Keywords 1008
March 2016
Initial
VelocityGeneration class
Example
To flag all of the initial velocity generations with flag f in model m:
VelocityGeneration.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the initial velocity generation is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if initial velocity generation ivg has flag f set on it:
if (ivg.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 1009
VelocityGeneration class
Initial
Example
To call function test for all of the initial velocity generations in model m:
VelocityGeneration.ForEach(m, test);
function test(ivg)
{
// ivg is VelocityGeneration object
}
To call function test for all of the initial velocity generations in model m with optional object:
var data = { x:0, y:0 };
VelocityGeneration.ForEach(m, test, data);
function test(ivg, extra)
{
// ivg is VelocityGeneration object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of VelocityGeneration objects for all of the initial velocity generations in a model in Primer
Arguments
Name Type
Description
Return type
Array of VelocityGeneration objects
Example
To make an array of VelocityGeneration objects for all of the initial velocity generations in model m
var ivg = VelocityGeneration.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the initial velocity generations that you want to retrieve
Return type
Array of VelocityGeneration objects
Example
To make an array of VelocityGeneration objects for all of the initial velocity generations in model m flagged with f
var ivg = VelocityGeneration.GetFlagged(m, f);
Keywords 1010
March 2016
Initial
VelocityGeneration class
Arguments
Name
Type
Description
Model
number integer number of the initial velocity generation you want the VelocityGeneration object for
Return type
VelocityGeneration object (or null if initial velocity generation does not exist).
Example
To get the VelocityGeneration object for initial velocity generation 100 in model m
var ivg = VelocityGeneration.GetFromID(m, 100);
Arguments
Name Type
prop
Description
initial velocity generation property initial velocity generation property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if VelocityGeneration property ivg.example is a parameter:
Options.property_parameter_names = true;
if (ivg.GetParameter(ivg.example) ) do_something...
Options.property_parameter_names = false;
To check if VelocityGeneration property ivg.example is a parameter by using the GetParameter method:
if (ivg.ViewParameters().GetParameter(ivg.example) ) do_something...
Keyword()
Description
Returns the keyword for this initial velocity (*INITIAL_VELOCITY_GENERATION). Note that a carriage return is
not added. See also VelocityGeneration.KeywordCards()
March 2016
Keywords 1011
VelocityGeneration class
Initial
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for velocity i:
var key = i.Keyword();
KeywordCards()
Description
Returns the keyword cards for the initial velocity_generation. Note that a carriage return is not added. See also
VelocityGeneration.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for velocity i:
var cards = i.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last initial velocity generation in the model.
Arguments
Name Type
Description
Return type
VelocityGeneration object (or null if there are no initial velocity generations in the model).
Example
To get the last initial velocity generation in model m:
var ivg = VelocityGeneration.Last(m);
Next()
Description
Returns the next initial velocity generation in the model.
Keywords 1012
March 2016
Initial
VelocityGeneration class
Arguments
No arguments
Return type
VelocityGeneration object (or null if there are no more initial velocity generations in the model).
Example
To get the initial velocity generation in model m after initial velocity generation ivg:
var ivg = ivg.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the initial velocity can be picked from any
model.
modal
(optional)
boolean 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.
Return type
VelocityGeneration object (or null if not picked)
Example
To pick an initial velocity from model m giving the prompt Pick velocity from screen:
var velocity = VelocityGeneration.Pick(Pick velocity from screen, m);
Previous()
Description
Returns the previous initial velocity generation in the model.
Arguments
No arguments
Return type
VelocityGeneration object (or null if there are no more initial velocity generations in the model).
Example
To get the initial velocity generation in model m before initial velocity generation ivg:
var ivg = ivg.Previous();
March 2016
Keywords 1013
VelocityGeneration class
Initial
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only initial velocity generations from that model can be
Flag
selected. If the argument is a Flag then only initial velocity generations that are flagged with
limit can be selected (limit should be different to flag). If omitted, or null, any initial velocity
generations can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of initial velocity generations selected or null if menu cancelled
Example
To select initial velocity generations from model m, flagging those selected with flag f, giving the prompt Select initial
velocity generations:
VelocityGeneration.Select(f, Select initial velocity generations, m);
To select initial velocity generations, flagging those selected with flag f but limiting selection to initial velocity
generations flagged with flag l, giving the prompt Select initial velocity generations:
VelocityGeneration.Select(f, Select initial velocity generations, l);
SetFlag(flag[Flag])
Description
Sets a flag on the initial velocity generation.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for initial velocity generation ivg:
ivg.SetFlag(f);
Keywords 1014
March 2016
Initial
VelocityGeneration class
Sketch(redraw (optional)[boolean])
Description
Sketches the initial velocity generation. The initial velocity generation will be sketched until you either call
VelocityGeneration.Unsketch(), VelocityGeneration.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the initial velocity generation is sketched. If omitted
redraw is true. If you want to sketch several initial velocity generations and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch initial velocity generation ivg:
ivg.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing initial velocity generations should be counted. If false or omitted
referenced but undefined initial velocity generations will also be included in the total.
Return type
number of initial velocity generations
Example
To get the total number of initial velocity generations in model m:
var total = VelocityGeneration.Total(m);
Unblank()
Description
Unblanks the initial velocity generation
Arguments
No arguments
Return type
No return value
March 2016
Keywords 1015
VelocityGeneration class
Initial
Example
To unblank initial velocity generation ivg:
ivg.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the initial velocity generations in model m:
VelocityGeneration.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the initial velocity generations that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the initial velocity generations in model m flagged with f:
VelocityGeneration.UnblankFlagged(m, f);
March 2016
Initial
VelocityGeneration class
Arguments
Name Type
Description
Model Model Model that the defined flag for all initial velocity generations will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the initial velocity generations in model m:
VelocityGeneration.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the initial velocity generation.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the initial velocity generation is unsketched. If omitted
redraw is true. If you want to unsketch several initial velocity generations and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch initial velocity generation ivg:
ivg.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the initial velocity generations 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().
Return type
No return value
March 2016
Keywords 1017
VelocityGeneration class
Initial
Example
To unsketch all initial velocity generations in model m:
VelocityGeneration.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
VelocityGeneration object.
Example
To check if VelocityGeneration property ivg.example is a parameter by using the VelocityGeneration.GetParameter()
method:
if (ivg.ViewParameters().GetParameter(ivg.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for initial velocity generation ivg:
ivg.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this initial velocity generation.
Arguments
No arguments
Keywords 1018
March 2016
Initial
VelocityGeneration class
Return type
Xrefs object.
Example
To get the cross references for initial velocity generation ivg:
var xrefs = ivg.Xrefs();
toString()
Description
Creates a string containing the initial velocity data in keyword format. Note that this contains the keyword header and
the keyword cards. See also VelocityGeneration.Keyword() and VelocityGeneration.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for velocity i in keyword format
var s = i.toString();
March 2016
Keywords 1019
Integration
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetIntegrationPoint(index[integer])
GetNipCard() [deprecated]
GetParameter(prop[integration beam property])
GetSectionData() [deprecated]
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
SetIntegrationPoint(index[integer], s[float], t[float], wf[float], pid(optional)[integer])
SetNipCard() [deprecated]
SetSectionData() [deprecated]
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
IntegrationBeam properties
Name
Type
Description
d1
float
Cross-section dimension.
d2
float
Cross-section dimension.
d3
float
Cross-section dimension.
d4
float
Cross-section dimension.
exists
logical true if intb exists, false if referred to but not defined. (read only)
icst
include integer The Include file number that the intb is in.
irid
Keywords 1020
March 2016
Integration
model
nip
pid
Part
Optional part ID if different from the PID specified on the element card.
ra
float
float
sref
float
float
tref
float
wf
float
Weighting factor (area associated with integration point divided by actual cross sectional area).
Detailed Description
The IntegrationBeam class allows you to create, modify, edit and manipulate integration beam cards. See the
documentation below for more details.
For convenience "IntB" can also be used as the class name instead of "IntegrationBeam".
Constructor
new IntegrationBeam(Model[Model], irid[integer], nip (optional)[integer],
ra[float (optional)], icst (optional)[integer], k (optional)[integer])
Description
Create a new IntegrationBeam object.
Arguments
Name
Type
Description
Model
Model
irid
integer
Integration_Beam ID.
ra
float
(optional)
icst
(optional)
integer
k (optional)
integer
Integration refinement parameter for standard cross section types. If omitted k will be
0.
Return type
IntegrationBeam object
Example
To create a new intgb 1000 in model m with the following specifiction: irid, nip, ra, icst, k are 1000, 2, 0.1, 3, 5
respectively
var w = new IntegrationBeam(m, 1000, 2, 0.1, 3, 5);
March 2016
Keywords 1021
Integration
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse integration beam ib:
ib.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the integration beam.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for integration beam ib:
ib.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the integration beam.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Keywords 1022
March 2016
Integration
Example
To copy integration beam ib into integration beam z:
var z = ib.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
IntegrationBeam object (or null if not made)
Example
To start creating a intb n in model m:
var n = IntegrationBeam.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit integration beam ib:
ib.Edit();
March 2016
Keywords 1023
Integration
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for integration beam ib:
ib.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first integration beam in the model.
Arguments
Name Type
Description
Return type
IntegrationBeam object (or null if there are no integration beams in the model).
Example
To get the first integration beam in model m:
var ib = IntegrationBeam.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
IntegrationBeam label.
Keywords 1024
March 2016
Integration
Example
To get the first free integration beam label in model m:
var label = IntegrationBeam.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the integration beams with flag f in model m:
IntegrationBeam.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the integration beam is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if integration beam ib has flag f set on it:
if (ib.Flagged(f) ) do_something...
March 2016
Keywords 1025
Integration
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the integration beams in model m:
IntegrationBeam.ForEach(m, test);
function test(ib)
{
// ib is IntegrationBeam object
}
To call function test for all of the integration beams in model m with optional object:
var data = { x:0, y:0 };
IntegrationBeam.ForEach(m, test, data);
function test(ib, extra)
{
// ib is IntegrationBeam object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of IntegrationBeam objects for all of the integration beams in a model in Primer
Arguments
Name Type
Description
Return type
Array of IntegrationBeam objects
Example
To make an array of IntegrationBeam objects for all of the integration beams in model m
var ib = IntegrationBeam.GetAll(m);
Keywords 1026
March 2016
Integration
Arguments
Name Type
Description
Flag
Return type
Array of IntegrationBeam objects
Example
To make an array of IntegrationBeam objects for all of the integration beams in model m flagged with f
var ib = IntegrationBeam.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the integration beam you want the IntegrationBeam object for
Return type
IntegrationBeam object (or null if integration beam does not exist).
Example
To get the IntegrationBeam object for integration beam 100 in model m
var ib = IntegrationBeam.GetFromID(m, 100);
GetIntegrationPoint(index[integer])
Description
Returns the data for an integration point in *INTEGRATION_BEAM.Note data is only available when NIP>0.
Arguments
Name Type
Description
index integer Index you want the integration point data for. Note that indices start at 0.
Return type
An array containing the integration point data.
Example
To get the data for the 3rd integration point for integration beam ib:
var data = ib.GetIntegrationPoint(2);
March 2016
Keywords 1027
Integration
GetNipCard() [deprecated]
This function is deprecated in version 11.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.
Please use IntegrationBeam.GetIntegrationPoint() instead.
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if IntegrationBeam property ib.example is a parameter:
Options.property_parameter_names = true;
if (ib.GetParameter(ib.example) ) do_something...
Options.property_parameter_names = false;
To check if IntegrationBeam property ib.example is a parameter by using the GetParameter method:
if (ib.ViewParameters().GetParameter(ib.example) ) do_something...
GetSectionData() [deprecated]
This function is deprecated in version 11.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.
Use properties d1, d2, sref etc to get the section data.
Keyword()
Description
Returns the keyword for this intb (*INTEGRATION_BEAM). Note that a carriage return is not added. See also
IntegrationBeam.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Keywords 1028
March 2016
Integration
Example
To get the keyword for intb n:
var key = n.Keyword();
KeywordCards()
Description
Returns the keyword cards for the intb. Note that a carriage return is not added. See also
IntegrationBeam.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for intb n:
var cards = n.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last integration beam in the model.
Arguments
Name Type
Description
Return type
IntegrationBeam object (or null if there are no integration beams in the model).
Example
To get the last integration beam in model m:
var ib = IntegrationBeam.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
March 2016
Keywords 1029
Integration
Return type
IntegrationBeam label.
Example
To get the last free integration beam label in model m:
var label = IntegrationBeam.LastFreeLabel(m);
Next()
Description
Returns the next integration beam in the model.
Arguments
No arguments
Return type
IntegrationBeam object (or null if there are no more integration beams in the model).
Example
To get the integration beam in model m after integration beam ib:
var ib = ib.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
IntegrationBeam label.
Example
To get the next free integration beam label in model m:
var label = IntegrationBeam.NextFreeLabel(m);
Previous()
Description
Returns the previous integration beam in the model.
Keywords 1030
March 2016
Integration
Arguments
No arguments
Return type
IntegrationBeam object (or null if there are no more integration beams in the model).
Example
To get the integration beam in model m before integration beam ib:
var ib = ib.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the integration beams in model m, from 1000000:
IntegrationBeam.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged integration beams will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the integration beams in model m flagged with f, from 1000000:
IntegrationBeam.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 1031
Integration
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only integration beams from that model can be selected. If the
Flag
argument is a Flag then only integration beams that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any integration beams can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of integration beams selected or null if menu cancelled
Example
To select integration beams from model m, flagging those selected with flag f, giving the prompt Select integration
beams:
IntegrationBeam.Select(f, Select integration beams, m);
To select integration beams, flagging those selected with flag f but limiting selection to integration beams flagged with
flag l, giving the prompt Select integration beams:
IntegrationBeam.Select(f, Select integration beams, l);
SetFlag(flag[Flag])
Description
Sets a flag on the integration beam.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for integration beam ib:
ib.SetFlag(f);
Keywords 1032
March 2016
Integration
Arguments
Name
Type
Description
index
integer Index you want to set the integration point data for. Note that indices start at 0.
float
float
wf
float
Weighting factor, area associated with the integration point divided by actual beam cross
sectional area.
pid(optional) integer Optional part ID if different from the PID specified on the element card.
Return type
No return value.
Example
To set the 4th integration point for *INTEGRATION_BEAM ib to the following specifiction: s, t, wf, pid are 0.1, 0.2,
0.3, 1 respectively
ib.SetIntegrationPoint(3, 0.1, 0.2, 0.3, 1);
SetNipCard() [deprecated]
This function is deprecated in version 11.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.
Please use IntegrationBeam.SetIntegrationPoint() instead.
SetSectionData() [deprecated]
This function is deprecated in version 11.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.
Use properties d1, d2, sref etc to set the section data.
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing integration beams should be counted. If false or omitted referenced but
undefined integration beams will also be included in the total.
Return type
number of integration beams
March 2016
Keywords 1033
Integration
Example
To get the total number of integration beams in model m:
var total = IntegrationBeam.Total(m);
Arguments
Name Type
Description
Model Model Model that the defined flag for all integration beams will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the integration beams in model m:
IntegrationBeam.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
IntegrationBeam object.
Example
To check if IntegrationBeam property ib.example is a parameter by using the IntegrationBeam.GetParameter() method:
if (ib.ViewParameters().GetParameter(ib.example) ) do_something...
Keywords 1034
March 2016
Integration
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for integration beam ib:
ib.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this integration beam.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for integration beam ib:
var xrefs = ib.Xrefs();
toString()
Description
Creates a string containing the intb data in keyword format. Note that this contains the keyword header and the keyword
cards. See also IntegrationBeam.Keyword() and IntegrationBeam.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for intb n in keyword format
var s = n.toString();
March 2016
Keywords 1035
Integration
Class functions
Member functions
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetIntegrationPoint(index[integer])
GetNipCard() [deprecated]
GetParameter(prop[integration shell property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
SetIntegrationPoint(index[integer], s[float], wf[float], pid(optional)[integer])
SetNipCard() [deprecated]
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
IntegrationShell properties
Name
Type
Description
esop
exists
logical true if ints exists, false if referred to but not defined. (read only)
model
nip
pid
Part
Optional part ID if different from the PID specified on the element card.
float
wf
float
Weighting factor (thickness associated with integration point divided by actual shell thickness).
Keywords 1036
March 2016
Integration
Detailed Description
The IntegrationShell class allows you to create, modify, edit and manipulate integration shell cards. See the
documentation below for more details.
For convenience "IntS" can also be used as the class name instead of "IntegrationShell".
Constructor
new IntegrationShell(Model[Model], irid[integer], nip[integer], esop
(optional)[integer], failopt (optional)[integer])
Description
Create a new IntegrationShell object.
Arguments
Name
Type
Description
Model
irid
nip
esop (optional)
failopt (optional) integer Treatment of failure when mixing different constitutive types. If omitted failopt will be 0.
Return type
IntegrationShell object
Example
To create a new ints 1000 in model m with the following specifiction: irid, nip, esop, failopt are 1000, 2, 0, 1
respectively
var w = new IntegrationBeam(m, 1000, 2, 0, 1);
Details of functions
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse integration shell is:
is.Browse();
March 2016
Keywords 1037
Integration
ClearFlag(flag[Flag])
Description
Clears a flag on the integration shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for integration shell is:
is.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the integration shell.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy integration shell is into integration shell z:
var z = is.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
IntegrationShell object (or null if not made)
Keywords 1038
March 2016
Integration
Example
To start creating an integration shell is in model m:
var is = IntegrationShell.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit integration shell is:
is.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for integration shell is:
is.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first integration shell in the model.
March 2016
Keywords 1039
Integration
Arguments
Name Type
Description
Return type
IntegrationShell object (or null if there are no integration shells in the model).
Example
To get the first integration shell in model m:
var is = IntegrationShell.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
IntegrationShell label.
Example
To get the first free integration shell label in model m:
var label = IntegrationShell.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 1040
March 2016
Integration
Example
To flag all of the integration shells with flag f in model m:
IntegrationShell.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the integration shell is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if integration shell is has flag f set on it:
if (is.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 1041
Integration
Example
To call function test for all of the integration shells in model m:
IntegrationShell.ForEach(m, test);
function test(is)
{
// is is IntegrationShell object
}
To call function test for all of the integration shells in model m with optional object:
var data = { x:0, y:0 };
IntegrationShell.ForEach(m, test, data);
function test(is, extra)
{
// is is IntegrationShell object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of IntegrationShell objects for all of the integration shells in a model in Primer
Arguments
Name Type
Description
Return type
Array of IntegrationShell objects
Example
To make an array of IntegrationShell objects for all of the integration shells in model m
var is = IntegrationShell.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of IntegrationShell objects
Example
To make an array of IntegrationShell objects for all of the integration shells in model m flagged with f
var is = IntegrationShell.GetFlagged(m, f);
Keywords 1042
March 2016
Integration
Arguments
Name
Type
Description
Model
number integer number of the integration shell you want the IntegrationShell object for
Return type
IntegrationShell object (or null if integration shell does not exist).
Example
To get the IntegrationShell object for integration shell 100 in model m
var is = IntegrationShell.GetFromID(m, 100);
GetIntegrationPoint(index[integer])
Description
Returns the data for an integration point in *INTEGRATION_SHELL.Note data is only available when NIP>0 and
ESOP=0.
Arguments
Name Type
Description
index integer Index you want the integration point data for. Note that indices start at 0.
Return type
An array containing the integration point data.
Example
To get the data for the 3rd integration point for integration shell:
var data = is.GetIntegrationPoint(2);
GetNipCard() [deprecated]
This function is deprecated in version 11.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.
Please use IntegrationShell.GetIntegrationPoint() instead.
March 2016
Keywords 1043
Integration
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if IntegrationShell property is.example is a parameter:
Options.property_parameter_names = true;
if (is.GetParameter(is.example) ) do_something...
Options.property_parameter_names = false;
To check if IntegrationShell property is.example is a parameter by using the GetParameter method:
if (is.ViewParameters().GetParameter(is.example) ) do_something...
Keyword()
Description
Returns the keyword for this ints (*INTEGRATION_SHELL). Note that a carriage return is not added. See also
IntegrationShell.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for ints n:
var key = n.Keyword();
KeywordCards()
Description
Returns the keyword cards for the ints. Note that a carriage return is not added. See also IntegrationShell.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for integration shell is:
var cards = is.KeywordCards();
Keywords 1044
March 2016
Integration
Last(Model[Model]) [static]
Description
Returns the last integration shell in the model.
Arguments
Name Type
Description
Return type
IntegrationShell object (or null if there are no integration shells in the model).
Example
To get the last integration shell in model m:
var is = IntegrationShell.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
IntegrationShell label.
Example
To get the last free integration shell label in model m:
var label = IntegrationShell.LastFreeLabel(m);
Next()
Description
Returns the next integration shell in the model.
Arguments
No arguments
Return type
IntegrationShell object (or null if there are no more integration shells in the model).
March 2016
Keywords 1045
Integration
Example
To get the integration shell in model m after integration shell is:
var is = is.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
IntegrationShell label.
Example
To get the next free integration shell label in model m:
var label = IntegrationShell.NextFreeLabel(m);
Previous()
Description
Returns the previous integration shell in the model.
Arguments
No arguments
Return type
IntegrationShell object (or null if there are no more integration shells in the model).
Example
To get the integration shell in model m before integration shell is:
var is = is.Previous();
Keywords 1046
March 2016
Integration
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the integration shells in model m, from 1000000:
IntegrationShell.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged integration shells will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the integration shells in model m flagged with f, from 1000000:
IntegrationShell.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 1047
Integration
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only integration shells from that model can be selected. If the
Flag
argument is a Flag then only integration shells that are flagged with limit can be selected
(limit should be different to flag). If omitted, or null, any integration shells can be selected.
from any model.
modal
(optional)
boolean
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.
Return type
Number of integration shells selected or null if menu cancelled
Example
To select integration shells from model m, flagging those selected with flag f, giving the prompt Select integration
shells:
IntegrationShell.Select(f, Select integration shells, m);
To select integration shells, flagging those selected with flag f but limiting selection to integration shells flagged with
flag l, giving the prompt Select integration shells:
IntegrationShell.Select(f, Select integration shells, l);
SetFlag(flag[Flag])
Description
Sets a flag on the integration shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for integration shell is:
is.SetFlag(f);
Keywords 1048
March 2016
Integration
Arguments
Name
Type
Description
index
integer Index you want to set the integration point data for. Note that indices start at 0.
float
wf
float
Weighting factor, thickness associated with the integration point divided by actual shell
thickness.
pid(optional) integer Optional part ID if different from the PID specified on the element card.
Return type
No return value.
Example
To set the 4th integration point for *INTEGRATION_SHELL is to the following specifiction: s, wf, pid are 0.1, 0.2, 1
respectively
is.SetIntegrationPoint(3, 0.1, 0.2, 1);
SetNipCard() [deprecated]
This function is deprecated in version 11.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.
Please use IntegrationShell.SetIntegrationPoint() instead.
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing integration shells should be counted. If false or omitted referenced but
undefined integration shells will also be included in the total.
Return type
number of integration shells
Example
To get the total number of integration shells in model m:
var total = IntegrationShell.Total(m);
March 2016
Keywords 1049
Integration
Arguments
Name Type
Description
Model Model Model that the defined flag for all integration shells will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the integration shells in model m:
IntegrationShell.UnflagAll(m, f);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
IntegrationShell object.
Example
To check if IntegrationShell property is.example is a parameter by using the IntegrationShell.GetParameter() method:
if (is.ViewParameters().GetParameter(is.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for integration shell is:
is.Warning("My custom warning");
Keywords 1050
March 2016
Integration
Xrefs()
Description
Returns the cross references for this integration shell.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for integration shell is:
var xrefs = is.Xrefs();
toString()
Description
Creates a string containing the ints data in keyword format. Note that this contains the keyword header and the keyword
cards. See also IntegrationShell.Keyword() and IntegrationShell.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for integration shell is in keyword format
var s = is.toString();
March 2016
Keywords 1051
LoadBody class
Load
LoadBody class
The LoadBody class gives you access to *LOAD_BODY cards in PRIMER. More...
LoadBody properties
Name Type
Description
parts
rx
ry
rz
Type
Description
cid
exists
include integer The Include file number that the LoadBody card is in.
lcid
lciddr
psid
sf
float
v1
float
X-component of Vector
v2
float
Y-component of Vector
v3
float
Z-component of Vector
xc
float
yc
float
zc
float
Detailed Description
The LoadBody class allows you to create, modify, edit and manipulate *LOAD_BODY cards. Unlike other classes
there is no constructor and there are no functions. Instead a LoadBody object is available as the loadBody property of a
Model object. This object allows you to access all of the *LOAD_BODY cards.
For example, to activate *LOAD_BODY_X in model m and set lcid to 1.
m.loadBody.x.exists = true;
m.loadBody.x.lcid = 1;
See the properties for more details.
Keywords 1052
March 2016
Load
LoadBodyGeneralized class
LoadBodyGeneralized class
The LoadBodyGeneralized class gives you access to define load body generalized cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[load body generalized property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
LoadBodyGeneralized constants
Name
Description
LoadBodyGeneralized.NODE
Load is *LOAD_BODY_GENERALIZED.
LoadBodyGeneralized properties
Name
Type
Description
angtyp string
ax
float
ay
float
March 2016
Keywords 1053
LoadBodyGeneralized class
Load
az
float
cid
integer
drlcid
float
exists
logical
true if load body generalized exists, false if referred to but not defined. (read only)
include integer
The Include file number that the load body generalized is in.
lcid
integer
Curve ID
model
integer
n1
integer
Beginning Node ID for body force load or the node or Part set ID
n2
integer
Ending Node ID for body force load. Set to zero if a set ID is defined
omx
float
omy
float
omz
float
type
xc
float
X-center of rotation
yc
float
Y-center of rotation
zc
float
Z-center of rotation
Detailed Description
The LoadBodyGeneralized class allows you to create, modify, edit and manipulate load body generalized cards. See the
documentation below for more details.
Constructor
new LoadBodyGeneralized(Model[Model], type[constant], n1[integer],
n2[integer], lcid[integer], drlcid (optional)[integer], xc (optional)[float], yc
(optional)[float], zc (optional)[float], ax (optional)[float], ay (optional)[float], az
(optional)[float], omx (optional)[float], omy (optional)[float], omz
(optional)[float], cid (optional)[integer], angtyp (optional)[string])
Description
Create a new LoadBodyGeneralized object.
Keywords 1054
March 2016
Load
LoadBodyGeneralized class
Arguments
Name
Type
Description
Model
Model
type
n1
integer
Beginning Node ID for body force load or the node or Part set ID
n2
integer
Ending Node ID for body force load. Set to zero if a set ID is defined
lcid
integer
Curve ID
drlcid
(optional)
integer
xc (optional) float
X-center of rotation
yc (optional) float
Y-center of rotation
zc (optional) float
Z-center of rotation
ax (optional) float
ay (optional) float
az (optional) float
omx
(optional)
float
omy
(optional)
float
omz
(optional)
float
cid
(optional)
integer
angtyp
(optional)
string
Return type
LoadBodyGeneralized object
Example
To create a new load body generalized in model m, of type SET_NODE, with LCID 9 and N2 is 2
var b = new LoadBodyGeneralized(m, LoadBodyGeneralized.SET_NODE, 100, 2, 9);
Details of functions
Blank()
Description
Blanks the load body generalized
Arguments
No arguments
Return type
No return value
March 2016
Keywords 1055
LoadBodyGeneralized class
Load
Example
To blank load body generalized lbg:
lbg.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the load body generalizeds in model m:
LoadBodyGeneralized.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
Model that all the flagged load body generalizeds will be blanked in
flag
Flag
Flag set on the load body generalizeds that you want to blank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the load body generalizeds in model m flagged with f:
LoadBodyGeneralized.BlankFlagged(m, f);
Blanked()
Description
Checks if the load body generalized is blanked or not.
Keywords 1056
March 2016
Load
LoadBodyGeneralized class
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if load body generalized lbg is blanked:
if (lbg.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the load body generalized.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for load body generalized lbg:
lbg.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the load body generalized.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy load body generalized lbg into load body generalized z:
var z = lbg.Copy();
Keywords 1057
LoadBodyGeneralized class
Load
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for load body generalized lbg:
lbg.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first load body generalized in the model.
Arguments
Name Type
Description
Return type
LoadBodyGeneralized object (or null if there are no load body generalizeds in the model).
Example
To get the first load body generalized in model m:
var lbg = LoadBodyGeneralized.First(m);
Arguments
Name Type
Description
Model Model Model that all load body generalizeds will be flagged in
flag
Flag
Return type
No return value
Example
To flag all of the load body generalizeds with flag f in model m:
LoadBodyGeneralized.FlagAll(m, f);
Keywords 1058
March 2016
Load
LoadBodyGeneralized class
Flagged(flag[Flag])
Description
Checks if the load body generalized is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if load body generalized lbg has flag f set on it:
if (lbg.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 1059
LoadBodyGeneralized class
Load
Example
To call function test for all of the load body generalizeds in model m:
LoadBodyGeneralized.ForEach(m, test);
function test(lbg)
{
// lbg is LoadBodyGeneralized object
}
To call function test for all of the load body generalizeds in model m with optional object:
var data = { x:0, y:0 };
LoadBodyGeneralized.ForEach(m, test, data);
function test(lbg, extra)
{
// lbg is LoadBodyGeneralized object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of LoadBodyGeneralized objects for all of the load body generalizeds in a model in Primer
Arguments
Name Type
Description
Return type
Array of LoadBodyGeneralized objects
Example
To make an array of LoadBodyGeneralized objects for all of the load body generalizeds in model m
var lbg = LoadBodyGeneralized.GetAll(m);
Arguments
Name Type
Description
Flag
Flag set on the load body generalizeds that you want to retrieve
Return type
Array of LoadBodyGeneralized objects
Example
To make an array of LoadBodyGeneralized objects for all of the load body generalizeds in model m flagged with f
var lbg = LoadBodyGeneralized.GetFlagged(m, f);
Keywords 1060
March 2016
Load
LoadBodyGeneralized class
Arguments
Name
Type
Description
Model
number integer number of the load body generalized you want the LoadBodyGeneralized object for
Return type
LoadBodyGeneralized object (or null if load body generalized does not exist).
Example
To get the LoadBodyGeneralized object for load body generalized 100 in model m
var lbg = LoadBodyGeneralized.GetFromID(m, 100);
Arguments
Name Type
prop
Description
load body generalized property load body generalized property to get parameter for
Return type
Parameter object if property is a parameter, null if not.
Example
To check if LoadBodyGeneralized property lbg.example is a parameter:
Options.property_parameter_names = true;
if (lbg.GetParameter(lbg.example) ) do_something...
Options.property_parameter_names = false;
To check if LoadBodyGeneralized property lbg.example is a parameter by using the GetParameter method:
if (lbg.ViewParameters().GetParameter(lbg.example) ) do_something...
Keyword()
Description
Returns the keyword for this load body generalized (*LOAD_NODE_xxxx). Note that a carriage return is not
added. See also LoadBodyGeneralized.KeywordCards()
March 2016
Keywords 1061
LoadBodyGeneralized class
Load
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for load body generalized m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the load body generalized. Note that a carriage return is not added. See also
LoadBodyGeneralized.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for load body generalized l:
var cards = l.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last load body generalized in the model.
Arguments
Name Type
Description
Return type
LoadBodyGeneralized object (or null if there are no load body generalizeds in the model).
Example
To get the last load body generalized in model m:
var lbg = LoadBodyGeneralized.Last(m);
Next()
Description
Returns the next load body generalized in the model.
Keywords 1062
March 2016
Load
LoadBodyGeneralized class
Arguments
No arguments
Return type
LoadBodyGeneralized object (or null if there are no more load body generalizeds in the model).
Example
To get the load body generalized in model m after load body generalized lbg:
var lbg = lbg.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the load body generalized can be picked from
any model.
modal
(optional)
boolean 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.
Return type
LoadBodyGeneralized object (or null if not picked)
Example
To pick a load body generalized from model m giving the prompt Pick load body generalized from screen:
var load_body_generalized = LoadBodyGeneralized.Pick(Pick load body generalized
from screen, m);
Previous()
Description
Returns the previous load body generalized in the model.
Arguments
No arguments
Return type
LoadBodyGeneralized object (or null if there are no more load body generalizeds in the model).
Example
To get the load body generalized in model m before load body generalized lbg:
var lbg = lbg.Previous();
March 2016
Keywords 1063
LoadBodyGeneralized class
Load
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only load body generalizeds from that model can be selected.
Flag
If the argument is a Flag then only load body generalizeds that are flagged with limit can be
selected (limit should be different to flag). If omitted, or null, any load body generalizeds can
be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of load body generalizeds selected or null if menu cancelled
Example
To select load body generalizeds from model m, flagging those selected with flag f, giving the prompt Select load body
generalizeds:
LoadBodyGeneralized.Select(f, Select load body generalizeds, m);
To select load body generalizeds, flagging those selected with flag f but limiting selection to load body generalizeds
flagged with flag l, giving the prompt Select load body generalizeds:
LoadBodyGeneralized.Select(f, Select load body generalizeds, l);
SetFlag(flag[Flag])
Description
Sets a flag on the load body generalized.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for load body generalized lbg:
lbg.SetFlag(f);
Keywords 1064
March 2016
Load
LoadBodyGeneralized class
Sketch(redraw (optional)[boolean])
Description
Sketches the load body generalized. The load body generalized will be sketched until you either call
LoadBodyGeneralized.Unsketch(), LoadBodyGeneralized.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load body generalized is sketched. If omitted
redraw is true. If you want to sketch several load body generalizeds and only redraw after the
last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch load body generalized lbg:
lbg.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing load body generalizeds should be counted. If false or omitted referenced
but undefined load body generalizeds will also be included in the total.
Return type
number of load body generalizeds
Example
To get the total number of load body generalizeds in model m:
var total = LoadBodyGeneralized.Total(m);
Unblank()
Description
Unblanks the load body generalized
Arguments
No arguments
Return type
No return value
March 2016
Keywords 1065
LoadBodyGeneralized class
Load
Example
To unblank load body generalized lbg:
lbg.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load body generalizeds in model m:
LoadBodyGeneralized.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
Flag set on the load body generalizeds that you want to unblank
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load body generalizeds in model m flagged with f:
LoadBodyGeneralized.UnblankFlagged(m, f);
March 2016
Load
LoadBodyGeneralized class
Arguments
Name Type
Description
Model Model Model that the defined flag for all load body generalizeds will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the load body generalizeds in model m:
LoadBodyGeneralized.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the load body generalized.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load body generalized is unsketched. If omitted
redraw is true. If you want to unsketch several load body generalizeds and only redraw after
the last one then use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch load body generalized lbg:
lbg.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the load body generalizeds 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().
Return type
No return value
March 2016
Keywords 1067
LoadBodyGeneralized class
Load
Example
To unsketch all load body generalizeds in model m:
LoadBodyGeneralized.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
LoadBodyGeneralized object.
Example
To check if LoadBodyGeneralized property lbg.example is a parameter by using the
LoadBodyGeneralized.GetParameter() method:
if (lbg.ViewParameters().GetParameter(lbg.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for load body generalized lbg:
lbg.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this load body generalized.
Arguments
No arguments
Keywords 1068
March 2016
Load
LoadBodyGeneralized class
Return type
Xrefs object.
Example
To get the cross references for load body generalized lbg:
var xrefs = lbg.Xrefs();
toString()
Description
Creates a string containing the load body generalized data in keyword format. Note that this contains the keyword
header and the keyword cards. See also LoadBodyGeneralized.Keyword() and LoadBodyGeneralized.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for load body generalized l in keyword format
var s = l.toString();
March 2016
Keywords 1069
LoadNode class
Load
LoadNode class
The LoadNode class gives you access to define load node cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[load node property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
LoadNode constants
Name
Description
LOAD is *LOAD_NODE_SET.
LoadNode properties
Name
Type
Description
cid
integer
Coordinate system ID
dof
integer
Applicable degrees-of-freedom
exists
logical
true if load node exists, false if referred to but not defined. (read only)
include integer
lcid
Curve ID
integer
Keywords 1070
March 2016
Load
m1
integer
Node 1 ID
m2
integer
Node 2 ID
m3
integer
Node 3 ID
model
integer
nid
integer
sf
float
type
LoadNode class
Detailed Description
The LoadNode class allows you to create, modify, edit and manipulate load node cards. See the documentation below
for more details.
Constructor
new LoadNode(Model[Model], type[constant], nid[integer], dof[integer],
lcid[integer], sf (optional)[float], cid (optional)[integer], m1 (optional)[integer],
m2 (optional)[integer], m3 (optional)[integer])
Description
Create a new LoadNode object.
Arguments
Name
Type
Description
Model
Model
type
nid
integer
dof
integer
Applicable degrees-of-freedom
lcid
integer
Curve ID
sf (optional)
float
Coordinate system ID
m1 (optional) integer
Node 1 ID
m2 (optional) integer
Node 2 ID
m3 (optional) integer
Node 3 ID
Return type
LoadNode object
Example
To create a new load node in model m, of type SET, with loadcurve 9 and a scale factor of 0.5
var b = new LoadNode(m, LoadNode.SET, 100, 2, 9, 0.5);
March 2016
Keywords 1071
LoadNode class
Load
Details of functions
Blank()
Description
Blanks the load node
Arguments
No arguments
Return type
No return value
Example
To blank load node ln:
ln.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the load nodes in model m:
LoadNode.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Keywords 1072
March 2016
Load
LoadNode class
Return type
No return value
Example
To blank all of the load nodes in model m flagged with f:
LoadNode.BlankFlagged(m, f);
Blanked()
Description
Checks if the load node is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if load node ln is blanked:
if (ln.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the load node.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for load node ln:
ln.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the load node.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
March 2016
Keywords 1073
LoadNode class
Load
Return type
Return class object
Example
To copy load node ln into load node z:
var z = ln.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for load node ln:
ln.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first load node in the model.
Arguments
Name Type
Description
Return type
LoadNode object (or null if there are no load nodes in the model).
Example
To get the first load node in model m:
var ln = LoadNode.First(m);
Keywords 1074
March 2016
Load
LoadNode class
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the load nodes with flag f in model m:
LoadNode.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the load node is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if load node ln has flag f set on it:
if (ln.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
March 2016
Keywords 1075
LoadNode class
Load
Return type
No return value
Example
To call function test for all of the load nodes in model m:
LoadNode.ForEach(m, test);
function test(ln)
{
// ln is LoadNode object
}
To call function test for all of the load nodes in model m with optional object:
var data = { x:0, y:0 };
LoadNode.ForEach(m, test, data);
function test(ln, extra)
{
// ln is LoadNode object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of LoadNode objects for all of the load nodes in a model in Primer
Arguments
Name Type
Description
Return type
Array of LoadNode objects
Example
To make an array of LoadNode objects for all of the load nodes in model m
var ln = LoadNode.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of LoadNode objects
Keywords 1076
March 2016
Load
LoadNode class
Example
To make an array of LoadNode objects for all of the load nodes in model m flagged with f
var ln = LoadNode.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the load node you want the LoadNode object for
Return type
LoadNode object (or null if load node does not exist).
Example
To get the LoadNode object for load node 100 in model m
var ln = LoadNode.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if LoadNode property ln.example is a parameter:
Options.property_parameter_names = true;
if (ln.GetParameter(ln.example) ) do_something...
Options.property_parameter_names = false;
To check if LoadNode property ln.example is a parameter by using the GetParameter method:
if (ln.ViewParameters().GetParameter(ln.example) ) do_something...
March 2016
Keywords 1077
LoadNode class
Load
Keyword()
Description
Returns the keyword for this load node (*LOAD_NODE_xxxx). Note that a carriage return is not added. See also
LoadNode.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for load node m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the load node. Note that a carriage return is not added. See also LoadNode.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for load node l:
var cards = l.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last load node in the model.
Arguments
Name Type
Description
Return type
LoadNode object (or null if there are no load nodes in the model).
Example
To get the last load node in model m:
var ln = LoadNode.Last(m);
Keywords 1078
March 2016
Load
LoadNode class
Next()
Description
Returns the next load node in the model.
Arguments
No arguments
Return type
LoadNode object (or null if there are no more load nodes in the model).
Example
To get the load node in model m after load node ln:
var ln = ln.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the load node can be picked from any model.
modal
(optional)
boolean 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.
Return type
LoadNode object (or null if not picked)
Example
To pick a load node from model m giving the prompt Pick load node from screen:
var load_node = LoadNode.Pick(Pick load node from screen, m);
Previous()
Description
Returns the previous load node in the model.
Arguments
No arguments
Return type
LoadNode object (or null if there are no more load nodes in the model).
March 2016
Keywords 1079
LoadNode class
Load
Example
To get the load node in model m before load node ln:
var ln = ln.Previous();
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only load nodes from that model can be selected. If the
Flag
argument is a Flag then only load nodes that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any load nodes can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of load nodes selected or null if menu cancelled
Example
To select load nodes from model m, flagging those selected with flag f, giving the prompt Select load nodes:
LoadNode.Select(f, Select load nodes, m);
To select load nodes, flagging those selected with flag f but limiting selection to load nodes flagged with flag l, giving
the prompt Select load nodes:
LoadNode.Select(f, Select load nodes, l);
SetFlag(flag[Flag])
Description
Sets a flag on the load node.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for load node ln:
ln.SetFlag(f);
Keywords 1080
March 2016
Load
LoadNode class
Sketch(redraw (optional)[boolean])
Description
Sketches the load node. The load node will be sketched until you either call LoadNode.Unsketch(),
LoadNode.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load node is sketched. If omitted redraw is true. If
you want to sketch several load nodes and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch load node ln:
ln.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing load nodes should be counted. If false or omitted referenced but
undefined load nodes will also be included in the total.
Return type
number of load nodes
Example
To get the total number of load nodes in model m:
var total = LoadNode.Total(m);
Unblank()
Description
Unblanks the load node
Arguments
No arguments
Return type
No return value
March 2016
Keywords 1081
LoadNode class
Load
Example
To unblank load node ln:
ln.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load nodes in model m:
LoadNode.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load nodes in model m flagged with f:
LoadNode.UnblankFlagged(m, f);
Keywords 1082
March 2016
Load
LoadNode class
Arguments
Name Type
Description
Model Model Model that the defined flag for all load nodes will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the load nodes in model m:
LoadNode.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the load node.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load node is unsketched. If omitted redraw is true.
If you want to unsketch several load nodes and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch load node ln:
ln.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the load nodes 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().
Return type
No return value
March 2016
Keywords 1083
LoadNode class
Load
Example
To unsketch all load nodes in model m:
LoadNode.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
LoadNode object.
Example
To check if LoadNode property ln.example is a parameter by using the LoadNode.GetParameter() method:
if (ln.ViewParameters().GetParameter(ln.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for load node ln:
ln.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this load node.
Arguments
No arguments
Keywords 1084
March 2016
Load
LoadNode class
Return type
Xrefs object.
Example
To get the cross references for load node ln:
var xrefs = ln.Xrefs();
toString()
Description
Creates a string containing the load node data in keyword format. Note that this contains the keyword header and the
keyword cards. See also LoadNode.Keyword() and LoadNode.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for load node l in keyword format
var s = l.toString();
March 2016
Keywords 1085
LoadRigidBody class
Load
LoadRigidBody class
The LoadRigidBody class gives you access to define load rigidbody cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[load rigidbody property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
LoadRigidBody properties
Name
Type
Description
cid
dof
exists
logical true if load rigidbody exists, false if referred to but not defined. (read only)
include integer The Include file number that the load rigidbody is in.
lcid
integer Curve ID
m1
integer Node 1 ID
m2
integer Node 2 ID
m3
integer Node 3 ID
model
pid
integer Part ID
Keywords 1086
March 2016
Load
sf
float
LoadRigidBody class
Detailed Description
The LoadRigidBody class allows you to create, modify, edit and manipulate load rigidbody cards. See the
documentation below for more details.
Constructor
new LoadRigidBody(Model[Model], pid[integer], dof[integer], lcid[integer], sf
(optional)[float], cid (optional)[integer], m1 (optional)[integer], m2
(optional)[integer], m3 (optional)[integer])
Description
Create a new LoadRigidBody object.
Arguments
Name
Type
Description
Model
pid
integer Part ID
dof
lcid
integer Curve ID
sf (optional)
float
Return type
LoadRigidBody object
Example
To create a new load rigidbody in model m, for part 100, with loadcurve 9 and a scale factor of 0.5
var lrb = new LoadRigidBody(m, 100, 2, 9, 0.5);
Details of functions
Blank()
Description
Blanks the load rigidbody
Arguments
No arguments
Return type
No return value
March 2016
Keywords 1087
LoadRigidBody class
Load
Example
To blank load rigidbody lrb:
lrb.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the load rigidbodies in model m:
LoadRigidBody.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the load rigidbodies in model m flagged with f:
LoadRigidBody.BlankFlagged(m, f);
Blanked()
Description
Checks if the load rigidbody is blanked or not.
Keywords 1088
March 2016
Load
LoadRigidBody class
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if load rigidbody lrb is blanked:
if (lrb.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the load rigidbody.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for load rigidbody lrb:
lrb.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the load rigidbody.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy load rigidbody lrb into load rigidbody z:
var z = lrb.Copy();
Keywords 1089
LoadRigidBody class
Load
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for load rigidbody lrb:
lrb.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first load rigidbody in the model.
Arguments
Name Type
Description
Return type
LoadRigidBody object (or null if there are no load rigidbodies in the model).
Example
To get the first load rigidbody in model m:
var lrb = LoadRigidBody.First(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the load rigidbodies with flag f in model m:
LoadRigidBody.FlagAll(m, f);
Keywords 1090
March 2016
Load
LoadRigidBody class
Flagged(flag[Flag])
Description
Checks if the load rigidbody is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if load rigidbody lrb has flag f set on it:
if (lrb.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 1091
LoadRigidBody class
Load
Example
To call function test for all of the load rigidbodies in model m:
LoadRigidBody.ForEach(m, test);
function test(lrb)
{
// lrb is LoadRigidBody object
}
To call function test for all of the load rigidbodies in model m with optional object:
var data = { x:0, y:0 };
LoadRigidBody.ForEach(m, test, data);
function test(lrb, extra)
{
// lrb is LoadRigidBody object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of LoadRigidBody objects for all of the load rigidbodies in a model in Primer
Arguments
Name Type
Description
Return type
Array of LoadRigidBody objects
Example
To make an array of LoadRigidBody objects for all of the load rigidbodies in model m
var lrb = LoadRigidBody.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of LoadRigidBody objects
Example
To make an array of LoadRigidBody objects for all of the load rigidbodies in model m flagged with f
var lrb = LoadRigidBody.GetFlagged(m, f);
Keywords 1092
March 2016
Load
LoadRigidBody class
Arguments
Name
Type
Description
Model
number integer number of the load rigidbody you want the LoadRigidBody object for
Return type
LoadRigidBody object (or null if load rigidbody does not exist).
Example
To get the LoadRigidBody object for load rigidbody 100 in model m
var lrb = LoadRigidBody.GetFromID(m, 100);
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if LoadRigidBody property lrb.example is a parameter:
Options.property_parameter_names = true;
if (lrb.GetParameter(lrb.example) ) do_something...
Options.property_parameter_names = false;
To check if LoadRigidBody property lrb.example is a parameter by using the GetParameter method:
if (lrb.ViewParameters().GetParameter(lrb.example) ) do_something...
Keyword()
Description
Returns the keyword for this load rigidbody (*LOAD_RIGIDBODY). Note that a carriage return is not added. See
also LoadRigidBody.KeywordCards()
March 2016
Keywords 1093
LoadRigidBody class
Load
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for load rigidbody lrb:
var key = lrb.Keyword();
KeywordCards()
Description
Returns the keyword cards for the load rigidbody. Note that a carriage return is not added. See also
LoadRigidBody.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for load rigidbody lrb:
var cards = lrb.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last load rigidbody in the model.
Arguments
Name Type
Description
Return type
LoadRigidBody object (or null if there are no load rigidbodies in the model).
Example
To get the last load rigidbody in model m:
var lrb = LoadRigidBody.Last(m);
Next()
Description
Returns the next load rigidbody in the model.
Keywords 1094
March 2016
Load
LoadRigidBody class
Arguments
No arguments
Return type
LoadRigidBody object (or null if there are no more load rigidbodies in the model).
Example
To get the load rigidbody in model m after load rigidbody lrb:
var lrb = lrb.Next();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the load rigidbody can be picked from any
model.
modal
(optional)
boolean 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.
Return type
LoadRigidBody object (or null if not picked)
Example
To pick a load rigidbody from model m giving the prompt Pick load rigidbody from screen:
var lrb = LoadRigidBody.Pick(Pick load rigidbody from screen, m);
Previous()
Description
Returns the previous load rigidbody in the model.
Arguments
No arguments
Return type
LoadRigidBody object (or null if there are no more load rigidbodies in the model).
Example
To get the load rigidbody in model m before load rigidbody lrb:
var lrb = lrb.Previous();
March 2016
Keywords 1095
LoadRigidBody class
Load
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only load rigidbodies from that model can be selected. If the
Flag
argument is a Flag then only load rigidbodies that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any load rigidbodies can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of load rigidbodies selected or null if menu cancelled
Example
To select load rigidbodies from model m, flagging those selected with flag f, giving the prompt Select load rigidbodies:
LoadRigidBody.Select(f, Select load rigidbodies, m);
To select load rigidbodies, flagging those selected with flag f but limiting selection to load rigidbodies flagged with flag
l, giving the prompt Select load rigidbodies:
LoadRigidBody.Select(f, Select load rigidbodies, l);
SetFlag(flag[Flag])
Description
Sets a flag on the load rigidbody.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for load rigidbody lrb:
lrb.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the load rigidbody. The load rigidbody will be sketched until you either call LoadRigidBody.Unsketch(),
LoadRigidBody.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 1096
March 2016
Load
LoadRigidBody class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load rigidbody is sketched. If omitted redraw is
true. If you want to sketch several load rigidbodies and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To sketch load rigidbody lrb:
lrb.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing load rigidbodies should be counted. If false or omitted referenced but
undefined load rigidbodies will also be included in the total.
Return type
number of load rigidbodies
Example
To get the total number of load rigidbodies in model m:
var total = LoadRigidBody.Total(m);
Unblank()
Description
Unblanks the load rigidbody
Arguments
No arguments
Return type
No return value
Example
To unblank load rigidbody lrb:
lrb.Unblank();
March 2016
Keywords 1097
LoadRigidBody class
Load
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load rigidbodies in model m:
LoadRigidBody.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load rigidbodies in model m flagged with f:
LoadRigidBody.UnblankFlagged(m, f);
Keywords 1098
March 2016
Load
LoadRigidBody class
Arguments
Name Type
Description
Model Model Model that the defined flag for all load rigidbodies will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the load rigidbodies in model m:
LoadRigidBody.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the load rigidbody.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load rigidbody is unsketched. If omitted redraw is
true. If you want to unsketch several load rigidbodies and only redraw after the last one then
use false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch load rigidbody lrb:
lrb.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the load rigidbodies 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().
Return type
No return value
March 2016
Keywords 1099
LoadRigidBody class
Load
Example
To unsketch all load rigidbodies in model m:
LoadRigidBody.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
LoadRigidBody object.
Example
To check if LoadRigidBody property lrb.example is a parameter by using the LoadRigidBody.GetParameter() method:
if (lrb.ViewParameters().GetParameter(lrb.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for load rigidbody lrb:
lrb.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this load rigidbody.
Arguments
No arguments
Keywords 1100
March 2016
Load
LoadRigidBody class
Return type
Xrefs object.
Example
To get the cross references for load rigidbody lrb:
var xrefs = lrb.Xrefs();
toString()
Description
Creates a string containing the load rigidbody data in keyword format. Note that this contains the keyword header and
the keyword cards. See also LoadRigidBody.Keyword() and LoadRigidBody.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for load rigidbody lrb in keyword format
var s = lrb.toString();
March 2016
Keywords 1101
LoadShell class
Load
LoadShell class
The LoadShell class gives you access to define *LOAD_SHELL cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[load shell property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
LoadShell constants
Name
Description
LOAD is *LOAD_SHELL_SET.
LoadShell properties
Name
Type
Description
at
float
eid
integer
Keywords 1102
March 2016
Load
exists
logical
true if LoadShell exists, false if referred to but not defined. (read only)
heading string
LoadShell heading
id
logical
LoadShell class
include integer
label
integer
LoadShell number.
lcid
integer
Curve ID
lsid
integer
model
integer
sf
float
type
Detailed Description
The LoadShell class allows you to create, modify, edit and manipulate *LOAD_SHELL cards. See the documentation
below for more details.
Constructor
new LoadShell(Model[Model], type[constant], eid[integer], lcid[integer], sf
(optional)[float], at (optional)[float], lsid (optional)[integer], heading
(optional)[string])
Description
Create a new LoadShell object.
Arguments
Name
Type
Description
Model
Model
type
eid
integer
lcid
integer
Curve ID
sf (optional)
float
at (optional)
float
lsid (optional)
integer
LoadShell number
Return type
LoadShell object
Example
To create a new load shell in model m, of type SET, with loadcurve 9 and a scale factor of 0.5
var b = new LoadShell(m, LoadShell.SET, 100, 2, 9, 0.5);
March 2016
Keywords 1103
LoadShell class
Load
Details of functions
Blank()
Description
Blanks the load shell
Arguments
No arguments
Return type
No return value
Example
To blank load shell ls:
ls.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the load shells in model m:
LoadShell.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Keywords 1104
March 2016
Load
LoadShell class
Return type
No return value
Example
To blank all of the load shells in model m flagged with f:
LoadShell.BlankFlagged(m, f);
Blanked()
Description
Checks if the load shell is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if load shell ls is blanked:
if (ls.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the load shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for load shell ls:
ls.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the load shell.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
March 2016
Keywords 1105
LoadShell class
Load
Return type
Return class object
Example
To copy load shell ls into load shell z:
var z = ls.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for load shell ls:
ls.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first load shell in the model.
Arguments
Name Type
Description
Return type
LoadShell object (or null if there are no load shells in the model).
Example
To get the first load shell in model m:
var ls = LoadShell.First(m);
Keywords 1106
March 2016
Load
LoadShell class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
LoadShell label.
Example
To get the first free load shell label in model m:
var label = LoadShell.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the load shells with flag f in model m:
LoadShell.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the load shell is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if load shell ls has flag f set on it:
if (ls.Flagged(f) ) do_something...
March 2016
Keywords 1107
LoadShell class
Load
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the load shells in model m:
LoadShell.ForEach(m, test);
function test(ls)
{
// ls is LoadShell object
}
To call function test for all of the load shells in model m with optional object:
var data = { x:0, y:0 };
LoadShell.ForEach(m, test, data);
function test(ls, extra)
{
// ls is LoadShell object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of LoadShell objects for all of the load shells in a model in Primer
Arguments
Name Type
Description
Return type
Array of LoadShell objects
Example
To make an array of LoadShell objects for all of the load shells in model m
var ls = LoadShell.GetAll(m);
Keywords 1108
March 2016
Load
LoadShell class
Arguments
Name Type
Description
Flag
Return type
Array of LoadShell objects
Example
To make an array of LoadShell objects for all of the load shells in model m flagged with f
var ls = LoadShell.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the load shell you want the LoadShell object for
Return type
LoadShell object (or null if load shell does not exist).
Example
To get the LoadShell object for load shell 100 in model m
var ls = LoadShell.GetFromID(m, 100);
Arguments
Name Type
prop
Description
March 2016
Keywords 1109
LoadShell class
Load
Return type
Parameter object if property is a parameter, null if not.
Example
To check if LoadShell property ls.example is a parameter:
Options.property_parameter_names = true;
if (ls.GetParameter(ls.example) ) do_something...
Options.property_parameter_names = false;
To check if LoadShell property ls.example is a parameter by using the GetParameter method:
if (ls.ViewParameters().GetParameter(ls.example) ) do_something...
Keyword()
Description
Returns the keyword for this LoadShell (*LOAD_SHELL_xxxx). Note that a carriage return is not added. See also
LoadShell.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for LoadShell m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the LoadShell. Note that a carriage return is not added. See also
LoadShell.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for LoadShell l:
var cards = l.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last load shell in the model.
Keywords 1110
March 2016
Load
LoadShell class
Arguments
Name Type
Description
Return type
LoadShell object (or null if there are no load shells in the model).
Example
To get the last load shell in model m:
var ls = LoadShell.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
LoadShell label.
Example
To get the last free load shell label in model m:
var label = LoadShell.LastFreeLabel(m);
Next()
Description
Returns the next load shell in the model.
Arguments
No arguments
Return type
LoadShell object (or null if there are no more load shells in the model).
Example
To get the load shell in model m after load shell ls:
var ls = ls.Next();
March 2016
Keywords 1111
LoadShell class
Load
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
LoadShell label.
Example
To get the next free load shell label in model m:
var label = LoadShell.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the LoadShell can be picked from any model.
modal
(optional)
boolean 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.
Return type
LoadShell object (or null if not picked)
Example
To pick a LoadShell from model m giving the prompt Pick LoadShell from screen:
var load_shell = LoadShell.Pick(Pick LoadShell from screen, m);
Previous()
Description
Returns the previous load shell in the model.
Arguments
No arguments
Keywords 1112
March 2016
Load
LoadShell class
Return type
LoadShell object (or null if there are no more load shells in the model).
Example
To get the load shell in model m before load shell ls:
var ls = ls.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the load shells in model m, from 1000000:
LoadShell.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged load shells will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the load shells in model m flagged with f, from 1000000:
LoadShell.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 1113
LoadShell class
Load
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only load shells from that model can be selected. If the
Flag
argument is a Flag then only load shells that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any load shells can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of load shells selected or null if menu cancelled
Example
To select load shells from model m, flagging those selected with flag f, giving the prompt Select load shells:
LoadShell.Select(f, Select load shells, m);
To select load shells, flagging those selected with flag f but limiting selection to load shells flagged with flag l, giving
the prompt Select load shells:
LoadShell.Select(f, Select load shells, l);
SetFlag(flag[Flag])
Description
Sets a flag on the load shell.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for load shell ls:
ls.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the load shell. The load shell will be sketched until you either call LoadShell.Unsketch(),
LoadShell.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 1114
March 2016
Load
LoadShell class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load shell is sketched. If omitted redraw is true. If
you want to sketch several load shells and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch load shell ls:
ls.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing load shells should be counted. If false or omitted referenced but
undefined load shells will also be included in the total.
Return type
number of load shells
Example
To get the total number of load shells in model m:
var total = LoadShell.Total(m);
Unblank()
Description
Unblanks the load shell
Arguments
No arguments
Return type
No return value
Example
To unblank load shell ls:
ls.Unblank();
March 2016
Keywords 1115
LoadShell class
Load
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load shells in model m:
LoadShell.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the load shells in model m flagged with f:
LoadShell.UnblankFlagged(m, f);
Keywords 1116
March 2016
Load
LoadShell class
Arguments
Name Type
Description
Model Model Model that the defined flag for all load shells will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the load shells in model m:
LoadShell.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the load shell.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the load shell is unsketched. If omitted redraw is true.
If you want to unsketch several load shells and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch load shell ls:
ls.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the load shells 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().
Return type
No return value
March 2016
Keywords 1117
LoadShell class
Load
Example
To unsketch all load shells in model m:
LoadShell.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
LoadShell object.
Example
To check if LoadShell property ls.example is a parameter by using the LoadShell.GetParameter() method:
if (ls.ViewParameters().GetParameter(ls.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for load shell ls:
ls.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this load shell.
Arguments
No arguments
Keywords 1118
March 2016
Load
LoadShell class
Return type
Xrefs object.
Example
To get the cross references for load shell ls:
var xrefs = ls.Xrefs();
toString()
Description
Creates a string containing the LoadShell data in keyword format. Note that this contains the keyword header and the
keyword cards. See also LoadShell.Keyword() and LoadShell.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for LoadShell l in keyword format
var s = l.toString();
March 2016
Keywords 1119
Material class
Material
Material class
The Material class gives you access to material cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Density()
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[material property])
GetPropertyByIndex(index[integer])
GetPropertyByName(acronym[string])
GetPropertyByRowCol(row[integer], col[integer])
GetPropertyNameForIndex(index[integer])
GetPropertyNameForRowCol(row[integer], col[integer])
Keyword()
KeywordCards()
Next()
PoissonsRatio()
Previous()
SetFlag(flag[Flag])
SetPropertyByIndex(index[integer], value[integer/float for numeric properties, string for character properties])
SetPropertyByName(acronym[string], value[integer/float for numeric properties, string for character
properties])
SetPropertyByRowCol(row[integer], col[integer], value[integer/float for numeric properties, string for
character properties])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
YieldStress()
YoungsModulus()
toString()
Material properties
Keywords 1120
March 2016
Material
Material class
Name
Type
Description
colour
cols
float
exists
logical true if material exists, false if referred to but not defined. (read only)
include
label
integer Material number. Also see the mid property which is an alternative name for this.
mid
integer Material number. Also see the label property which is an alternative name for this.
model
properties
rows
integer The number of rows of data the material has (read only)
title
string
Material title
transparency integer The transparency of the material (0-100) 0% is opaque, 100% is transparent.
type
string
Detailed Description
The Material class allows you to create, modify, edit and manipulate material cards. See the documentation below for
more details.
Constructor
new Material(Model[Model], mid[integer/string], type[string])
Description
Create a new Material object.
Arguments
Name Type
Description
Model Model
mid
type
string
Material type. Either give the LS-DYNA material name or 3 digit number.
Return type
Material object
Example
To create a new rigid material in model m with label 100
var mat = new Material(m, 100, "RIGID");
or
var mat = new Material(m, 100, "020");
or
var mat = new Material(m, 100, "*MAT_RIGID");
or
var mat = new Material(m, 100, "*MAT_020");
March 2016
Keywords 1121
Material class
Material
Details of functions
Blank()
Description
Blanks the material
Arguments
No arguments
Return type
No return value
Example
To blank material m:
m.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the materials in model m:
Material.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Keywords 1122
March 2016
Material
Material class
Return type
No return value
Example
To blank all of the materials in model m flagged with f:
Material.BlankFlagged(m, f);
Blanked()
Description
Checks if the material is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if material m is blanked:
if (m.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse material m:
m.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the material.
Arguments
Name Type Description
flag
March 2016
Keywords 1123
Material class
Material
Return type
No return value
Example
To clear flag f for material m:
m.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the material.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy material m into material z:
var z = m.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Material object (or null if not made)
Example
To start creating a material in model m:
var mat = Material.Create(m);
Density()
Description
Get the density material.
Keywords 1124
March 2016
Material
Material class
Arguments
No arguments
Return type
float
Example
To get the density for material m:
var density = m.Density();
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit material m:
m.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for material m:
m.Error("My custom error");
March 2016
Keywords 1125
Material class
Material
First(Model[Model]) [static]
Description
Returns the first material in the model.
Arguments
Name Type
Description
Return type
Material object (or null if there are no materials in the model).
Example
To get the first material in model m:
var m = Material.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Material label.
Example
To get the first free material label in model m:
var label = Material.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Keywords 1126
March 2016
Material
Material class
Return type
No return value
Example
To flag all of the materials with flag f in model m:
Material.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the material is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if material m has flag f set on it:
if (m.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 1127
Material class
Material
Example
To call function test for all of the materials in model m:
Material.ForEach(m, test);
function test(m)
{
// m is Material object
}
To call function test for all of the materials in model m with optional object:
var data = { x:0, y:0 };
Material.ForEach(m, test, data);
function test(m, extra)
{
// m is Material object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Material objects for all of the materials in a model in Primer
Arguments
Name Type
Description
Return type
Array of Material objects
Example
To make an array of Material objects for all of the materials in model m
var m = Material.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Material objects
Example
To make an array of Material objects for all of the materials in model m flagged with f
var m = Material.GetFlagged(m, f);
Keywords 1128
March 2016
Material
Material class
Arguments
Name
Type
Description
Model
number integer number of the material you want the Material object for
Return type
Material object (or null if material does not exist).
Example
To get the Material object for material 100 in model m
var m = Material.GetFromID(m, 100);
GetParameter(prop[material property])
Description
Checks if a Material 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 Material.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Material property m.example is a parameter:
Options.property_parameter_names = true;
if (m.GetParameter(m.example) ) do_something...
Options.property_parameter_names = false;
To check if Material property m.example is a parameter by using the GetParameter method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
GetPropertyByIndex(index[integer])
Description
Returns the value of property at index index for this Material object or null if no property exists.
March 2016
Keywords 1129
Material class
Material
Arguments
Name Type
Description
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 a material may not have adjacent indices.
Return type
Property value (float/integer)
Example
To return the property at index 2, for material m:
var prop = m.GetPropertyByIndex(2);
GetPropertyByName(acronym[string])
Description
Returns the value of property string acronym for this Material object or null if no property exists.
Arguments
Name
Type Description
Return type
Property value (float/integer)
Example
To return the value of RO for material m:
var ro = m.GetPropertyByName("RO");
GetPropertyByRowCol(row[integer], col[integer])
Description
Returns the value of the property for row and col for this Material object or null if no property exists. Note that rows
and columns start at 0.
Arguments
Name Type
Description
row
col
Return type
Property value (float/integer)
Example
To return the value of the property at row 0, column 1 for material m:
var prop = m.GetPropertyByRowCol(0, 1);
Keywords 1130
March 2016
Material
Material class
GetPropertyNameForIndex(index[integer])
Description
Returns the name of the property at index index for this Material object or null if there is no property.
Arguments
Name Type
Description
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 a material may not have adjacent indices.
Return type
Property name (string)
Example
To return the name of the property at index 2, for material m:
var name = m.GetPropertyNameForIndex(2);
GetPropertyNameForRowCol(row[integer], col[integer])
Description
Returns the name of the property at row and col for this Material object or null if there is no property. Note that rows
and columns start at 0.
Arguments
Name Type
Description
row
col
Return type
Property name (string)
Example
To return the name of the property at row 0, column 1 for material m:
var name = m.GetPropertyNameForRowCol(0, 1);
Keyword()
Description
Returns the keyword for this material (e.g. *MAT_RIGID, *MAT_ELASTIC etc). Note that a carriage return is not
added. See also Material.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
March 2016
Keywords 1131
Material class
Material
Example
To get the keyword for material m:
var key = m.Keyword();
KeywordCards()
Description
Returns the keyword cards for the material. Note that a carriage return is not added. See also Material.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for material m:
var cards = m.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last material in the model.
Arguments
Name Type
Description
Return type
Material object (or null if there are no materials in the model).
Example
To get the last material in model m:
var m = Material.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Keywords 1132
March 2016
Material
Material class
Return type
Material label.
Example
To get the last free material label in model m:
var label = Material.LastFreeLabel(m);
Next()
Description
Returns the next material in the model.
Arguments
No arguments
Return type
Material object (or null if there are no more materials in the model).
Example
To get the material in model m after material m:
var m = m.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Material label.
Example
To get the next free material label in model m:
var label = Material.NextFreeLabel(m);
March 2016
Keywords 1133
Material class
Material
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the material can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Material object (or null if not picked)
Example
To pick a material from model m giving the prompt Pick material from screen:
var mat = Material.Pick(Pick material from screen, m);
PoissonsRatio()
Description
Get Poissons ratio for the material.
Arguments
No arguments
Return type
float
Example
To get Poissons ratio for material m:
var pr = m.PoissonsRatio(f);
Previous()
Description
Returns the previous material in the model.
Arguments
No arguments
Return type
Material object (or null if there are no more materials in the model).
Example
To get the material in model m before material m:
var m = m.Previous();
Keywords 1134
March 2016
Material
Material class
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the materials in model m, from 1000000:
Material.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged materials will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the materials in model m flagged with f, from 1000000:
Material.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 1135
Material class
Material
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only materials from that model can be selected. If the
Flag
argument is a Flag then only materials that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any materials can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of materials selected or null if menu cancelled
Example
To select materials from model m, flagging those selected with flag f, giving the prompt Select materials:
Material.Select(f, Select materials, m);
To select materials, flagging those selected with flag f but limiting selection to materials flagged with flag l, giving the
prompt Select materials:
Material.Select(f, Select materials, l);
SetFlag(flag[Flag])
Description
Sets a flag on the material.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for material m:
m.SetFlag(f);
Keywords 1136
March 2016
Material
Material class
Arguments
Name Type
Description
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 a material may not have
adjacent indices.
Return type
No return value
Example
To set the property at index 2, for material m to be 1.234:
m.SetPropertyByIndex(2, 1.234);
Arguments
Name
Type
Description
acronym string
value
integer/float for numeric properties, string for character properties The value of the property to set.
Return type
No return value
Example
To set the value of RO for material m to be 7.89e-9:
m.SetPropertyByName("RO", 7.89e-9);
Arguments
Name Type
Description
row
integer
col
integer
value integer/float for numeric properties, string for character properties The value of the property to set.
March 2016
Keywords 1137
Material class
Material
Return type
No return value
Example
To set the value of the property at row 0, column 1 for material m to be 7.89e-9:
m.SetPropertyByRowCol(0, 1, 7.89e-9);
Sketch(redraw (optional)[boolean])
Description
Sketches the material. The material will be sketched until you either call Material.Unsketch(), Material.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the material is sketched. If omitted redraw is true. If
you want to sketch several materials and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch material m:
m.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing materials should be counted. If false or omitted referenced but undefined
materials will also be included in the total.
Return type
number of materials
Example
To get the total number of materials in model m:
var total = Material.Total(m);
Unblank()
Description
Unblanks the material
Keywords 1138
March 2016
Material
Material class
Arguments
No arguments
Return type
No return value
Example
To unblank material m:
m.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the materials in model m:
Material.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the materials in model m flagged with f:
Material.UnblankFlagged(m, f);
March 2016
Keywords 1139
Material class
Material
Arguments
Name Type
Description
Model Model Model that the defined flag for all materials will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the materials in model m:
Material.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the material.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the material is unsketched. If omitted redraw is true. If
you want to unsketch several materials and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch material m:
m.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the materials 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().
Keywords 1140
March 2016
Material
Material class
Return type
No return value
Example
To unsketch all materials in model m:
Material.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Material object.
Example
To check if Material property m.example is a parameter by using the Material.GetParameter() method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for material m:
m.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this material.
March 2016
Keywords 1141
Material class
Material
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for material m:
var xrefs = m.Xrefs();
YieldStress()
Description
Get Yield stress for the material.
Arguments
No arguments
Return type
float
Example
To get Yield stress for material m:
var yield = m.YieldStress();
YoungsModulus()
Description
Get Youngs modulus for the material.
Arguments
No arguments
Return type
float
Example
To get Youngs modulus for material m:
var e = m.YoungsModulus();
toString()
Description
Creates a string containing the material data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Material.Keyword() and Material.KeywordCards().
Arguments
No arguments
Keywords 1142
March 2016
Material
Material class
Return type
string
Example
To get data for material m in keyword format
var s = m.toString();
March 2016
Keywords 1143
Node class
Node
Node class
The Node class gives you access to node cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetAttachedShells(recursive (optional)[boolean])
GetFreeEdgeNodes()
GetInitialVelocities()
GetParameter(prop[node property])
GetReferenceGeometry()
Keyword()
KeywordCards()
Next()
NodalMass()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Node constants
Name
Description
Node.SCALAR
Node is *NODE_SCALAR.
Keywords 1144
March 2016
Node
Node class
Node properties
Name
Type
Description
logical true if node exists, false if referred to but not defined. (read only)
include integer The Include file number that the node is in.
label
integer Node number. Also see the nid property which is an alternative name for this.
model
ndof
nid
integer Node number. Also see the label property which is an alternative name for this.
rc
scalar
integer The type of the node. Can be false (*NODE), Node.SCALAR (*NODE_SCALAR) or
Node.SCALAR_VALUE (*NODE_SCALAR_VALUE)
tc
float
x1
x2
x3
float
Y coordinate
float
Z coordinate
X coordinate
Detailed Description
The Node class allows you to create, modify, edit and manipulate node cards. See the documentation below for more
details.
Constructor
new Node(Model[Model], nid[integer], x[float], y[float], z[float], tc
(optional)[integer], rc (optional)[integer])
Description
Create a new Node object.
Arguments
Name
Type
Description
Model
nid
float
X coordinate
float
Y coordinate
float
Z coordinate
March 2016
Keywords 1145
Node class
Node
Return type
Node object
Example
To create a new node in model m with label 100, at coordinates (20, 40, 10)
var n = new Node(m, 100, 20, 40, 10);
Details of functions
Blank()
Description
Blanks the node
Arguments
No arguments
Return type
No return value
Example
To blank node n:
n.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the nodes in model m:
Node.BlankAll(m);
Keywords 1146
March 2016
Node
Node class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the nodes in model m flagged with f:
Node.BlankFlagged(m, f);
Blanked()
Description
Checks if the node is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if node n is blanked:
if (n.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse node n:
n.Browse();
March 2016
Keywords 1147
Node class
Node
ClearFlag(flag[Flag])
Description
Clears a flag on the node.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for node n:
n.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the node.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy node n into node z:
var z = n.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Node object (or null if not made)
Keywords 1148
March 2016
Node
Node class
Example
To start creating a node in model m:
var n = Node.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit node n:
n.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for node n:
n.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first node in the model.
March 2016
Keywords 1149
Node class
Node
Arguments
Name Type
Description
Return type
Node object (or null if there are no nodes in the model).
Example
To get the first node in model m:
var n = Node.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Node label.
Example
To get the first free node label in model m:
var label = Node.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Keywords 1150
March 2016
Node
Node class
Example
To flag all of the nodes with flag f in model m:
Node.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the node is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if node n has flag f set on it:
if (n.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
March 2016
Keywords 1151
Node class
Node
Example
To call function test for all of the nodes in model m:
Node.ForEach(m, test);
function test(n)
{
// n is Node object
}
To call function test for all of the nodes in model m with optional object:
var data = { x:0, y:0 };
Node.ForEach(m, test, data);
function test(n, extra)
{
// n is Node object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Node objects for all of the nodes in a model in Primer
Arguments
Name Type
Description
Return type
Array of Node objects
Example
To make an array of Node objects for all of the nodes in model m
var n = Node.GetAll(m);
GetAttachedShells(recursive (optional)[boolean])
Description
Returns the shells that are attached to the node.
Arguments
Name
Type
Description
recursive
(optional)
boolean If recursive is false then only the shells actually attached to the node will be returned (this
could also be done by using the Xrefs class but this method is provided for convenience. If
recursive is true then PRIMER will keep finding attached shells until no more can be found. If
omitted recursive will be false.
Return type
Array of Shell objects (or null if there are no attached shells).
Example
To find the shells attached to node n, growing the selection until no more shells can be found:
var shell_array = n.GetAttachedShells(true);
Keywords 1152
March 2016
Node
Node class
Arguments
Name Type
Description
Flag
Return type
Array of Node objects
Example
To make an array of Node objects for all of the nodes in model m flagged with f
var n = Node.GetFlagged(m, f);
GetFreeEdgeNodes()
Description
If the node is on a shell free edge then GetFreeEdgeNodes returns all of the nodes on the hole/boundary in order.
Arguments
No arguments
Return type
Array of Node objects (or null if not on a shell free edge).
Example
To find all the nodes on the hole/boundary that node n is on:
var node_array = n.GetFreeEdgeNodes();
Arguments
Name
Type
Description
Model
number integer number of the node you want the Node object for
Return type
Node object (or null if node does not exist).
March 2016
Keywords 1153
Node class
Node
Example
To get the Node object for node 100 in model m
var n = Node.GetFromID(m, 100);
GetInitialVelocities()
Description
Returns the initial velocity of the node. You need to be sure the field nvels of the node is populate before to use
GetInitialVelocities. To do so you can use Model.PopNodeVels .
Arguments
No arguments
Return type
Array with the 3 translations and 3 rotations velocities.
Example
To get the initial velocity of the node n:
var vel = n.GetInitialVelocities();
GetParameter(prop[node property])
Description
Checks if a Node 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 Node.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Node property n.example is a parameter:
Options.property_parameter_names = true;
if (n.GetParameter(n.example) ) do_something...
Options.property_parameter_names = false;
To check if Node property n.example is a parameter by using the GetParameter method:
if (n.ViewParameters().GetParameter(n.example) ) do_something...
GetReferenceGeometry()
Description
Returns the airbag reference geometry of the node
Keywords 1154
March 2016
Node
Node class
Arguments
No arguments
Return type
The reference geometry ID (or 0 if it hasnt got any)
Example
To get the reference geometry of the node n:
var a = n.GetReferenceGeometry();
Keyword()
Description
Returns the keyword for this node (*NODE, *NODE_SCALAR or *NODE_SCALAR_VALUE). Note that a carriage
return is not added. See also Node.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for node n:
var key = n.Keyword();
KeywordCards()
Description
Returns the keyword cards for the node. Note that a carriage return is not added. See also Node.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for node n:
var cards = n.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last node in the model.
March 2016
Keywords 1155
Node class
Node
Arguments
Name Type
Description
Return type
Node object (or null if there are no nodes in the model).
Example
To get the last node in model m:
var n = Node.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Node label.
Example
To get the last free node label in model m:
var label = Node.LastFreeLabel(m);
Keywords 1156
March 2016
Node
Node class
Arguments
Name
Type
Description
Model
flag
Flag
dist
float
label
(optional)
integer Label to keep after merge. If > 0 then highest label kept. If <= 0 then lowest kept. If omitted
the lowest label will be kept.
position
(optional)
integer Position to merge at. If > 0 then merged at highest label position. If < 0 then merged at lowest
label position. If 0 then merged at midpoint. If omitted the merge will be done at the lowest
label.
Return type
The number of nodes merged
Example
To (try to) merge nodes in model m flagged with flag f, with a distance of 0.1:
Node.Merge(m, f, 0.1);
Next()
Description
Returns the next node in the model.
Arguments
No arguments
Return type
Node object (or null if there are no more nodes in the model).
Example
To get the node in model m after node n:
var n = n.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Node label.
March 2016
Keywords 1157
Node class
Node
Example
To get the next free node label in model m:
var label = Node.NextFreeLabel(m);
NodalMass()
Description
Get the mass of a node. This will be the sum of the structural element mass attached to the node plus any lumped mass.
If called on the node of a PART_INERTIA or NRBC_INERTIA, this function will return the mass of the part/nrbc, as
nodal mass has no meaning in this context.
Arguments
No arguments
Return type
float
Example
To get the mass for node n:
var mass = n.NodalMass();
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the node can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Node object (or null if not picked)
Example
To pick a node from model m giving the prompt Pick node from screen:
var n = Node.Pick(Pick node from screen, m);
Keywords 1158
March 2016
Node
Node class
Previous()
Description
Returns the previous node in the model.
Arguments
No arguments
Return type
Node object (or null if there are no more nodes in the model).
Example
To get the node in model m before node n:
var n = n.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the nodes in model m, from 1000000:
Node.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged nodes will be renumbered in
flag
Flag
start
Return type
No return value
March 2016
Keywords 1159
Node class
Node
Example
To renumber all of the nodes in model m flagged with f, from 1000000:
Node.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only nodes from that model can be selected. If the argument
Flag
is a Flag then only nodes that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any nodes can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of nodes selected or null if menu cancelled
Example
To select nodes from model m, flagging those selected with flag f, giving the prompt Select nodes:
Node.Select(f, Select nodes, m);
To select nodes, flagging those selected with flag f but limiting selection to nodes flagged with flag l, giving the prompt
Select nodes:
Node.Select(f, Select nodes, l);
SetFlag(flag[Flag])
Description
Sets a flag on the node.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for node n:
n.SetFlag(f);
Keywords 1160
March 2016
Node
Node class
Sketch(redraw (optional)[boolean])
Description
Sketches the node. The node will be sketched until you either call Node.Unsketch(), Node.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the node is sketched. If omitted redraw is true. If you
want to sketch several nodes and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch node n:
n.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing nodes should be counted. If false or omitted referenced but undefined
nodes will also be included in the total.
Return type
number of nodes
Example
To get the total number of nodes in model m:
var total = Node.Total(m);
Unblank()
Description
Unblanks the node
Arguments
No arguments
Return type
No return value
March 2016
Keywords 1161
Node class
Node
Example
To unblank node n:
n.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the nodes in model m:
Node.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the nodes in model m flagged with f:
Node.UnblankFlagged(m, f);
Keywords 1162
March 2016
Node
Node class
Arguments
Name Type
Description
Model Model Model that the defined flag for all nodes will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the nodes in model m:
Node.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the node.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the node is unsketched. If omitted redraw is true. If
you want to unsketch several nodes and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To unsketch node n:
n.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the nodes 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().
Return type
No return value
March 2016
Keywords 1163
Node class
Node
Example
To unsketch all nodes in model m:
Node.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Node object.
Example
To check if Node property n.example is a parameter by using the Node.GetParameter() method:
if (n.ViewParameters().GetParameter(n.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for node n:
n.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this node.
Arguments
No arguments
Keywords 1164
March 2016
Node
Node class
Return type
Xrefs object.
Example
To get the cross references for node n:
var xrefs = n.Xrefs();
toString()
Description
Creates a string containing the node data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Node.Keyword() and Node.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for node n in keyword format
var s = n.toString();
March 2016
Keywords 1165
Parameter class
Parameter
Parameter class
The Parameter class allows you to access the parameters in a model. More...
Class functions
FlagAll(Model[Model], flag[Flag])
GetAll(Model[Model])
GetFromName(Model[Model], parameter name[string])
UnflagAll(Model[Model], flag[Flag])
Member functions
ClearFlag(flag[Flag])
Flagged(flag[Flag])
Keyword()
KeywordCards()
SetFlag(flag[Flag])
Xrefs()
toString()
Parameter constants
Name
Description
Parameter is an integer.
Parameter.REAL
Parameter is a real.
Parameter properties
Name
Type
Description
expression (read
only)
logical
include
integer
model
integer
string
Parameter name.
constant
value
integer/real/string Parameter value. The value will be a string for parameter expressions, or a
number for normal parameters.
Detailed Description
The Parameter class allows to create and query parameters in a model. See the documentation below for more details.
Constructor
new Parameter(Model[Model], name[string], type[constant],
expression[boolean], value[integer/float/string])
Description
Create a new Parameter object.
Keywords 1166
March 2016
Parameter
Parameter class
Arguments
Name
Type
Description
Model
Model
name
string
Parameter name
type
constant
expression boolean
value
integer/float/string Parameter value. The value will be a string for character parameters or parameter
expressions, or a number for integer or real parameters.
Return type
Parameter object
Example
To create a new real parameter THK in model m with value 5.0
var p = new Parameter(m, "THK", Parameter.REAL, false, 5.0);
Details of functions
ClearFlag(flag[Flag])
Description
Clears a flag on the parameter.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for parameter p:
p.ClearFlag(f);
Arguments
Name Type
Description
Flag
March 2016
Keywords 1167
Parameter class
Parameter
Return type
No return value
Example
To flag all of the parameters with flag f in model m:
Parameter.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the parameter is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if parameter p has flag f set on it:
if (p.Flagged(f) ) do_something...
GetAll(Model[Model]) [static]
Description
Returns an array of Parameter objects for all of the parameters in a model in Primer
Arguments
Name Type
Description
Return type
Array of Parameter objects
Example
To make an array of Parameter objects for all of the parameters in model m
var p = Parameter.GetAll(m);
Keywords 1168
March 2016
Parameter
Parameter class
Arguments
Name
Type
Description
Model
parameter name string name of the parameter you want the Parameter object for
Return type
Parameter object (or null if parameter does not exist).
Example
To get the Parameter object for parameter "THK" in model m
var p = Parameter.GetFromName(m, "THK");
Keyword()
Description
Returns the keyword for this parameter (*PARAMETER, *PARAMETER_EXPRESSION). Note that a carriage
return is not added. See also Parameter.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for parameter p:
var key = p.Keyword();
KeywordCards()
Description
Returns the keyword cards for the parameter. Note that a carriage return is not added. See also Parameter.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for parameter p:
var cards = p.KeywordCards();
SetFlag(flag[Flag])
Description
Sets a flag on the parameter.
March 2016
Keywords 1169
Parameter class
Parameter
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for parameter p:
p.SetFlag(f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all parameters will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all of the parameters in model m:
Parameter.UnflagAll(m, f);
Xrefs()
Description
Returns the cross references for this parameter.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for parameter p:
var xrefs = p.Xrefs();
Keywords 1170
March 2016
Parameter
Parameter class
toString()
Description
Creates a string containing the parameter data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Parameter.Keyword() and Parameter.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for parameter p in keyword format
var s = p.toString();
March 2016
Keywords 1171
Part class
Part
Part class
The Part class gives you access to part cards in PRIMER. More...
Class functions
Member functions
AllTableProperties(Model[Model])
Blank()
Blanked()
Browse(modal (optional)[boolean])
CentreOfGravity(sum (optional)[boolean])
ClearFlag(flag[Flag])
ClosestNode(x[float], y[float], z[float])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
FlaggedTableProperties(Model[Model], flag[Flag])
GetCompositeData(ipt[integer])
GetParameter(prop[part property])
Keyword()
KeywordCards()
Mass()
MaxMin()
Next()
Previous()
RemoveCompositeData(ipt[integer])
SetCompositeData(ipt[integer], mid[integer], thick[real], beta[real], tmid (optinal)[integer], plyid
(optional)[integer])
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
TableProperties()
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Part properties
Name
Keywords 1172
Type
Description
March 2016
Part
adpopt
integer
Adaptivity flag
ansid
integer
attachment_
nodes
logical
averaged
logical
cid
integer
cmsn
integer
CAL3D/MADYMO number
colour
Colour
composite
logical
Part class
composite_long logical
contact
logical
dc
real
element_type
string
The type of elements the Part contains. e.g. "SHELL", "SOLID" or null if empty/no
section (read only).
elform
integer
Element formulation
eosid
integer or
string
exists
logical
true if part exists, false if referred to but not defined. (read only)
fd
real
fs
real
grav
integer
Gravity loading
heading
string
Part heading
hgid
integer or
string
Hourglass number/string
hmname
string
Hypermesh comment read from keyword file for Part (or null if doesnt exist).
include
integer
inertia
logical
ircs
integer
ixx
real
ixy
real
ixz
real
iyy
real
iyz
real
izz
real
label
integer
Part number. Also see the pid property which is an alternative name for this.
marea
float
mdep
integer
mid
integer or
string
Material number/string
model
integer
movopt
integer
March 2016
Keywords 1173
Part class
Part
nip
integer
nloc
integer
nodeid
integer
optt
real
Contact thickness
pid
integer
Part number. Also see the label property which is an alternative name for this.
prbf
integer
logical
reposition
logical
rigid
logical
secid
integer or
string
Section number/string
sft
real
shrf
real
ssf
real
thshel
integer
tmid
integer or
string
transparency
integer
tshear
integer
tshell
logical
vc
real
vrx
real
x rotational velocity
vry
real
y rotational velocity
vrz
real
z rotational velocity
vtx
real
x translational velocity
vty
real
y translational velocity
vtz
real
z translational velocity
xc
real
xl
real
xlip
real
yc
real
yl
real
ylip
real
zc
real
zl
real
zlip
real
Detailed Description
The Part class allows you to create, modify, edit and manipulate part cards. See the documentation below for more
details.
Keywords 1174
March 2016
Part
Part class
Constructor
new Part(Model[Model], pid[integer], secid[integer/string], mid[integer/string],
heading (optional)[string])
Description
Create a new Part object.
Arguments
Name
Type
Description
Model
Model
pid
integer
Part number
secid
mid
Return type
Part object
Example
To create a new part called Example in model m with label 100, section 1, material 10:
var p = new Part(m, 100, 1, 10, Example);
Details of functions
AllTableProperties(Model[Model])
Description
Returns all of the properties available in the part table for the parts. The table values are returned in an array of objects
(an object for each part). The object property names are the same as the table headers but spaces are replaced with
underscore characters and characters other than 0-9, a-z and A-Z are removed to ensure that the property name is valid
in JavaScript. If a table value is undefined the property value will be the JavaScript undefined value. If the table value is
a valid number it will be a number, otherwise the value will returned as a string.
Arguments
Name Type
Description
Return type
array of objects
March 2016
Keywords 1175
Part class
Part
Example
To get all of the properties for parts in model m:
var properties = Part.AllTableProperties(m);
for (var p=0; p<properties.length; p++)
{
for (var x in properties[p])
{
Message(x+"="+properties[p][x]);
}
}
Blank()
Description
Blanks the part
Arguments
No arguments
Return type
No return value
Example
To blank part p:
p.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the parts in model m:
Part.BlankAll(m);
Keywords 1176
March 2016
Part
Part class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the parts in model m flagged with f:
Part.BlankFlagged(m, f);
Blanked()
Description
Checks if the part is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if part p is blanked:
if (p.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse part p:
p.Browse();
March 2016
Keywords 1177
Part class
Part
CentreOfGravity(sum (optional)[boolean])
Description
Returns the centre of gravity for a part.
Arguments
Name
Type
Description
sum
(optional)
boolean If set, centre of gravity included lumped mass, mass of nodes which are attached to rigid parts
or nodal rigid bodies and timestep added mass, otherwise it will be only from structural mass. If
omitted, centre of gravity calculate only from structural mass.
Return type
An array containing the x, y and z coordinates for the CofG.
Example
To get the centre of gravity for part p:
var
var
var
var
cofg = p.CentreOfGravity();
x = cofg[0];
y = cofg[1];
z = cofg[2];
ClearFlag(flag[Flag])
Description
Clears a flag on the part.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for part p:
p.ClearFlag(f);
Arguments
Name Type Description
x
Keywords 1178
March 2016
Part
Part class
Return type
ID of Node or null if part has no nodes
Example
To find the node on part p closest to point (1, 2, 3):
var n = p.ClosestNode(1, 2, 3);
Copy(range (optional)[boolean])
Description
Copies the part.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy part p into part z:
var z = p.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Part object (or null if not made)
Example
To start creating a part in model m:
var p = Part.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
March 2016
Keywords 1179
Part class
Part
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit part p:
p.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for part p:
p.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first part in the model.
Arguments
Name Type
Description
Return type
Part object (or null if there are no parts in the model).
Example
To get the first part in model m:
var p = Part.First(m);
Keywords 1180
March 2016
Part
Part class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Part label.
Example
To get the first free part label in model m:
var label = Part.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the parts with flag f in model m:
Part.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the part is flagged or not.
Arguments
Name Type Description
flag
March 2016
Keywords 1181
Part class
Part
Return type
true if flagged, false if not.
Example
To check if part p has flag f set on it:
if (p.Flagged(f) ) do_something...
FlaggedTableProperties(Model[Model], flag[Flag])
Description
Returns all of the properties available in the part table for the flagged parts. The table values are returned in an array of
objects (an object for each part). The object property names are the same as the table headers but spaces are replaced
with underscore characters and characters other than 0-9, a-z and A-Z are removed to ensure that the property name is
valid in JavaScript. If a table value is undefined the property value will be the JavaScript undefined value. If the table
value is a valid number it will be a number, otherwise the value will returned as a string.
Arguments
Name Type
Description
Flag
Return type
array of objects
Example
To get all of the properties for parts in model m flagged with f:
var properties = Part.FlaggedTableProperties(m, f);
for (var p=0; p<properties.length; p++)
{
for (var x in properties[p])
{
Message(x+"="+properties[p][x]);
}
}
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
Keywords 1182
An optional extra object/array/string etc that will appended to arguments when calling the
function
March 2016
Part
Part class
Return type
No return value
Example
To call function test for all of the parts in model m:
Part.ForEach(m, test);
function test(p)
{
// p is Part object
}
To call function test for all of the parts in model m with optional object:
var data = { x:0, y:0 };
Part.ForEach(m, test, data);
function test(p, extra)
{
// p is Part object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Part objects for all of the parts in a model in Primer
Arguments
Name Type
Description
Return type
Array of Part objects
Example
To make an array of Part objects for all of the parts in model m
var p = Part.GetAll(m);
GetCompositeData(ipt[integer])
Description
Returns the composite data for an integration point in *PART_COMPOSITE.
Arguments
Name Type
ipt
Description
integer The integration point you want the data for. Note that integration points start at 0, not 1.
Return type
An array containing the material id, thickness, beta angle and thermal material. If the _COMPOSITE_LONG option is
set, then the array returned will also contain the ply ID.
March 2016
Keywords 1183
Part class
Part
Example
To get the composite data for the 3rd integration point for part p:
if (p.composite && p.nip >= 3)
{
var ipt_data = p.GetCompositeData(2);
}
Arguments
Name Type
Description
Flag
Return type
Array of Part objects
Example
To make an array of Part objects for all of the parts in model m flagged with f
var p = Part.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the part you want the Part object for
Return type
Part object (or null if part does not exist).
Example
To get the Part object for part 100 in model m
var p = Part.GetFromID(m, 100);
Keywords 1184
March 2016
Part
Part class
GetParameter(prop[part property])
Description
Checks if a Part 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 Part.ViewParameters() method and method chaining (see
the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Part property p.example is a parameter:
Options.property_parameter_names = true;
if (p.GetParameter(p.example) ) do_something...
Options.property_parameter_names = false;
To check if Part property p.example is a parameter by using the GetParameter method:
if (p.ViewParameters().GetParameter(p.example) ) do_something...
Keyword()
Description
Returns the keyword for this part (*PART, *PART_SCALAR or *PART_SCALAR_VALUE). Note that a carriage
return is not added. See also Part.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for part p:
var key = p.Keyword();
KeywordCards()
Description
Returns the keyword cards for the part. Note that a carriage return is not added. See also Part.Keyword()
Arguments
No arguments
March 2016
Keywords 1185
Part class
Part
Return type
string containing the cards.
Example
To get the cards for part p:
var cards = p.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last part in the model.
Arguments
Name Type
Description
Return type
Part object (or null if there are no parts in the model).
Example
To get the last part in model m:
var p = Part.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Part label.
Example
To get the last free part label in model m:
var label = Part.LastFreeLabel(m);
Keywords 1186
March 2016
Part
Part class
Mass()
Description
Returns the mass properties for a part. The object properties are:
Struct_Mass
NS_Mass
Assign_Mass
Transferred_Mass
Dyna_Part_Mass
Lumped_Mass
Component_Mass
NRB_Mass
Dyna_Added_Mass
See the part table for descriptions of what these different masses are.
Arguments
No arguments
Return type
An object containing the different mass properties of the part or null if the mass cannot be calculated (e.g. part is empty)
Example
To get the structural mass for part p:
var mprops = p.Mass();
var struct_mass = mprops.Struct_Mass;
MaxMin()
Description
Returns the max and min boundas of a part
Arguments
No arguments
Return type
An array containing the xMin, xMax, yMin, yMax, zMin and zMax coordinates for a box bounding the part.
Example
To get the bounds for part p:
var
var
var
var
var
var
var
bounds
xMin =
xMax =
yMin =
yMax =
zMin =
zMax =
= p.MaxMin();
bounds[0];
bounds[1];
bounds[2];
bounds[3];
bounds[4];
bounds[5];
Next()
Description
Returns the next part in the model.
March 2016
Keywords 1187
Part class
Part
Arguments
No arguments
Return type
Part object (or null if there are no more parts in the model).
Example
To get the part in model m after part p:
var p = p.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Part label.
Example
To get the next free part label in model m:
var label = Part.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the part can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
Keywords 1188
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.
March 2016
Part
Part class
Return type
Part object (or null if not picked)
Example
To pick a part from model m giving the prompt Pick part from screen:
var p = Part.Pick(Pick part from screen, m);
Previous()
Description
Returns the previous part in the model.
Arguments
No arguments
Return type
Part object (or null if there are no more parts in the model).
Example
To get the part in model m before part p:
var p = p.Previous();
RemoveCompositeData(ipt[integer])
Description
Removes the composite data for an integration point in *PART_COMPOSITE.
Arguments
Name Type
ipt
Description
integer The integration point you want to remove. Note that integration points start at 0, not 1.
Return type
No return value.
Example
To remove the composite data for the 3rd integration point for part p:
p.RemoveCompositeData(2);
March 2016
Keywords 1189
Part class
Part
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the parts in model m, from 1000000:
Part.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged parts will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the parts in model m flagged with f, from 1000000:
Part.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only parts from that model can be selected. If the argument is
Flag
a Flag then only parts that are flagged with limit can be selected (limit should be different to
flag). If omitted, or null, any parts can be selected. from any model.
modal
(optional)
boolean
Keywords 1190
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.
March 2016
Part
Part class
Return type
Number of parts selected or null if menu cancelled
Example
To select parts from model m, flagging those selected with flag f, giving the prompt Select parts:
Part.Select(f, Select parts, m);
To select parts, flagging those selected with flag f but limiting selection to parts flagged with flag l, giving the prompt
Select parts:
Part.Select(f, Select parts, l);
Arguments
Name
Type
Description
ipt
integer The integration point you want to set the data for. Note that integration points start at 0,
not 1.
mid
thick
real
beta
real
tmid (optinal)
plyid
(optional)
integer Ply ID for the integration point. This should be used if the _COMPOSITE_LONG option is
set for the part.
Return type
No return value.
Example
To set the composite data for the 3rd integration point to mat 1, thickness 0.5 and angle 45, for part p:
p.SetCompositeData(2, 1, 0.5, 45);
SetFlag(flag[Flag])
Description
Sets a flag on the part.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Keywords 1191
Part class
Part
Example
To set flag f for part p:
p.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the part. The part will be sketched until you either call Part.Unsketch(), Part.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the part is sketched. If omitted redraw is true. If you
want to sketch several parts and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To sketch part p:
p.Sketch();
TableProperties()
Description
Returns all of the properties available for the part in the part table. The table values are returned in an object. The object
property names are the same as the table headers but spaces are replaced with underscore characters and characters
other than 0-9, a-z and A-Z are removed to ensure that the property name is valid in JavaScript. If a table value is
undefined the property value will be the JavaScript undefined value. If the table value is a valid number it will be a
number, otherwise the value will returned as a string.
Arguments
No arguments
Return type
object.
Example
To get all of the properties for part p:
var properties = p.TableProperties();
for (var x in properties)
{
Message(x+"="+properties[x]);
}
Keywords 1192
March 2016
Part
Part class
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing parts should be counted. If false or omitted referenced but undefined
parts will also be included in the total.
Return type
number of parts
Example
To get the total number of parts in model m:
var total = Part.Total(m);
Unblank()
Description
Unblanks the part
Arguments
No arguments
Return type
No return value
Example
To unblank part p:
p.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the parts in model m:
Part.UnblankAll(m);
March 2016
Keywords 1193
Part class
Part
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the parts in model m flagged with f:
Part.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all parts will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the parts in model m:
Part.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the part.
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the part is unsketched. If omitted redraw is true. If you
want to unsketch several parts and only redraw after the last one then use false for redraw and
call View.Redraw().
Keywords 1194
Description
March 2016
Part
Part class
Return type
No return value
Example
To unsketch part p:
p.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the parts 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().
Return type
No return value
Example
To unsketch all parts in model m:
Part.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Part object.
Example
To check if Part property p.example is a parameter by using the Part.GetParameter() method:
if (p.ViewParameters().GetParameter(p.example) ) do_something...
March 2016
Keywords 1195
Part class
Part
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for part p:
p.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this part.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for part p:
var xrefs = p.Xrefs();
toString()
Description
Creates a string containing the part data in keyword format. Note that this contains the keyword header and the keyword
cards. See also Part.Keyword() and Part.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for part p in keyword format
var str = p.toString();
Keywords 1196
March 2016
Rigidwall
Rigidwall class
Rigidwall class
The Rigidwall class gives you access to rigidwall cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
FindNodesBehind(flag[Flag])
Flagged(flag[Flag])
GetParameter(prop[rigidwall property])
Keyword()
KeywordCards()
Next()
Previous()
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Rigidwall constants
Name
Description
Rigidwall is *RIGIDWALL_GEOMETRIC_FLAT.
Rigidwall.PLANAR
Rigidwall is *RIGIDWALL_PLANAR.
Rigidwall.PRISM
Rigidwall is *RIGIDWALL_GEOMETRIC_PRISM.
Rigidwall.SPHERE
Rigidwall is *RIGIDWALL_GEOMETRIC_SPHERE.
March 2016
Keywords 1197
Rigidwall class
Rigidwall
Rigidwall properties
Name
Type
Description
birth
float
Birth time.
boxid
integer
d1
float
d2
float
d3
float
death
float
Death time.
decaya
float
decayb float
dfrica
float
dfricb
float
display logical
DISPLAY flag.
float
exists
logical
true if rigidwall exists, false if referred to but not defined. (read only)
finite
logical
Finite flag.
forces
logical
Forces flag.
fric
float
Friction coefficient.
heading string
Rigidwall heading
id
logical
include integer
label
integer
Rigidwall number.
lcid
integer
lencyl
float
Length of cylinder.
lenl
float
Length of L edge.
lenm
float
Length of M edge.
lenp
float
mass
float
model
integer
motion logical
Motion flag.
moving logical
Moving flag.
n1
integer
n2
integer
n3
integer
n4
integer
node1
integer
node2
integer
nsid
integer
Keywords 1198
March 2016
Rigidwall
Rigidwall class
nsidex
integer
offset
float
opt
integer
Motion type.
ortho
logical
Ortho flag.
pid
integer
pr
float
radcyl
float
Radius of cylinder.
radsph
float
Radius of sphere.
ro
float
rwid
integer
rwksf
float
sfrica
float
sfricb
float
soft
integer
ssid
integer
type
v0
float
Initial velocity.
vx
float
vy
float
vz
float
wvel
float
xh
float
xhev
float
xt
float
yh
float
yhev
float
yt
float
zh
float
zhev
float
zt
float
Detailed Description
The Rigidwall class allows you to create, modify, edit rigidwall cards. See the documentation below for more details.
Constructor
new Rigidwall(Model[Model], type[constant], nsid (optional)[integer], rwid
(optional)[integer], heading (optional)[string])
Description
Create a new Rigidwall object.
March 2016
Keywords 1199
Rigidwall class
Rigidwall
Arguments
Name
Type
Description
Model
Model
type
rwid
(optional)
integer
Rigidwall number
heading
(optional)
string
Return type
Rigidwall object
Example
To create a new rigidwall 200 of type GEOMETRIC_SPHERE in model m using node set 100 having the title "test
wall"
var r = new Rigidwall(m, Rigidwall.SPHERE, 200, 100, "test wall");
Details of functions
Blank()
Description
Blanks the rigidwall
Arguments
No arguments
Return type
No return value
Example
To blank rigidwall r:
r.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Keywords 1200
March 2016
Rigidwall
Rigidwall class
Return type
No return value
Example
To blank all of the rigidwalls in model m:
Rigidwall.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the rigidwalls in model m flagged with f:
Rigidwall.BlankFlagged(m, f);
Blanked()
Description
Checks if the rigidwall is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if rigidwall r is blanked:
if (r.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
March 2016
Keywords 1201
Rigidwall class
Rigidwall
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse rigidwall r:
r.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the rigidwall.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for rigidwall r:
r.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the rigidwall.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy rigidwall r into rigidwall z:
var z = r.Copy();
Keywords 1202
March 2016
Rigidwall
Rigidwall class
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Rigidwall object (or null if not made)
Example
To start creating a rigidwall in model m:
var r = Rigidwall.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit rigidwall r:
r.Edit();
Arguments
Name
Type Description
message
Return type
No return value
March 2016
Keywords 1203
Rigidwall class
Rigidwall
Example
To add an error message "My custom error" for rigidwall r:
r.Error("My custom error");
FindNodesBehind(flag[Flag])
Description
Flags nodes that are behind a rigidwall
Arguments
Name Type Description
flag
Return type
Number of nodes found
Example
To set flag f on nodes behind rigidwall w:
w.FlagNodesBehind(f);
First(Model[Model]) [static]
Description
Returns the first rigidwall in the model.
Arguments
Name Type
Description
Return type
Rigidwall object (or null if there are no rigidwalls in the model).
Example
To get the first rigidwall in model m:
var r = Rigidwall.First(m);
Keywords 1204
March 2016
Rigidwall
Rigidwall class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Rigidwall label.
Example
To get the first free rigidwall label in model m:
var label = Rigidwall.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the rigidwalls with flag f in model m:
Rigidwall.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the rigidwall is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if rigidwall r has flag f set on it:
if (r.Flagged(f) ) do_something...
March 2016
Keywords 1205
Rigidwall class
Rigidwall
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the rigidwalls in model m:
Rigidwall.ForEach(m, test);
function test(r)
{
// r is Rigidwall object
}
To call function test for all of the rigidwalls in model m with optional object:
var data = { x:0, y:0 };
Rigidwall.ForEach(m, test, data);
function test(r, extra)
{
// r is Rigidwall object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Rigidwall objects for all of the rigidwalls in a model in Primer
Arguments
Name Type
Description
Return type
Array of Rigidwall objects
Example
To make an array of Rigidwall objects for all of the rigidwalls in model m
var r = Rigidwall.GetAll(m);
Keywords 1206
March 2016
Rigidwall
Rigidwall class
Arguments
Name Type
Description
Flag
Return type
Array of Rigidwall objects
Example
To make an array of Rigidwall objects for all of the rigidwalls in model m flagged with f
var r = Rigidwall.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the rigidwall you want the Rigidwall object for
Return type
Rigidwall object (or null if rigidwall does not exist).
Example
To get the Rigidwall object for rigidwall 100 in model m
var r = Rigidwall.GetFromID(m, 100);
GetParameter(prop[rigidwall property])
Description
Checks if a Rigidwall 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 Rigidwall.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
March 2016
Keywords 1207
Rigidwall class
Rigidwall
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Rigidwall property r.example is a parameter:
Options.property_parameter_names = true;
if (r.GetParameter(r.example) ) do_something...
Options.property_parameter_names = false;
To check if Rigidwall property r.example is a parameter by using the GetParameter method:
if (r.ViewParameters().GetParameter(r.example) ) do_something...
Keyword()
Description
Returns the keyword for this Rigidwall (*RIGIDWALL). Note that a carriage return is not added. See also
Rigidwall.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for Rigidwall pm:
var key = r.Keyword();
KeywordCards()
Description
Returns the keyword cards for the Rigidwall. Note that a carriage return is not added. See also Rigidwall.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for Rigidwall pm:
var cards = r.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last rigidwall in the model.
Keywords 1208
March 2016
Rigidwall
Rigidwall class
Arguments
Name Type
Description
Return type
Rigidwall object (or null if there are no rigidwalls in the model).
Example
To get the last rigidwall in model m:
var r = Rigidwall.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Rigidwall label.
Example
To get the last free rigidwall label in model m:
var label = Rigidwall.LastFreeLabel(m);
Next()
Description
Returns the next rigidwall in the model.
Arguments
No arguments
Return type
Rigidwall object (or null if there are no more rigidwalls in the model).
Example
To get the rigidwall in model m after rigidwall r:
var r = r.Next();
March 2016
Keywords 1209
Rigidwall class
Rigidwall
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Rigidwall label.
Example
To get the next free rigidwall label in model m:
var label = Rigidwall.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the Rigidwall can be picked from any model.
modal
(optional)
boolean 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.
Return type
Rigidwall object (or null if not picked)
Example
To pick a Rigidwall from model m giving the prompt Pick Rigidwall from screen:
var r = Rigidwall.Pick(Pick Rigidwall from screen, m);
Previous()
Description
Returns the previous rigidwall in the model.
Arguments
No arguments
Keywords 1210
March 2016
Rigidwall
Rigidwall class
Return type
Rigidwall object (or null if there are no more rigidwalls in the model).
Example
To get the rigidwall in model m before rigidwall r:
var r = r.Previous();
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the rigidwalls in model m, from 1000000:
Rigidwall.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged rigidwalls will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the rigidwalls in model m flagged with f, from 1000000:
Rigidwall.RenumberFlagged(m, f, 1000000);
March 2016
Keywords 1211
Rigidwall class
Rigidwall
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only rigidwalls from that model can be selected. If the
Flag
argument is a Flag then only rigidwalls that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any rigidwalls can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of rigidwalls selected or null if menu cancelled
Example
To select rigidwalls from model m, flagging those selected with flag f, giving the prompt Select rigidwalls:
Rigidwall.Select(f, Select rigidwalls, m);
To select rigidwalls, flagging those selected with flag f but limiting selection to rigidwalls flagged with flag l, giving the
prompt Select rigidwalls:
Rigidwall.Select(f, Select rigidwalls, l);
SetFlag(flag[Flag])
Description
Sets a flag on the rigidwall.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for rigidwall r:
r.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the rigidwall. The rigidwall will be sketched until you either call Rigidwall.Unsketch(),
Rigidwall.UnsketchAll(), Model.UnsketchAll(), or delete the model
Keywords 1212
March 2016
Rigidwall
Rigidwall class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the rigidwall is sketched. If omitted redraw is true. If
you want to sketch several rigidwalls and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch rigidwall r:
r.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing rigidwalls should be counted. If false or omitted referenced but undefined
rigidwalls will also be included in the total.
Return type
number of rigidwalls
Example
To get the total number of rigidwalls in model m:
var total = Rigidwall.Total(m);
Unblank()
Description
Unblanks the rigidwall
Arguments
No arguments
Return type
No return value
Example
To unblank rigidwall r:
r.Unblank();
March 2016
Keywords 1213
Rigidwall class
Rigidwall
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the rigidwalls in model m:
Rigidwall.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the rigidwalls in model m flagged with f:
Rigidwall.UnblankFlagged(m, f);
Keywords 1214
March 2016
Rigidwall
Rigidwall class
Arguments
Name Type
Description
Model Model Model that the defined flag for all rigidwalls will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the rigidwalls in model m:
Rigidwall.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the rigidwall.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the rigidwall is unsketched. If omitted redraw is true.
If you want to unsketch several rigidwalls and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch rigidwall r:
r.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the rigidwalls 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().
Return type
No return value
March 2016
Keywords 1215
Rigidwall class
Rigidwall
Example
To unsketch all rigidwalls in model m:
Rigidwall.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Rigidwall object.
Example
To check if Rigidwall property r.example is a parameter by using the Rigidwall.GetParameter() method:
if (r.ViewParameters().GetParameter(r.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for rigidwall r:
r.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this rigidwall.
Arguments
No arguments
Keywords 1216
March 2016
Rigidwall
Rigidwall class
Return type
Xrefs object.
Example
To get the cross references for rigidwall r:
var xrefs = r.Xrefs();
toString()
Description
Creates a string containing the Rigidwall data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Rigidwall.Keyword() and Rigidwall.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for Rigidwall pm in keyword format
var r = r.toString();
March 2016
Keywords 1217
Section class
Section
Section class
The Section class gives you access to section cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetBetaData(ipt[integer])
GetLmcData(i[integer])
GetParameter(prop[section property])
GetPointData(ipt[integer])
GetUserData(ipt[integer])
Keyword()
KeywordCards()
Next()
Previous()
SetBetaData(ipt[integer], beta[float])
SetFlag(flag[Flag])
SetLmcData(ipt[integer], lmc[float])
SetPointData(ipt[integer], nodeid[integer], vecid[integer], area[real])
SetUserData(ipt[integer], xi[real], eta[real], zeta (SOLID) or
wgt (SHELL)[real], wgt (SOLID only)[real])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Section constants
Name
Description
Section.ALE1D
Keywords 1218
March 2016
Section
Section.ALE2D
Section.BEAM
Section.DISCRETE
Section class
Section.SHELL
Section.SOLID
Section.SPH
Section.TSHELL
Section properties
Name
Type
Description
aafac
float
aet
integer
afac
float
ale
logical
aleform
integer
baselm
integer
bfac
float
cfac
float
cmid
integer
colour
Colour
dfac
float
domint
integer
dx
float
dy
float
dz
float
efac
float
efg
logical
elform
integer
end
float
exists
logical
true if section exists, false if referred to but not defined. (read only)
failcr
integer
fs
float
icomp
integer
idam
integer
idila
integer
idim
integer
iebt
integer
Keywords 1219
Section class
Section
ihgf
integer
iloc
integer
include
integer
ispline
integer
itaj
integer
ithelfm
integer
iunf
integer
kernel
integer
label
integer
Section ID (all types). Also see the secid property which is an alternative name for this.
lmc
integer
lprint
integer
lscale
float
model
integer
nhsv
integer
nip
integer
nipp
integer
nxdof
integer
propcr
integer
propt
real
qr
real
secid
integer
Section ID (all types). Also see the label property which is an alternative name for this.
shrf
real
smstep
integer
start
float
stretch
float
swtime
float
thermal
logical
thick
real
title
string
toldef
float
transparency
integer
type (read
only)
xfem
logical
Type
Description
float
Keywords 1220
March 2016
Section
aisc
Section class
aisc_label string
ca
float
Cable area
cid
cst
float
d1
float
d2
float
d3
float
d4
float
d5
float
d6
float
dofn1
float
dofn2
float
iner
float
iovpr
integer Print flag for the elbow ovalization degrees of freedom (elform 14)
iprstr
integer Flag for adding stress due to pressure into the material routine (elform 14)
irr
float
Irr
iss
float
Iss
ist
float
Ist
itt
float
Itt
iw
float
Warping constant
iwr
float
Warping constant
iyr
float
IYR integral
izr
float
IZR integral
float
torsional constant
nsloc
float
nsm
float
ntloc
float
offset
float
pr
float
float
rampt
float
rrcon
float
r rotational constraint
sa
float
Shear area
scoor
float
srcon
float
s rotational constraint
stress
float
stype
string
Section type
trcon
float
t rotational constraint
ts1
float
ts2
float
Keywords 1221
Section class
Section
tt1
float
tt2
float
vol
float
ys
float
zs
float
Description
cdl
float
cl
float
Clearance
dro
fd
float
Failure deflection
kd
float
tdl
float
v0
float
Test velocity
Type
Description
lcidt
lcidvel
real
March 2016
Section
Name Type
Section class
Description
real
marea real
nloc
setyp
t1
real
Thickness at Node 1
t2
real
Thickness at Node 2
t3
real
Thickness at Node 3
t4
real
Thickness at Node 4
Description
ds
float
Displacement jump
ecut
float
Minimum distance to the node that a crack surface can cut to the edge
ibr
integer Branching
iken
integer approximation
ips
sf
float
stime float
Failure strain
Time to switch from stabilized EFG to standard EFG formulation
Type
Description
cslh
float
death
float
ellipse
logical If _ELLIPSE option is set (was _TENSOR pre R8). Can be true or false
hmax
float
hmin
float
hxcslh
float
hxini
float
hycslh
float
hyini
float
hzcslh
float
hzini
float
iform
float
tensor
logical If _TENSOR option is set (_ELLIPSE from R8 onwards). Can be true or false
user
March 2016
Keywords 1223
Section class
Section
Description
Detailed Description
The Section class allows you to create, modify, edit and manipulate section cards. See the documentation below for
more details.
Constructor
new Section(Model[Model], secid[integer/string], type[constant], title
(optional)[string])
Description
Create a new Section object.
Arguments
Name
Type
Description
Model
Model
secid
type
constant
title
(optional)
string
Return type
Section object
Example
To create a new section, type shell, called Example in model m with label 100:
var s = new Section(m, 100, Section.SHELL, Example);
Details of functions
Blank()
Description
Blanks the section
Arguments
No arguments
Return type
No return value
Example
To blank section s:
s.Blank();
Keywords 1224
March 2016
Section
Section class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sections in model m:
Section.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sections in model m flagged with f:
Section.BlankFlagged(m, f);
Blanked()
Description
Checks if the section is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
March 2016
Keywords 1225
Section class
Section
Example
To check if section s is blanked:
if (s.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse section s:
s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the section.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for section s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the section.
Arguments
Name
Type
range
(optional)
boolean 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() .
Keywords 1226
Description
March 2016
Section
Section class
Return type
Return class object
Example
To copy section s into section z:
var z = s.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Section object (or null if not made)
Example
To start creating a section in model m:
var d = Section.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit section s:
s.Edit();
March 2016
Keywords 1227
Section class
Section
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for section s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first section in the model.
Arguments
Name Type
Description
Return type
Section object (or null if there are no sections in the model).
Example
To get the first section in model m:
var s = Section.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Section label.
Keywords 1228
March 2016
Section
Section class
Example
To get the first free section label in model m:
var label = Section.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the sections with flag f in model m:
Section.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the section is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if section s has flag f set on it:
if (s.Flagged(f) ) do_something...
March 2016
Keywords 1229
Section class
Section
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the sections in model m:
Section.ForEach(m, test);
function test(s)
{
// s is Section object
}
To call function test for all of the sections in model m with optional object:
var data = { x:0, y:0 };
Section.ForEach(m, test, data);
function test(s, extra)
{
// s is Section object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Section objects for all of the sections in a model in Primer
Arguments
Name Type
Description
Return type
Array of Section objects
Example
To make an array of Section objects for all of the sections in model m
var s = Section.GetAll(m);
GetBetaData(ipt[integer])
Description
Returns the beta angle data for an integration point in *SECTION_SHELL or *SECTION_TSHELL.
Keywords 1230
March 2016
Section
Section class
Arguments
Name Type
ipt
Description
integer The integration point you want the data for. Note that integration points start at 0, not 1.
Return type
float
Example
To get the beta angle for the 3rd integration point for section shell s:
if (s.icomp && s.nip >= 3)
{
var beta = s.GetBetaData(2);
}
Arguments
Name Type
Description
Flag
Return type
Array of Section objects
Example
To make an array of Section objects for all of the sections in model m flagged with f
var s = Section.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the section you want the Section object for
Return type
Section object (or null if section does not exist).
March 2016
Keywords 1231
Section class
Section
Example
To get the Section object for section 100 in model m
var s = Section.GetFromID(m, 100);
GetLmcData(i[integer])
Description
Returns the LMC property parameter for *SECTION_SHELL or *SECTION_SOLID.
Arguments
Name Type
i
Description
integer The point you want the parameter for. Note that points start at 0, not 1.
Return type
float
Example
To get the 3rd LMC parameter for section shell s:
if (s.lmc >= 3)
{
var p = s.GetLmcData(2);
}
GetParameter(prop[section property])
Description
Checks if a Section 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 Section.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Section property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if Section property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Keywords 1232
March 2016
Section
Section class
GetPointData(ipt[integer])
Description
Returns the point data for a single point in *SECTION_POINT_SOURCE.
Arguments
Name Type
ipt
Description
integer The point you want the data for. Note that integration points start at 0, not 1.
Return type
An array containing the node id, vector id and orifice area.
Example
To get the data for the 3rd point for section point source s:
if (s.points >= 3)
{
var pt_data = s.GetPointData(3);
}
GetUserData(ipt[integer])
Description
Returns the user defined data for an integration point in *SECTION_SHELL and *SECTION_SOLID.
Arguments
Name Type
ipt
Description
integer The integration point you want the data for. Note that integration points start at 0, not 1.
Return type
An array containing the data (XI, ETA, WGT for *SECTION_SHELL, XI, ETA, ZETA, WGT for *SECTION_
SOLID).
Example
To get the data for the 3rd integration point for section shell s:
if (s.nipp >= 3)
{
var user_data = s.GetUserData(2);
}
Keyword()
Description
Returns the keyword for this section (*SECT, *SECT_SCALAR or *SECT_SCALAR_VALUE). Note that a carriage
return is not added. See also Section.KeywordCards()
Arguments
No arguments
March 2016
Keywords 1233
Section class
Section
Return type
string containing the keyword.
Example
To get the keyword for section s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the section. Note that a carriage return is not added. See also Section.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for section s:
var cards = n.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last section in the model.
Arguments
Name Type
Description
Return type
Section object (or null if there are no sections in the model).
Example
To get the last section in model m:
var s = Section.Last(m);
Keywords 1234
March 2016
Section
Section class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Section label.
Example
To get the last free section label in model m:
var label = Section.LastFreeLabel(m);
Next()
Description
Returns the next section in the model.
Arguments
No arguments
Return type
Section object (or null if there are no more sections in the model).
Example
To get the section in model m after section s:
var s = s.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Section label.
Example
To get the next free section label in model m:
var label = Section.NextFreeLabel(m);
March 2016
Keywords 1235
Section class
Section
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the section can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Section object (or null if not picked)
Example
To pick a section from model m giving the prompt Pick section from screen:
var n = Section.Pick(Pick section from screen, m);
Previous()
Description
Returns the previous section in the model.
Arguments
No arguments
Return type
Section object (or null if there are no more sections in the model).
Example
To get the section in model m before section s:
var s = s.Previous();
Arguments
Name Type
Description
Keywords 1236
March 2016
Section
Section class
Return type
No return value
Example
To renumber all of the sections in model m, from 1000000:
Section.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged sections will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the sections in model m flagged with f, from 1000000:
Section.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only sections from that model can be selected. If the
Flag
argument is a Flag then only sections that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any sections can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of sections selected or null if menu cancelled
March 2016
Keywords 1237
Section class
Section
Example
To select sections from model m, flagging those selected with flag f, giving the prompt Select sections:
Section.Select(f, Select sections, m);
To select sections, flagging those selected with flag f but limiting selection to sections flagged with flag l, giving the
prompt Select sections:
Section.Select(f, Select sections, l);
SetBetaData(ipt[integer], beta[float])
Description
Sets the beta angle for an integration point in *SECTION_SHELL or *SECTION_TSHELL.
Arguments
Name Type
Description
ipt
integer The integration point you want to set the data for. Note that integration points start at 0, not 1.
beta
float
Return type
No return value.
Example
To set the beta angle for the 3rd integration point to 45, for section s:
s.SetBetaData(2, 45);
SetFlag(flag[Flag])
Description
Sets a flag on the section.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for section s:
s.SetFlag(f);
SetLmcData(ipt[integer], lmc[float])
Description
Sets the lmc parameter for a point in *SECTION_SHELL or *SECTION_SOLID.
Keywords 1238
March 2016
Section
Section class
Arguments
Name Type
Description
ipt
integer The point you want to set the data for. Note that points start at 0, not 1.
lmc
float
Return type
No return value.
Example
To set the 3rd lmc point to 0.1, for section s:
s.SetLmcData(2, 0.1);
Arguments
Name Type
ipt
Description
integer The point you want to set the data for. Note that integration points start at 0, not 1.
area
real
Return type
No return value.
Example
To set the data for the 3rd point to node 1, vector 10 and area 0.2, for section s:
s.SetPointData(2, 1, 10, 0.2);
March 2016
Keywords 1239
Section class
Section
Arguments
Name
Type
Description
ipt
integer The integration point you want to set the data for. Note that integration points start at 0,
not 1.
xi
real
eta
real
zeta (SOLID) or
wgt (SHELL)
real
wgt (SOLID
only)
real
Return type
No return value.
Example
To set the user data for the 3rd integration point to xi 0.5, eta 0.5, zeta -0.5, wgt 0.125, for section solid s:
s.SetUserData(2, 0.5, 0.5, -0.5, 0.125);
Sketch(redraw (optional)[boolean])
Description
Sketches the section. The section will be sketched until you either call Section.Unsketch(), Section.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the section is sketched. If omitted redraw is true. If
you want to sketch several sections and only redraw after the last one then use false for redraw
and call View.Redraw().
Return type
No return value
Example
To sketch section s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing sections should be counted. If false or omitted referenced but undefined
sections will also be included in the total.
Keywords 1240
March 2016
Section
Section class
Return type
number of sections
Example
To get the total number of sections in model m:
var total = Section.Total(m);
Unblank()
Description
Unblanks the section
Arguments
No arguments
Return type
No return value
Example
To unblank section s:
s.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sections in model m:
Section.UnblankAll(m);
March 2016
Keywords 1241
Section class
Section
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sections in model m flagged with f:
Section.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all sections will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the sections in model m:
Section.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the section.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the section is unsketched. If omitted redraw is true. If
you want to unsketch several sections and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Keywords 1242
March 2016
Section
Section class
Example
To unsketch section s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the sections 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().
Return type
No return value
Example
To unsketch all sections in model m:
Section.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Section object.
Example
To check if Section property s.example is a parameter by using the Section.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
March 2016
Keywords 1243
Section class
Section
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for section s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this section.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for section s:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the section data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Section.Keyword() and Section.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for section s in keyword format
var str = s.toString();
Keywords 1244
March 2016
Set
Set class
Set class
The Set class gives you access to sets in PRIMER. More...
Class functions
Member functions
Set constants
Name
Description
March 2016
Keywords 1245
Set class
Set
Set.2D_
SEGMENT
This constant is deprecated in version 11.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.
Please use Set.SEGMENT_2D instead. [deprecated]
Set.ADD
Set.ALL_TYPES
Set.BEAM
Set.DISCRETE
Set.GENERAL
Set.GENERATE
Set.INTERSECT
Set.NODE
Set.PART
Set.SEGMENT
Set.SEGMENT_
2D
Set.SHELL
Set.SOLID
Set.TSHELL
Set properties
Name
Type
Description
add
logical
advanced (read
only)
logical
collect
logical
If _COLLECT option is active. If the collect property is unset for a child collect set then
a new label will be assigned for the child set. If the collect property is unset for a parent
collect set then all of the child sets will be reassigned new labels.
collect_children
(read only)
integer
colour
Colour
column (read
only)
logical
da1
float
The first default attribute for the set (only valid for Set.NODE, Set.PART,
Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
da2
float
The second default attribute for the set (only valid for Set.NODE, Set.PART,
Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
da3
float
The third default attribute for the set (only valid for Set.NODE, Set.PART,
Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
da4
float
The fourth default attribute for the set (only valid for Set.NODE, Set.PART,
Set.SEGMENT, Set.SEGMENT_2D and Set.SHELL)
exists
logical
true if set exists, false if referred to but not defined. (read only)
Keywords 1246
March 2016
Set
Set class
general
logical
general_lines
(read only)
integer
Number of lines of data for _GENERAL set (if _GENERAL option is active).
generate
logical
include
integer
increment (read
only)
logical
intersect
logical
label
integer
Set number. Also see the sid property which is an alternative name for this.
model
integer
sid
integer
Set number. Also see the label property which is an alternative name for this.
smooth (read
only)
logical
solver
string
Solver to attach to set. Can be "MECH", "CESE", "EM", "ICFD" or blank (only valid for
Set.NODE, Set.PART, Set.SEGMENT and Set.SOLID).
title
string
Set title
integer
The total number of items in the set. Note that for _GENERAL and _GENERATE sets
this is expensive to compute.
transparency
integer
Detailed Description
The Set class allows you to create, modify, edit and manipulate sets. See the documentation below for more details.
Constructor
new Set(Model[Model], sid[integer], type[constant], title (optional)[string],
option (optional)[constant])
Description
Create a new Set object.
Arguments
Name
Type
Description
Model
Model
sid
integer
Set number
type
title
(optional)
string
option
(optional)
March 2016
Keywords 1247
Set class
Set
Return type
Set object
Example
To create a new node set in model m with label 100:
var s = new Set(m, 100, Set.NODE);
To create a new *NODE_SET_ADD in model m with label 101:
var s = new Set(m, 101, Set.NODE,"", Set.ADD);
Details of functions
Add(id1[integer], id2 (only for SEGMENT, _GENERATE, _GENERATE_
INCREMENT and _ADD_ADVANCED sets)[integer], id3 (only for SEGMENT
and _GENERATE_INCREMENT sets)[integer], id4 (only for SEGMENT
sets)[integer])
Description
Adds an item to the set. This cannot be used for _COLUMN and _GENERAL sets and cannot be used for segment
sets
Arguments
Name
Type
Description
id1
id2 (only for SEGMENT, _GENERATE, _GENERATE_ integer type of the item to add to the set [1-7] (_ADD_
ADVANCED sets) or
INCREMENT and _ADD_ADVANCED sets)
End ID (_GENERATE sets)
id3 (only for SEGMENT and _GENERATE_
INCREMENT sets)
Return type
No return value
Example
To add node 10 to node set ns:
ns.Add(10);
To add segment 10, 11, 12, 13 to segment set ss:
ss.Add(10, 11, 12, 13);
AddCollectChild(set[Set])
Description
Adds a child collect set to the set. The child set label will be changed to be the same as the parent set and it will become
a child. Also see Set.collect_children and Set.GetCollectChild.
Keywords 1248
March 2016
Set
Set class
Arguments
Name Type Description
set
Set
Return type
No return value
Example
To make set ns2 to node set ns:
ns.AddCollectChild(ns2);
AddFlagged(flag[Flag])
Description
Adds flagged items to the set. This cannot be used for _GENERAL or _GENERATE sets and cannot be used for
segment sets
Arguments
Name Type Description
flag
Return type
No return value
Example
To add any nodes flagged with flag f to node set ns:
ns.AddFlagged(f);
Arguments
Name
Type
Description
Model
Model
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
Keywords 1249
Set class
Set
Example
To blank all of the sets in model m:
Set.BlankAll(m);
To blank all of the node sets in model m:
Set.BlankAll(m, Set.NODE);
Arguments
Name
Type
Description
Model
Model
flag
Flag
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the sets in model m flagged with f:
Set.BlankFlagged(m, f);
To blank all of the node sets in model m flagged with f:
Set.BlankFlagged(m, f, Set.NODE);
Blanked()
Description
Checks if the set is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if set s is blanked:
if (s.Blanked() ) do_something...
Keywords 1250
March 2016
Set
Set class
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
No return value
Example
To browse set s:
var s.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the set.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for set s:
s.ClearFlag(f);
Contains(id[integer])
Description
Checks if an item is in the set. This cannot be used for ADD_ADVANCED, _GENERAL or _GENERATE sets and
cannot be used for segment sets
Arguments
Name Type
id
Description
Return type
true if item is in set, false if not
March 2016
Keywords 1251
Set class
Set
Example
To see if node 10 is in node set ns:
if (ns.Contains(10) )
{
do something...
}
Copy(range (optional)[boolean])
Description
Copies the set.
Arguments
Name
Type
Description
range
(optional)
boolean If you want to keep the copied item in the range specified for the current include. To set
current include, use Include.MakeCurrentLayer() .
Return type
Return class object
Example
To copy node net ns into node net ns1:
var ns1 = ns.Copy();
Arguments
Name
Type
Description
Model
Model
type
constant Type of the set that you want to create. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP,
Set.MODE, Set.NODE, Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL,
Set.SOLID or Set.TSHELL
modal
(optional)
boolean 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.
Return type
Set object (or null if not made)
Example
To start creating a node set in model m:
var s = Set.Create(m, Set.NODE);
Keywords 1252
March 2016
Set
Set class
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel to edit the set.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
No return value
Example
To edit set s:
var s.Edit();
Empty()
Description
Removes all items from the set. This cannot be used for _GENERATE sets and cannot be used for segment sets
Arguments
No arguments
Return type
No return value
Example
To remove all nodes from node set ns:
ns.Empty(f);
Arguments
Name
Type Description
message
Return type
No return value
March 2016
Keywords 1253
Set class
Set
Example
To add an error message "My custom error" for set s:
s.Error("My custom error");
Arguments
Name Type
Description
Model Model
type
constant Type of the set. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE,
Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL, Set.SOLID or Set.TSHELL
Return type
Set object (or null if there are no sets in the model).
Example
To get the first node set in model m:
var n = Set.First(m, Set.NODE);
Arguments
Name
Type
Description
Model
Model
type
constant
layer
(optional)
Include
number
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).
Return type
Set label.
Example
To get the first free node set label in model m:
var label = Set.FirstFreeLabel(m, Set.NODE);
Keywords 1254
March 2016
Set
Set class
Arguments
Name
Type
Description
Model
Model
flag
Flag
type
(optional)
constant Type of the set. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE,
Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL, Set.SOLID or
Set.TSHELL. If set, only sets of this type will be flagged. If omitted sets of all types will be
flagged.
Return type
No return value
Example
To flag all of the node sets with flag f in model m:
Set.FlagAll(m, f, Set.NODE);
Flagged(flag[Flag])
Description
Checks if the set is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if set s has flag f set on it:
if (s.Flagged(f) ) do_something...
March 2016
Keywords 1255
Set class
Set
Arguments
Name Type
Description
Model Model
type
constant Type of the set. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE,
Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL, Set.SOLID or Set.TSHELL
Return type
Array of Set objects
Example
To make an array of Set objects for all of the node sets in model m
var n = Set.GetAll(m, Set.NODE);
GetCollectChild(number[Integer])
Description
Returns a child collect set. Also see Set.collect_children and Set.AddCollectChild.
Arguments
Name
Type
Description
number Integer The index of the child collect set to return. Note that indices start at 0, not 1
Return type
Set object
Example
To loop over the child collect sets for set ns:
if (ns.collect)
{
for (i=0; i<ns.collect_children; i++)
var child = ns.GetCollectChild(i);
}
Arguments
Name Type
Description
Model Model
flag
Flag
type
constant Type of the set. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE,
Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL, Set.SOLID or Set.TSHELL
Keywords 1256
March 2016
Set
Set class
Return type
Array of Set objects
Example
To make an array of Set objects for all of the node sets in model m flagged with f
var n = Set.GetFlagged(m, f, Set.NODE);
Arguments
Name
Type
Description
Model
Model
set
number
integer
type
constant Type of the set. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE,
Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL, Set.SOLID or Set.TSHELL
Return type
Set object (or null if set does not exist).
Example
To get the Set object for node set 100 in model m
var n = Set.GetFromID(m, 100, Set.NODE);
GetGeneralData(index[Integer])
Description
Returns a line of data for a GENERAL set.
Arguments
Name Type
Description
index Integer The index of the GENERAL data to return. Note that indices start at 0, not 1.
0 <= index < general_lines
Return type
Array containing data.
Example
To loop over the lines of general data sets for set s:
if (s.general)
{
for (i=0; i<s.general_lines; i++)
var data = s.GetGeneralData(i);
}
March 2016
Keywords 1257
Set class
Set
Keyword()
Description
Returns the keyword for this set (*SET_NODE etc). Note that a carriage return is not added. See also
Set.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for set s:
var key = s.Keyword();
KeywordCards()
Description
Returns the keyword cards for the set. Note that a carriage return is not added. See also Set.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for set s:
var cards = s.KeywordCards();
Arguments
Name Type
Description
Model Model
type
constant Type of the set. Can be Set.BEAM, Set.DISCRETE, Set.MM_GROUP, Set.MODE, Set.NODE,
Set.PART or Set.SEGMENT or Set.SEGMENT_2D or Set.SHELL, Set.SOLID or Set.TSHELL
Return type
Set object (or null if there are no sets in the model).
Example
To get the last node set in model m:
var n = Set.Last(m, Set.NODE);
Keywords 1258
March 2016
Set
Set class
Arguments
Name
Type
Description
Model
Model
type
constant
layer
(optional)
Include
number
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.
Return type
Set label.
Example
To get the last free node set label in model m:
var label = Set.LastFreeLabel(m, Set.NODE);
Next()
Description
Returns the next set in the model.
Arguments
No arguments
Return type
Set object (or null if there are no more sets in the model).
Example
To get the set in model m after set n:
var n = n.Next();
March 2016
Keywords 1259
Set class
Set
Arguments
Name
Type
Description
Model
Model
type
constant
layer
(optional)
Include
number
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).
Return type
Set label.
Example
To get the next free node set label in model m:
var label = Set.NextFreeLabel(m, Set.NODE);
Arguments
Name
Type
Description
type
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the set can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Set object (or null if not picked)
Example
To pick a node set from model m giving the prompt Pick set from screen:
var n = Set.Pick(Set.NODE, Pick set from screen, m);
Previous()
Description
Returns the previous set in the model.
Keywords 1260
March 2016
Set
Set class
Arguments
No arguments
Return type
Set object (or null if there are no more sets in the model).
Example
To get the set in model m before this one:
var s = s.Previous();
RebuildCache()
Description
Rebuilds the cache for a set. As sets can be built using complex combinations of _GENERAL, _ADD, _INTERSECT
options etc Primer creates a cache for the set to speed up set drawing and usage. During normal interactive use this
cache is rebuilt as necessary but in JavaScript it is possible for the cache to become out of date (e.g. you change a box
position in JavaScript that is used by a *SET_GENERAL). Calling this forces the cache to be rebuilt.
Arguments
No arguments
Return type
No return type
Example
To rebuild the cache for set s:
s.RebuildCache();
Remove(id[integer])
Description
Removes an item from the set. If the item is not in the set nothing is done. This cannot be used for ADD_
ADVANCED, _COLUMN, _GENERAL or _GENERATE sets and cannot be used for segment sets
Arguments
Name Type
id
Description
Return type
No return value
Example
To remove node 10 from node set ns:
ns.Remove(10);
March 2016
Keywords 1261
Set class
Set
RemoveFlagged(flag[Flag])
Description
Removes flagged items from the set. This cannot be used for _GENERAL or _GENERATE sets and cannot be
used for segment sets
Arguments
Name Type Description
flag
Return type
No return value
Example
To remove any nodes flagged with flag f from node set ns:
ns.RemoveFlagged(f);
RemoveGeneralData(index[Integer])
Description
Removes a line of data from a GENERAL set.
Arguments
Name Type
Description
index Integer The index of the GENERAL data to remove. Note that indices start at 0, not 1.
0 <= index < general_lines
Return type
No return value
Example
To remove the first line of general data sets for set s:
if (s.general)
{
s.RemoveGeneralData(0);
}
Keywords 1262
March 2016
Set
Set class
Arguments
Name
Type
Description
Model
Model
start
integer
type
(optional)
Return type
No return value
Example
To renumber all of the sets in model m, from 1000000:
Set.RenumberAll(m, 1000000);
To renumber all of the node sets in model m, from 1000000:
Set.RenumberAll(m, 1000000, Set.NODE);
Arguments
Name
Type
Description
Model
Model
flag
Flag
start
integer
type
(optional)
Return type
No return value
Example
To renumber all of the sets in model m flagged with f, from 1000000:
Set.RenumberFlagged(m, f, 1000000);
To renumber all of the node sets in model m flagged with f, from 1000000:
Set.RenumberFlagged(m, f, 1000000, Set.NODE);
Keywords 1263
Set class
Set
Arguments
Name
Type
Description
type
constant
flag
Flag
prompt
string
limit
(optional)
Model or
Flag
If the argument is a Model then only sets from that model can be selected. If the argument is
a Flag then only sets that are flagged with limit can be selected (limit should be different to
flag). If omitted, or null, any sets can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of items selected or null if menu cancelled
Example
To select node sets from model m, flagging those selected with flag f, giving the prompt Select sets:
Set.Select(Set.NODE, f, Select sets, m);
SetFlag(flag[Flag])
Description
Sets a flag on the set.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for set s:
s.SetFlag(f);
SetGeneralData(index[Integer], data[Array])
Description
Sets a line of data for a GENERAL set.
Arguments
Name Type
Description
index Integer The index of the GENERAL data to set. Note that indices start at 0, not 1.
0 <= index <= general_lines
data
Array
Keywords 1264
March 2016
Set
Set class
Return type
No return value.
Example
To add nodes inside boxes 1, 2 and 3 as a new line of data to node general set s:
var data = [ "BOX", 1, 2, 3];
s.SetGeneralData(s.general_lines, data);
Sketch(redraw (optional)[boolean])
Description
Sketches the set. The set will be sketched until you either call Set.Unsketch(), Set.UnsketchAll(), Model.UnsketchAll(),
or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the set is sketched. If omitted redraw is true. If you
want to sketch several sets and only redraw after the last one then use false for redraw and call
View.Redraw().
Return type
No return value
Example
To sketch set s:
s.Sketch();
Spool()
Description
Spools a set, entry by entry. See also Set.StartSpool
Arguments
No arguments
Return type
For Set.SEGMENT returns an array containing node IDs, for all other set types returns the ID of the item. Returns 0 if
no more items
Example
To spool set s:
var id;
s.StartSpool();
while (id = s.Spool() )
{
do something...
}
March 2016
Keywords 1265
Set class
Set
StartSpool(raw (optional)[boolean])
Description
Starts a set spooling operation. See also Set.Spool
Arguments
Name
Type
Description
raw
(optional)
boolean If true then the raw data from _GENERATE, _ADD and _INTERSECT sets will be returned
instead of expanding the data ranges or child set contents. If omitted raw will be false.
Return type
No return value
Example
To start spooling set s:
s.StartSpool();
Arguments
Name
Type
Description
Model
Model
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sets in model m:
Set.UnblankAll(m);
To unblank all of the node sets in model m:
Set.UnblankAll(m, Set.NODE);
Keywords 1266
March 2016
Set
Set class
Arguments
Name
Type
Description
Model
Model
flag
Flag
type
(optional)
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the sets in model m flagged with f:
Set.UnblankFlagged(m, f);
To unblank all of the node sets in model m flagged with f:
Set.UnblankFlagged(m, f, Set.NODE);
Arguments
Name
Type
Description
Model
Model
Model that the defined flag for all sets will be unset in
flag
Flag
type
(optional)
Return type
No return value
Example
To unset the flag f on all the sets in model m:
Set.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the set.
March 2016
Keywords 1267
Set class
Set
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the set is unsketched. If omitted redraw is true. If you
want to unsketch several sets and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To unsketch set s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
type
(optional)
redraw
(optional)
boolean If model should be redrawn or not after the sets 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().
Return type
No return value
Example
To unsketch all sets in model m:
Set.UnsketchAll(m);
Arguments
Name
Type Description
message
Keywords 1268
March 2016
Set
Set class
Return type
No return value
Example
To add a warning message "My custom warning" for set s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this set.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for this set:
var xrefs = s.Xrefs();
toString()
Description
Creates a string containing the set data in keyword format. Note that this contains the keyword header and the keyword
cards. See also Set.Keyword() and Set.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for set n in keyword format
var s = n.toString();
March 2016
Keywords 1269
Set class
Keywords 1270
March 2016
Attached class
Attached class
The Attached class contains constants and static functions relating to the Attached() member function from the Model
class. More...
Class functions
Beam3rdNodes(Setting[boolean])
BeamPid(Setting[boolean])
Deformable(Setting[constant])
FlagPart(Setting[boolean])
Recursive(Setting[boolean], Number (optional)[integer])
Rigid(Setting[constant])
SetEntity(Type[string], Setting[boolean])
TiedContacts(Setting[boolean])
Attached constants
Name
Description
Attached.SINGLE Find attached option - find attached through single elements only
Attached.WHOLE Find attached option - find through whole attached part
Detailed Description
The Attached class staic functions are used to set options for the find attached feature in Primer. Once set, these settings
are used when using the Attached() member function from the Model class
Details of functions
Beam3rdNodes(Setting[boolean]) [static]
Description
Sets the find attached option for beam 3rd nodes on or off
Arguments
Name Type
Description
Setting boolean If true beam 3rd nodes are considered for find attached, if false, they are not.
Return type
No return value
Example
To set the 3rd node option to on:
Attached.Beam3rdNodes(true);
BeamPid(Setting[boolean]) [static]
Description
Sets the find attached option for beam pid on or off
March 2016
Attached class
Arguments
Name Type
Description
Setting boolean If true beam pids are considered for find attached, if false, they are not.
Return type
No return value
Example
To set the beam pid option to on:
Attached.BeamPid(true);
Deformable(Setting[constant]) [static]
Description
Sets the deformable option for find attached
Arguments
Name Type
Description
Return type
No return value
Example
To set the deformable option to find attached through the whole part:
Attached.Deformable(Attached.WHOLE);
FlagPart(Setting[boolean]) [static]
Description
Sets an option to flag parts after a find attached if any elements within that part are flagged
Arguments
Name Type
Description
Setting boolean If true, parts are flagged after a find attached if any elements within that part are flagged, if false,
they are not.
Return type
No return value
Example
To set the flag part option to on:
Attached.FlagPart(true);
March 2016
Attached class
Arguments
Name
Type
Description
Setting
Number (optional) integer Option to set the number of find attached iterations used when the recursive option is set.
Return type
No return value
Example
To set the recursive option to on:
Attached.Recursive(true);
Rigid(Setting[constant]) [static]
Description
Sets the rigid option for find attached
Arguments
Name Type
Description
Return type
No return value
Example
To set the rigid option to find attached through the whole part:
Attached.Rigid(Attached.WHOLE);
Arguments
Name Type
Description
Type
The type of the item to switch on or off (for a list of types see Appendix I of the PRIMER manual).
string
Setting boolean If true you turn the entity switch on, if false you turn it off.
Return type
No return value
March 2016
Attached class
Example
To set the SHELL switch to on so that when you run a find attached you fnd attached through shells:
Attached.SetEntity("SHELL", true);
TiedContacts(Setting[boolean]) [static]
Description
Sets the find attached option for tied contacts on or off
Arguments
Name Type
Description
Setting boolean If true tied contacts are considered for find attached, if false, they are not.
Return type
No return value
Example
To set the tied contacts option to on:
Attached.TiedContacts(true);
March 2016
Belt class
Belt class
The Belt class gives you access to belt fitting in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetParameter(prop[belt property])
GetPoint(index[integer])
Next()
Previous()
RemovePoint(index[integer])
SetFlag(flag[Flag])
SetPoint(index[integer], data[Object])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
Belt constants
Constants for Path point fixity
Name
Description
Belt.B_POST_
SLIPRING
Belt.FIXED
Point is fixed
Belt.FREE_SLIPRING
Belt.KNOWN
Belt.RETRACTOR
March 2016
Belt class
Belt.SLIPRING
There is a slipring at this point. (Deprecated from V12 onwards, use FREE_SLIPRING or
B_POST_SLIPRING instead)
Belt.TWIST
Belt.XSEC
Belt properties
Name
Type
Description
acuteAngle
float
curvature
float
elemSet
integer Set of shell or 2D seatbelt elements. Only created if the option to generate a contact for the belt
is used (read only)
exists
logical true if belt exists, false if referred to but not defined. (read only)
friction
float
id
integer Belt number. Also see the label property which is an alternative name for this.
include
iterations
label
integer Belt number. Also see the id property which is an alternative name for this.
length
float
model
n2sContact
integer Nodes to Surface contact used between nodes on 1D belt elements and dummy structure. Only
used if the option to create a contact between belt and dummy "structure" has been used (read
only)
nodeSet
integer Set of all nodes in seatbelt. Only created if the option to generate a contact for the belt is used
(read only)
nrbFirst
nrbLast
nsboSet
integer Set of nodes on 1D seatbelt elements only. Only created if the option to generate a contact for
the belt is used (read only)
overlap
float
parts
penetration
float
pidShell
pid_1d
pid_2d
points
projection
float
Initial projection distance by which belt path is "thrown outwards" at start of fitting
psiShell
float
psi_2d
float
Fraction by which facets are extended during contact checking to stop nodes "falling into gaps"
Maximum penetration distance considered for contact into solid and thick shell elements
March 2016
Belt class
s2sContact
integer Surface to Surface contact used between shell/2D belt elements and dummy structure. Only
used if the option to create a contact between belt and dummy "structure" has been used (read
only)
segments
shells
slen_1d
float
solids
t1Shell
float
t1_2d
float
t2Shell
float
t2_2d
float
t3Shell
float
t3_2d
float
t4Shell
float
t4_2d
float
thickFactor
float
thickFlag
integer Thickness used during fitting: 0 (default)=use true thickness; 1=use true thickness x factor;
2=use neutral axis (no thickness)
thickness
float
title
string
Belt title.
tolerance
float
tshells
width
float
Detailed Description
The Belt class allows you to create, modify, and manipulate belt fitting definitions. See the documentation below for
more details.
Constructor
new Belt(model[Model], id[integer], title (optional)[string])
Description
Create a new Belt object.
March 2016
Belt class
Arguments
Name
Type
model
id
Description
Return type
Belt object
Example
To create a new belt called Example in model m with label 100:
var b = new Belt(m, 100, Example);
Details of functions
Blank()
Description
Blanks the belt
Arguments
No arguments
Return type
No return value
Example
To blank belt b:
b.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the belts in model m:
Belt.BlankAll(m);
March 2016
Belt class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the belts in model m flagged with f:
Belt.BlankFlagged(m, f);
Blanked()
Description
Checks if the belt is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if belt b is blanked:
if (b.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the belt.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
Belt class
Example
To clear flag f for belt b:
b.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the belt.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy belt b into belt z:
var z = b.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for belt b:
b.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first belt in the model.
10
March 2016
Belt class
Arguments
Name Type
Description
Return type
Belt object (or null if there are no belts in the model).
Example
To get the first belt in model m:
var b = Belt.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Belt label.
Example
To get the first free belt label in model m:
var label = Belt.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
March 2016
11
Belt class
Example
To flag all of the belts with flag f in model m:
Belt.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the belt is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if belt b has flag f set on it:
if (b.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
12
March 2016
Belt class
Example
To call function test for all of the belts in model m:
Belt.ForEach(m, test);
function test(b)
{
// b is Belt object
}
To call function test for all of the belts in model m with optional object:
var data = { x:0, y:0 };
Belt.ForEach(m, test, data);
function test(b, extra)
{
// b is Belt object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Belt objects for all of the belts in a model in Primer
Arguments
Name Type
Description
Return type
Array of Belt objects
Example
To make an array of Belt objects for all of the belts in model m
var b = Belt.GetAll(m);
Arguments
Name Type
Description
Flag
Return type
Array of Belt objects
Example
To make an array of Belt objects for all of the belts in model m flagged with f
var b = Belt.GetFlagged(m, f);
March 2016
13
Belt class
Arguments
Name
Type
Description
Model
number integer number of the belt you want the Belt object for
Return type
Belt object (or null if belt does not exist).
Example
To get the Belt object for belt 100 in model m
var b = Belt.GetFromID(m, 100);
GetParameter(prop[belt property])
Description
Checks if a Belt 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 Belt.ViewParameters() method and method chaining (see
the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Belt property b.example is a parameter:
Options.property_parameter_names = true;
if (b.GetParameter(b.example) ) do_something...
Options.property_parameter_names = false;
To check if Belt property b.example is a parameter by using the GetParameter method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
GetPoint(index[integer])
Description
Returns the information for a path point (properties fixity, x, y, z, node, trx1, try1, trz1, tnx1, tny1, tnz1, tnode1, trx2,
try2, trz2, tnx2, tny2, tnz2, tnode2). Properties fixity, x, y, z and node will always be returned. Twist properties trx1,
try1, trz1, tnx1, tny1, tnz1, tnode1, trx2, try2, trz2, tnx2, tny2, tnz2 and tnode2 will only be returned if defined for the
point.
14
March 2016
Belt class
Arguments
Name Type
Description
index integer The index of the path point you want the information for. Note that path points start at 0, not 1. 0
<= index < points
Return type
Object containing the path point information
Example
To get the information for the 3rd path point for belt b:
var info = b.GetPoint(2);
Last(Model[Model]) [static]
Description
Returns the last belt in the model.
Arguments
Name Type
Description
Return type
Belt object (or null if there are no belts in the model).
Example
To get the last belt in model m:
var b = Belt.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Belt label.
Example
To get the last free belt label in model m:
var label = Belt.LastFreeLabel(m);
March 2016
15
Belt class
Next()
Description
Returns the next belt in the model.
Arguments
No arguments
Return type
Belt object (or null if there are no more belts in the model).
Example
To get the belt in model m after belt b:
var b = b.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Belt label.
Example
To get the next free belt label in model m:
var label = Belt.NextFreeLabel(m);
16
March 2016
Belt class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the belt can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Belt object (or null if not picked)
Example
To pick a belt from model m giving the prompt Pick belt from screen:
var b = Belt.Pick(Pick belt from screen, m);
Previous()
Description
Returns the previous belt in the model.
Arguments
No arguments
Return type
Belt object (or null if there are no more belts in the model).
Example
To get the belt in model m before belt b:
var b = b.Previous();
RemovePoint(index[integer])
Description
Removes a path point from a belt
Arguments
Name Type
Description
index integer The index of the path point you want to remove. Note that path points start at 0, not 1. 0 <= index <
points
Return type
no return value
March 2016
17
Belt class
Example
To remove for the 3rd path point for belt b:
b.RemovePoint(2);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the belts in model m, from 1000000:
Belt.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged belts will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the belts in model m flagged with f, from 1000000:
Belt.RenumberFlagged(m, f, 1000000);
18
March 2016
Belt class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only belts from that model can be selected. If the argument is
Flag
a Flag then only belts that are flagged with limit can be selected (limit should be different to
flag). If omitted, or null, any belts can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of belts selected or null if menu cancelled
Example
To select belts from model m, flagging those selected with flag f, giving the prompt Select belts:
Belt.Select(f, Select belts, m);
To select belts, flagging those selected with flag f but limiting selection to belts flagged with flag l, giving the prompt
Select belts:
Belt.Select(f, Select belts, l);
SetFlag(flag[Flag])
Description
Sets a flag on the belt.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for belt b:
b.SetFlag(f);
SetPoint(index[integer], data[Object])
Description
Sets the data for a path point in a belt
March 2016
19
Belt class
Arguments
Name Type
Description
index integer The index of the path point you want to set. Note that path points start at 0, not 1. To add a new
point use index points
data
Object Object containing the path point data. The properties can be:
fixity [integer] (required)
x [float] (not required if using node)
y [float] (not required if using node)
z [float] (not required if using node)
node [integer] (not required if using x, y and z)
trx1 [float] (optional)
try1 [float] (optional)
trz1 [float] (optional)
tnx1 [float] (optional)
tny1 [float] (optional)
tnz1 [float] (optional)
tnode1 [integer] (optional)
trx2 [float] (optional)
try2 [float] (optional)
trz2 [float] (optional)
tnx2 [float] (optional)
tny2 [float] (optional)
tnz2 [float] (optional)
tnode2 [integer] (optional)
Return type
no return value
Example
To add a new B-Post slipring path point to belt b at node 1000:
var data = { fixity:Belt.B_POST_SLIPRING, node:1000 };
b.SetPoint(b.points, data);
To add a new path point to belt b at coordinate *10, 20, 30):
var data = { fixity:0, x:10, y:20, z:30 };
b.SetPoint(b.points, data);
To add a new retractor path point to belt b at (10, 20, 30) with twist nodes 1000 and 1001:
var data = { fixity:Belt.RETRACTOR|Belt.TWIST, x:10, y:20, z:30, tnode1:1000,
tnode2:1001 };
b.SetPoint(b.points, data);
Sketch(redraw (optional)[boolean])
Description
Sketches the belt. The belt will be sketched until you either call Belt.Unsketch(), Belt.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the belt is sketched. If omitted redraw is true. If you
want to sketch several belts and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
20
March 2016
Belt class
Example
To sketch belt b:
b.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing belts should be counted. If false or omitted referenced but undefined
belts will also be included in the total.
Return type
number of belts
Example
To get the total number of belts in model m:
var total = Belt.Total(m);
Unblank()
Description
Unblanks the belt
Arguments
No arguments
Return type
No return value
Example
To unblank belt b:
b.Unblank();
March 2016
21
Belt class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the belts in model m:
Belt.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the belts in model m flagged with f:
Belt.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all belts will be unset in
flag
Flag
Return type
No return value
22
March 2016
Belt class
Example
To unset the flag f on all the belts in model m:
Belt.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the belt.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the belt is unsketched. If omitted redraw is true. If you
want to unsketch several belts and only redraw after the last one then use false for redraw and
call View.Redraw().
Return type
No return value
Example
To unsketch belt b:
b.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the belts 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().
Return type
No return value
Example
To unsketch all belts in model m:
Belt.UnsketchAll(m);
ViewParameters()
Description
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.
March 2016
23
Belt class
Arguments
No arguments
Return type
Belt object.
Example
To check if Belt property b.example is a parameter by using the Belt.GetParameter() method:
if (b.ViewParameters().GetParameter(b.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for belt b:
b.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this belt.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for belt b:
var xrefs = b.Xrefs();
24
March 2016
Check class
Check class
The Check class enables you to access model checking in PRIMER. More...
Class functions
Detailed Description
The Check class is used add checks to PRIMER using JavaScript. Two different types of checks can be added:
Individual checks for each node, part, shell etc in a model.
Custom checks that can reference multiple entities for checking in a model
PRIMER will look in 3 locations for additional JavaScript checks to run when doing checking:
OA_ADMIN/primer_library/scripts/checks
OA_INSTALL/primer_library/scripts/checks
HOME/primer_library/scripts/checks
The directories OA_INSTALL/primer_library/scripts etc can be changed with the primer*script_dir preference.
For individual checks PRIMER will look in these directories for a script with the name class_name.js. For example if
you wanted to write a script that will be run for every part in a model the script should be called Part.js.
For custom checks PRIMER will look in these directories for a script called custom.js. This obviously means that there
can only be one custom script in each directory. These filenames are case sensitive.
Individual scripts will be called with 3 arguments:
arguments[0] = Name of the script
arguments[1] = model object
arguments[2] = Item object
Individual scripts can add warnings or errors by using the Warning() or Error() methods of the appropriate class. For
example for a Part the script can call the methods Part.Error() and Part.Warning(). The script should not call the
Error() and Warning() methods of other classes.
As a simple example of an individual check, suppose you wanted it to be an error if any shell parts in your model did
not use type 16 shells. Add a script called Part.js in the directory OA_INSTALL/primer_library/scripts/checks (or one
of the other directories) containing:
// arguments[0] is name of script
var m = arguments[1]; // arguments[1] is model pointer
var p = arguments[2]; // arguments[2] is part pointer
if (p.exists && p.secid)
{
var s = Section.GetFromID(m, p.secid);
if (s.exists && s.type == Section.SHELL && s.elform != 16)
p.Error("Shell part elform not 16", "Fictional company policy is to use
elform 16 for shell parts");
}
Custom scripts will be called with 2 arguments:
arguments[0] = Name of the script
arguments[1] = model object
Custom scripts can add warnings or errors by using the static Check.Error() and Check.Warning() methods. The script
should not call the Error() and Warning() methods of other classes.
As a simple example of a custom check, suppose a dummy uses node 1000 for the H-point and this should be at
coordinates (1000, -500, 100) within tolerance of 0.1 for an analysis . You do not want to run a check for every node in
the model (i.e. an individual check). You just want to check that node 1000 is at the correct coordinates. To do this you
could create a script called custom.js in the directory OA_INSTALL/primer_library/scripts/checks (or one of the other
directories) containing:
// arguments[0] is name of script
var m = arguments[1]; // arguments[1] is model pointer
var n = Node.GetFromID(m, 1000);
if (!n)
Check.Error("No H-point node", "Model does not contain node for dummy
H-point");
if (!n.exists)
Check.Error("H-point node not defined", "Dummy H-point node is referred to
but not defined");
var dx = n.x - 1000;
var dy = n.y - (-500);
March 2016
25
Check class
var dy = n.z - 100;
var d = Math.sqrt(dx*dx + dy*dy + dz*dz);
if (d > 0.1)
Check.Error("H-point not at correct position", "Dummy H-point is "+d+"mm
away from target position");
See the documentation below for more details.
Details of functions
Error(message[string], details (optional)[string]) [static]
Description
Adds a custom error. This function should only be called from a custom JavaScript check script. See the details in the
Check class for how to do this.
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error":
Check.Error(My custom error);
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning":
Check.Warning(My custom warning);
26
March 2016
Colour class
Colour class
The Colour class contains constants relating to colours. More...
Class functions
Colour constants
Name
Description
Colour.BACKGROUND
Background colour
Colour.BLACK
Colour black
Colour.BLUE
Colour blue
Colour.CYAN
Colour cyan
Colour.DARK_ORANGE
Colour.DEFAULT
Colour.GREEN
Colour green
Colour.GREEN_CYAN
Colour green/cyan
Colour.GREY
Colour grey
Colour.LIGHT_BLUE
Colour.MAGENTA
Colour magenta
Colour.MEDIUM_BLUE
Colour.ORANGE
Colour orange
Colour.RED
Colour red
Colour.RED_MAGENTA
Colour red/magenta
Colour.SKETCH
Sketch colour
Colour.TEXT
Text colour
Colour.WHITE
Colour white
Colour.YELLOW
Colour yellow
Detailed Description
The Colour class is used to define colours, either by predefined colours or by RGB values. The easiest way to set the
colour of something is to use the predefined colour constants. e.g. to set the colour of part p to red:
p.colour = Colour.RED;
For other colours use Colour.RGB().
Details of functions
RGB(red[integer], green[integer], blue[integer]) [static]
Description
Creates a colour from red, green and blue components
March 2016
27
Colour class
Arguments
Name Type
red
Description
Return type
colour value (integer)
Example
To set the colour of model m to red:
m.SetColour( Colour.RGB(255, 0, 0) );
To set the colour of part p to red:
p.colour = Colour.RGB(255, 0, 0);
28
March 2016
Conx class
Conx class
The Conx class gives you access to connections in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
EmptyPatch()
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetElements()
GetLayerData(layer[integer])
GetLayerShells(layer[integer])
GetParameter(prop[connection property])
GetPatchCoords(point[integer])
GetPatchTopol(point[integer])
GetPathData(point[integer])
GetPidData()
Keyword()
KeywordCards()
Next()
Previous()
RemovePatchTopol(layer[integer])
RemovePathData(layer[integer])
SetFlag(flag[Flag])
SetLayerData(layer[integer], item1[integer/string], item2 (optional)[integer/string], ...
(optional)[integer/string])
SetPatchCoords(point[integer], x[float], y[float], z[float])
SetPatchTopol(point[integer], 1[integer], 2[integer], 3[integer], 4 (optional)[integer])
SetPathData(point[integer], x[float], y[float], z[float])
SetPidData(item1[integer/string], item2 (optional)[integer/string], ... (optional)[integer/string])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
March 2016
29
Conx class
Conx constants
Name
Description
Conx.ADHESIVE
Connection is adhesive.
Conx.ADHESIVE_
PATCH
Conx.ADHESIVE_
SOLID
Conx.ASSEMBLY
If the connection refers to an assembly rather than individual layers, the assembly is
defined by part tree assembly.
Conx.BAD
Conx.BOLT
Connection is a bolt.
Conx.BOLT_MODULE
Library bolt.
Conx.BOLT_MRG_
2PTS_RJ
Conx.BOLT_MRG_
CYL_BEAM
Conx.BOLT_MRG_
CYL_DISC
Cylindrical NRB.
Spherical NRB.
Conx.INVALID
Connection has been made but something is wrong (e.g. part moved).
Conx.MADE
Conx.PART_SET
If the connection refers to an assembly rather than individual layers, the assembly is
defined by part set.
Conx.REALIZED
30
March 2016
Conx class
Conx.RIGID
This constant is deprecated in version 10.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.
Please use Conx.BOLT instead. [deprecated]
Conx.RIGID_MERGE
This constant is deprecated in version 10.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.
Please use Conx.BOLT_MRG_CYL instead. [deprecated]
Conx.RIGID_NRB
This constant is deprecated in version 10.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.
Please use Conx.BOLT_NRB_CYL instead. [deprecated]
Conx.SPOTWELD
Connection is a spotweld.
Conx.SPOTWELD_
BEAM
Conx.SPOTWELD_
SOLID1
Conx.SPOTWELD_
SOLID12
Conx.SPOTWELD_
SOLID16
Conx.SPOTWELD_
SOLID4
Conx.SPOTWELD_
SOLID8
Conx properties
Name
Type
Description
adhesive_
esize
float
adhesive_
nelem
integer
adhesive_
width
float
angtol
float
angtol2
float
assembly
integer/string Assembly used to specify panels connection together, rather than individual layers.
Integer for a part set ID, string for a Primer assembly (name).
assembly_
type
constant
colour
Colour
diameter
float
Diameter of spotweld/rigid
diameter2
float
edge_
distance
float
edge_lock
logical
31
Conx class
error
string
error_details string
fit
integer
id
integer
Conx number. Also see the label property which is an alternative name for this.
include
integer
label
integer
Conx number. Also see the id property which is an alternative name for this.
layers
integer
length
float
length2
float
material
integer
The ID of the Material used for merge bolt connections. i.e. Conx.BOLT_MRG_CYL,
Conx.BOLT_MRG_CYL_BEAM, Conx.BOLT_MRG_CYL_DISC etc.
model
integer
module
string
part
integer
The ID of the Part used for adhesive or spotweld connections. Note that in v11.0 and
above you are able to specify a different part IDs for elements in the connection between
different layers. If you only have one part for the elements in the connection, then this is
the value of this property. If there is more than one used, then the value of this property
is the first part. If you set this property to a new value, then the all the elements in the
connection will have this new part ID when it is realized. To set and retrieve information
on parts used between different layers, the functions GetPidData() and SetPidData()
should be used.
patch_
coords
integer
The number of patch coordinate points the connection has (Adhesive patch only).
patch_topol
integer
The number of patch topology entries the connection has (Adhesive patch only).
path
integer
The number of path points the connection has (Adhesive only). Note that these points do
NOT include the start and end points for the adhesive run. These are defined using the
properties x, y, z and x2, y2, z2
pitch
float
resize
integer
shape
integer
shape2
integer
status
constant
32
March 2016
Conx class
subtype
constant
title
string
transparency integer
type
constant
user_data
string
float
X coordinate
x2
float
float
Y coordinate
y2
float
float
Z coordinate
z2
float
Detailed Description
The Conx class allows you to create, modify, edit and manipulate connections. See the documentation below for more
details.
Constructor
new Conx(Model[Model], x[float], y[float], z[float], type (optional)[constant],
subtype (optional)[constant], title (optional)[string])
Description
Create a new Conx object.
March 2016
33
Conx class
Arguments
Name
Type
Description
Model
Model
float
X coordinate
float
Y coordinate
float
Z coordinate
type
(optional)
subtype
(optional)
constant Subtype of connection. See property subtype for valid values. If omitted subtype will be set
to the default subtype for this type of connection.
title
(optional)
string
Return type
Conx object
Example
To create a new connection in model m, at coordinates (20, 40, 10)
var c = new Conx(m, 20, 40, 10);
Details of functions
Blank()
Description
Blanks the connection
Arguments
No arguments
Return type
No return value
Example
To blank connection c:
c.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
34
March 2016
Conx class
Return type
No return value
Example
To blank all of the connections in model m:
Conx.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the connections in model m flagged with f:
Conx.BlankFlagged(m, f);
Blanked()
Description
Checks if the connection is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if connection c is blanked:
if (c.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the connection.
March 2016
35
Conx class
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for connection c:
c.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the connection.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy connection c into connection z:
var z = c.Copy();
EmptyPatch()
Description
Empties the patch topology/coordinates data.
Arguments
No arguments
Return type
No return value.
Example
To empty the patch topology/coordinates data for connection c;
c.EmptyPatch();
36
March 2016
Conx class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for connection c:
c.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first connection in the model.
Arguments
Name Type
Description
Return type
Conx object (or null if there are no connections in the model).
Example
To get the first connection in model m:
var c = Conx.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Conx label.
March 2016
37
Conx class
Example
To get the first free connection label in model m:
var label = Conx.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the connections with flag f in model m:
Conx.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the connection is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if connection c has flag f set on it:
if (c.Flagged(f) ) do_something...
38
March 2016
Conx class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the connections in model m:
Conx.ForEach(m, test);
function test(c)
{
// c is Conx object
}
To call function test for all of the connections in model m with optional object:
var data = { x:0, y:0 };
Conx.ForEach(m, test, data);
function test(c, extra)
{
// c is Conx object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Conx objects for all of the connections in a model in Primer
Arguments
Name Type
Description
Return type
Array of Conx objects
Example
To make an array of Conx objects for all of the connections in model m
var c = Conx.GetAll(m);
GetElements()
Description
Returns the beams/solids that are used in the connection.
Arguments
No arguments
March 2016
39
Conx class
Return type
An array containing the element IDs (or null if no elements).
Example
To get the elements for connection c:
var elems = c.GetElements();
Arguments
Name Type
Description
Flag
Return type
Array of Conx objects
Example
To make an array of Conx objects for all of the connections in model m flagged with f
var c = Conx.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the connection you want the Conx object for
Return type
Conx object (or null if connection does not exist).
Example
To get the Conx object for connection 100 in model m
var c = Conx.GetFromID(m, 100);
GetLayerData(layer[integer])
Description
Returns the data for a layer of the connection.
40
March 2016
Conx class
Arguments
Name Type
layer
Description
integer The layer you want the data for. Note that layers start at 0, not 1.
Return type
An array containing the layer data.
Example
To get the data for the 3rd layer for connection c:
var l_data = c.GetLayerData(2);
GetLayerShells(layer[integer])
Description
Returns the attached shells for a layer of the connection.
Arguments
Name Type
layer
Description
integer The layer you want the data for. Note that layers start at 0, not 1.
Return type
An array containing the shell objects or null if not valid
Example
To get the attached shells for the 3rd layer for connection c:
var shells = c.GetLayerShells(2);
GetParameter(prop[connection property])
Description
Checks if a Conx 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 Conx.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
March 2016
41
Conx class
Example
To check if Conx property c.example is a parameter:
Options.property_parameter_names = true;
if (c.GetParameter(c.example) ) do_something...
Options.property_parameter_names = false;
To check if Conx property c.example is a parameter by using the GetParameter method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
GetPatchCoords(point[integer])
Description
Returns the data for a patch coordinate of an adhesive patch connection.
Arguments
Name Type
point
Description
integer The point you want the data for. Note that points start at 0, not 1.
Return type
An array containing the patch coordinate.
Example
To get the data for the 3rd patch coordinate for connection c:
var p_data = c.GetPatchCoords(2);
GetPatchTopol(point[integer])
Description
Returns the topology for a patch quad/tria of an adhesive patch connection.
Arguments
Name Type
point
Description
integer The patch quad/tria you want the data for. Note that points start at 0, not 1.
Return type
An array containing the patch topology information.
Example
To get the data for the 3rd patch quad/tria for connection c:
var p_data = c.GetPatchTopol(2);
GetPathData(point[integer])
Description
Returns the data for a path point of an adhesive/spotweld line connection.
42
March 2016
Conx class
Arguments
Name Type
point
Description
integer The point you want the data for. Note that points start at 0, not 1.
Return type
An array containing the path data.
Example
To get the data for the 3rd path point for connection c:
var p_data = c.GetPathData(2);
GetPidData()
Description
Returns an array of Part objects for the connection FE entities. A connection can contain elements with different part
IDs between different layers. If one part ID is returned, that part is used for all elements in the connection. Not
applicable for bolts.
Arguments
No arguments
Return type
Array of Part objects
Example
To make an array of Part objects for connection c
var arr = Conx.GetPidData();
Keyword()
Description
Returns the keyword for this connection (*CONNECTION_START_SPOTWELD etc). Note that a carriage return is
not added. See also Conx.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for connection c:
var key = c.Keyword();
KeywordCards()
Description
Returns the keyword cards for the connection. Note that a carriage return is not added. See also Conx.Keyword()
March 2016
43
Conx class
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for connection c:
var cards = c.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last connection in the model.
Arguments
Name Type
Description
Return type
Conx object (or null if there are no connections in the model).
Example
To get the last connection in model m:
var c = Conx.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Conx label.
Example
To get the last free connection label in model m:
var label = Conx.LastFreeLabel(m);
44
March 2016
Conx class
Next()
Description
Returns the next connection in the model.
Arguments
No arguments
Return type
Conx object (or null if there are no more connections in the model).
Example
To get the connection in model m after connection c:
var c = c.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Conx label.
Example
To get the next free connection label in model m:
var label = Conx.NextFreeLabel(m);
March 2016
45
Conx class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the connection can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Conx object (or null if not picked)
Example
To pick a connection from model m giving the prompt Pick connection from screen:
var c = Conx.Pick(Pick connection from screen, m);
Previous()
Description
Returns the previous connection in the model.
Arguments
No arguments
Return type
Conx object (or null if there are no more connections in the model).
Example
To get the connection in model m before connection c:
var c = c.Previous();
RealizeAll(Model[Model]) [static]
Description
Realizes all of the connections in the model.
Arguments
Name Type
Description
Return type
No return value
Example
To realize all of the connections in model m:
Conx.RealizeAll(m);
46
March 2016
Conx class
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To realize all of the connections in model m flagged with f:
Conx.RealizeFlagged(m, f);
RemovePatchTopol(layer[integer])
Description
Deletes the topology at a particular location for patch type adhesive.
Arguments
Name Type
layer
Description
integer The topology location you want to remove. Note that layers start at 0, not 1.
Return type
No return value.
Example
To remove the 3rd topology data for connection c:
c.RemovePatchTopol(2);
RemovePathData(layer[integer])
Description
Deletes a pathc point for a line adhesive connection.
Arguments
Name Type
layer
Description
integer The point you want to remove. Note that layers start at 0, not 1.
Return type
No return value.
March 2016
47
Conx class
Example
To remove the 3rd point from connection c:
c.RemovePathData(2);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the connections in model m, from 1000000:
Conx.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged connections will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the connections in model m flagged with f, from 1000000:
Conx.RenumberFlagged(m, f, 1000000);
48
March 2016
Conx class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only connections from that model can be selected. If the
Flag
argument is a Flag then only connections that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any connections can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of connections selected or null if menu cancelled
Example
To select connections from model m, flagging those selected with flag f, giving the prompt Select connections:
Conx.Select(f, Select connections, m);
To select connections, flagging those selected with flag f but limiting selection to connections flagged with flag l,
giving the prompt Select connections:
Conx.Select(f, Select connections, l);
SetFlag(flag[Flag])
Description
Sets a flag on the connection.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for connection c:
c.SetFlag(f);
March 2016
49
Conx class
Arguments
Name
Type
Description
layer
integer
The layer you want to set the data for. Note that layers start at 0, not 1.
item1
integer/string The first item for the layer definition. As layer definitions can be part IDs, part names,
CAD names, part set IDs, part set names or assemby names the following logic is used. If
the item is an integer it is assumed to be a part ID. If the item is a string then it must be in
the format P<part ID>, P:<part name>, C:<CAD name>, S<set ID>, S:<set name> or
A:<assembly name>.
item2
(optional)
integer/string The second item for the layer definition. This must be type same type as item1. e.g. if
item1 is a part ID, item2 must be a part ID (it cannot be a part name etc).
...
(optional)
integer/string The nth item for the layer definition. This must be type same type as item1. e.g. if item1
is a part ID, this item must be a part ID (it cannot be a part name etc).
Return type
No return value.
Example
To set the data for the 3rd layer for connection c, to be part IDs 10 and 20:
c.SetLayerData(2, 10, 20);
or
var a = new Array(10, 20);
c.SetLayerData(2, a);
Arguments
Name Type
Description
point
integer The point you want to set the data for. Note that points start at 0, not 1.
float
X coordinate of point
float
Y coordinate of point
float
Z coordinate of point
Return type
No return value.
Example
To set the position for the 3rd patch point for connection c, to be (10, 20, 30);
c.SetPatchCoords(2, 10, 20, 30);
50
March 2016
Conx class
Arguments
Name
Type
Description
point
integer The point you want to set the data for. Note that points start at 0, not 1.
Return type
No return value.
Example
To set the topology for the 3rd patch quad/tria for connection c, to be (1, 4, 3, 6);
c.SetPatchTopol(2, 1, 4, 3, 6);
Arguments
Name Type
Description
point
integer The point you want to set the data for. Note that points start at 0, not 1.
float
X coordinate of point
float
Y coordinate of point
float
Z coordinate of point
Return type
No return value.
Example
To set the position for the 3rd path point for connection c, to be (10, 20, 30);
c.SetPathData(2, 10, 20, 30);
March 2016
51
Conx class
Arguments
Name
Type
Description
item1
integer/string Part label of the first item in the PID layer list.
item2 (optional) integer/string The second item for the layer definition.
... (optional)
Return type
No return value.
Example
To set the part data for c, to be part IDs 10 and 20:
c.SetPidData(10, 20);
or
var a = new Array(10, 20);
c.SetPidData(a);
Sketch(redraw (optional)[boolean])
Description
Sketches the connection. The connection will be sketched until you either call Conx.Unsketch(), Conx.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the connection is sketched. If omitted redraw is true. If
you want to sketch several connections and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch connection c:
c.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing connections should be counted. If false or omitted referenced but
undefined connections will also be included in the total.
52
March 2016
Conx class
Return type
number of connections
Example
To get the total number of connections in model m:
var total = Conx.Total(m);
Unblank()
Description
Unblanks the connection
Arguments
No arguments
Return type
No return value
Example
To unblank connection c:
c.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the connections in model m:
Conx.UnblankAll(m);
March 2016
53
Conx class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the connections in model m flagged with f:
Conx.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all connections will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the connections in model m:
Conx.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the connection.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the connection is unsketched. If omitted redraw is true.
If you want to unsketch several connections and only redraw after the last one then use false
for redraw and call View.Redraw().
Return type
No return value
54
March 2016
Conx class
Example
To unsketch connection c:
c.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the connections 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().
Return type
No return value
Example
To unsketch all connections in model m:
Conx.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Conx object.
Example
To check if Conx property c.example is a parameter by using the Conx.GetParameter() method:
if (c.ViewParameters().GetParameter(c.example) ) do_something...
March 2016
55
Conx class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for connection c:
c.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this connection.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for connection c:
var xrefs = c.Xrefs();
toString()
Description
Creates a string containing the connection data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Conx.Keyword() and Conx.KeywordCards().
Arguments
No arguments
Return type
string
Example
To get data for connection n in keyword format
var s = c.toString();
56
March 2016
Dummy class
Dummy class
The Dummy class gives you access to dummy cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetAssembly(index[integer])
GetParameter(prop[dummy property])
GetPoint(index[integer])
GetPointData(rpt[integer])
GetPointTitle(rpt[integer])
Next()
Previous()
RemovePoint(index[integer])
SetFlag(flag[Flag])
SetPoint(index[integer], data[Object])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
Dummy properties
Name
Type
Description
logical true if dummy exists, false if referred to but not defined. (read only)
id
integer Dummy number. Also see the label property which is an alternative name for this. (read only)
include
label
integer Dummy number. Also see the id property which is an alternative name for this. (read only)
model
57
Dummy class
points
title
string
Dummy title.
xhpoint
float
yhpoint
float
zhpoint
float
Detailed Description
The Dummy class allows you to create, modify, edit and manipulate dummy cards. See the documentation below for
more details.
Details of functions
Blank()
Description
Blanks the dummy
Arguments
No arguments
Return type
No return value
Example
To blank dummy d:
d.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the dummies in model m:
Dummy.BlankAll(m);
58
March 2016
Dummy class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the dummies in model m flagged with f:
Dummy.BlankFlagged(m, f);
Blanked()
Description
Checks if the dummy is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if dummy d is blanked:
if (d.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the dummy.
Arguments
Name Type Description
flag
Return type
No return value
March 2016
59
Dummy class
Example
To clear flag f for dummy d:
d.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the dummy.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy dummy d into dummy z:
var z = d.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for dummy d:
d.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first dummy in the model.
60
March 2016
Dummy class
Arguments
Name Type
Description
Return type
Dummy object (or null if there are no dummies in the model).
Example
To get the first dummy in model m:
var d = Dummy.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Dummy label.
Example
To get the first free dummy label in model m:
var label = Dummy.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
March 2016
61
Dummy class
Example
To flag all of the dummies with flag f in model m:
Dummy.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the dummy is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if dummy d has flag f set on it:
if (d.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
62
March 2016
Dummy class
Example
To call function test for all of the dummies in model m:
Dummy.ForEach(m, test);
function test(d)
{
// d is Dummy object
}
To call function test for all of the dummies in model m with optional object:
var data = { x:0, y:0 };
Dummy.ForEach(m, test, data);
function test(d, extra)
{
// d is Dummy object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Dummy objects for all of the dummies in a model in Primer
Arguments
Name Type
Description
Return type
Array of Dummy objects
Example
To make an array of Dummy objects for all of the dummies in model m
var d = Dummy.GetAll(m);
GetAssembly(index[integer])
Description
Returns the information for an assembly
Arguments
Name Type
Description
index integer The index of the assembly you want the coordinates for. Note that reference points start at 0, not 1.
0 <= index < assemblies
Return type
Object containing the assembly information (properties label, title, parent)
Example
To get the information for the 3rd assembly for dummy d:
var info = d.GetAssembly(2);
March 2016
63
Dummy class
Arguments
Name Type
Description
Flag
Return type
Array of Dummy objects
Example
To make an array of Dummy objects for all of the dummies in model m flagged with f
var d = Dummy.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the dummy you want the Dummy object for
Return type
Dummy object (or null if dummy does not exist).
Example
To get the Dummy object for dummy 100 in model m
var d = Dummy.GetFromID(m, 100);
GetParameter(prop[dummy property])
Description
Checks if a Dummy 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 Dummy.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
64
Description
March 2016
Dummy class
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Dummy property d.example is a parameter:
Options.property_parameter_names = true;
if (d.GetParameter(d.example) ) do_something...
Options.property_parameter_names = false;
To check if Dummy property d.example is a parameter by using the GetParameter method:
if (d.ViewParameters().GetParameter(d.example) ) do_something...
GetPoint(index[integer])
Description
Returns the information for a reference point
Arguments
Name Type
Description
index integer The index of the reference point you want the information for. Note that reference points start at 0,
not 1. 0 <= index < points
Return type
Object containing the reference point information (properties label, title, x, y, z, node, assembly, csys, tx, ty, tz, rx, ry,
rz)
Example
To get the information for the 3rd reference point for dummy d:
var info = d.GetPoint(2);
GetPointData(rpt[integer])
Description
Returns the coordinates of a reference point
Arguments
Name Type
rpt
Description
integer The reference point you want the coordinates for. Note that reference points start at 0, not 1.
Return type
Array containing the reference point coordinates
Example
To get the coordinates of the 3rd reference point for dummy d:
var c = d.GetPointData(2);
March 2016
65
Dummy class
GetPointTitle(rpt[integer])
Description
Returns the title of a reference point
Arguments
Name Type
rpt
Description
integer The reference point you want the title for. Note that reference points start at 0, not 1.
Return type
The reference point title
Example
To get the title of the 3rd reference point for dummy d:
var c = d.GetPointTitle(2);
Last(Model[Model]) [static]
Description
Returns the last dummy in the model.
Arguments
Name Type
Description
Return type
Dummy object (or null if there are no dummies in the model).
Example
To get the last dummy in model m:
var d = Dummy.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Dummy label.
66
March 2016
Dummy class
Example
To get the last free dummy label in model m:
var label = Dummy.LastFreeLabel(m);
Next()
Description
Returns the next dummy in the model.
Arguments
No arguments
Return type
Dummy object (or null if there are no more dummies in the model).
Example
To get the dummy in model m after dummy d:
var d = d.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Dummy label.
Example
To get the next free dummy label in model m:
var label = Dummy.NextFreeLabel(m);
March 2016
67
Dummy class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the dummy can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Dummy object (or null if not picked)
Example
To pick a dummy from model m giving the prompt Pick dummy from screen:
var d = Dummy.Pick(Pick dummy from screen, m);
Previous()
Description
Returns the previous dummy in the model.
Arguments
No arguments
Return type
Dummy object (or null if there are no more dummies in the model).
Example
To get the dummy in model m before dummy d:
var d = d.Previous();
RemovePoint(index[integer])
Description
Removes a reference point from a dummy
Arguments
Name Type
Description
index integer The index of the reference point you want to remove. Note that reference points start at 0, not 1. 0
<= index < points
Return type
no return value
68
March 2016
Dummy class
Example
To remove for the 3rd reference point for dummy d:
d.RemovePoint(2);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the dummies in model m, from 1000000:
Dummy.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged dummies will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the dummies in model m flagged with f, from 1000000:
Dummy.RenumberFlagged(m, f, 1000000);
March 2016
69
Dummy class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only dummies from that model can be selected. If the
Flag
argument is a Flag then only dummies that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any dummies can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of dummies selected or null if menu cancelled
Example
To select dummies from model m, flagging those selected with flag f, giving the prompt Select dummies:
Dummy.Select(f, Select dummies, m);
To select dummies, flagging those selected with flag f but limiting selection to dummies flagged with flag l, giving the
prompt Select dummies:
Dummy.Select(f, Select dummies, l);
SetFlag(flag[Flag])
Description
Sets a flag on the dummy.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for dummy d:
d.SetFlag(f);
SetPoint(index[integer], data[Object])
Description
Sets the data for a reference point in a dummy
70
March 2016
Dummy class
Arguments
Name Type
Description
index integer The index of the reference point you want to set. Note that reference points start at 0, not 1. To add
a new point use index points
data
Object Object containing the reference point data. The properties can be:
assembly (required)
x [float] (not required if using node)
y [float] (not required if using node)
z [float] (not required if using node)
node [integer] (not required if using x, y and z)
title [string] (optional)
csys [integer] (optional)
tx [boolean] (optional)
ty [boolean] (optional)
tz [boolean] (optional)
rx [boolean] (optional)
ry [boolean] (optional)
rz [boolean] (optional)
Return type
no return value
Example
To add a new reference point to dummy d assembly 5 at node 1000 with title "Example point" restrained in x:
var data = { assembly:5, node:1000, title:"Example point", tx:true };
d.SetPoint(d.points, data);
To add a new reference point to dummy d assembly 5 at (10, 20, 30) with title "Example point":
var data = { assembly:5, x:10, y:20, z:30, title:"Example point" };
d.SetPoint(d.points, data);
Sketch(redraw (optional)[boolean])
Description
Sketches the dummy. The dummy will be sketched until you either call Dummy.Unsketch(), Dummy.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the dummy is sketched. If omitted redraw is true. If
you want to sketch several dummies and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch dummy d:
d.Sketch();
March 2016
71
Dummy class
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing dummies should be counted. If false or omitted referenced but undefined
dummies will also be included in the total.
Return type
number of dummies
Example
To get the total number of dummies in model m:
var total = Dummy.Total(m);
Unblank()
Description
Unblanks the dummy
Arguments
No arguments
Return type
No return value
Example
To unblank dummy d:
d.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
72
March 2016
Dummy class
Example
To unblank all of the dummies in model m:
Dummy.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the dummies in model m flagged with f:
Dummy.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all dummies will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the dummies in model m:
Dummy.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the dummy.
March 2016
73
Dummy class
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the dummy is unsketched. If omitted redraw is true. If
you want to unsketch several dummies and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch dummy d:
d.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the dummies 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().
Return type
No return value
Example
To unsketch all dummies in model m:
Dummy.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Dummy object.
Example
To check if Dummy property d.example is a parameter by using the Dummy.GetParameter() method:
if (d.ViewParameters().GetParameter(d.example) ) do_something...
74
March 2016
Dummy class
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for dummy d:
d.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this dummy.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for dummy d:
var xrefs = d.Xrefs();
March 2016
75
File class
File class
The File class allows you to read and write text files. More...
Class functions
Copy(source[string], dest[string])
Delete(filename[string])
DriveMapFilename(filename[string], format[constant])
Exists(filename[string])
FindFiles(directory[string], type (optional)[constant])
Get(url[string], filename[string], options (optional)[object])
IsAbsolute(filename[string])
IsDirectory(filename[string])
IsFile(filename[string])
IsReadable(filename[string])
IsWritable(filename[string])
Mkdir(directory[string])
Mktemp()
Proxy(name[string])
ProxyPassword(name[string])
ProxyUsername(username[string])
Rename(oldname[string], newname[string])
Size(filename[string])
Upload(filename[string], url[string], options (optional)[object])
Member functions
Close()
FindLineContaining(contain1[string], contain2 (optional)[string], contain3 (optional)[string], ... containn
(optional)[string])
FindLineStarting(start1[string], start2 (optional)[string], start3 (optional)[string], ... startn (optional)[string])
Flush()
ReadAll()
ReadArrayBuffer(length (optional)[integer])
ReadChar()
ReadLine()
ReadLongLine()
Seek(offset[integer], origin (optional)[constant])
Tell()
Write(string[Any valid javascript type])
WriteArrayBuffer(buffer[ArrayBuffer], length (optional)[integer])
Writeln(string[Any valid javascript type])
File constants
Name
Description
File.UTF8
File.WRITE
Description
File class
File.START
Description
Find files
File properties
Name
Type
Description
Name of the file
constant Mode the file was opened with (File.READ, File.WRITE etc)
Detailed Description
The File class gives you simple functions to read and write text files. The following simple example shows how to read
from the file "/data/test/file.txt" and print each line read to the dialogue box:
var f, line;
f = new File("/data/test/file.txt", File.READ);
while ( (line = f.ReadLine()) != undefined)
{
Message(line);
}
f.Close();
The following simple example shows how to write the numbers 1 to 10 to the file "/data/test/file.txt":
var n, line;
f = new File("/data/test/file.txt", File.WRITE);
for (n=1; n<=10; n++)
{
f.Writeln(n);
}
f.Close();
See the documentation below for more details.
Constructor
new File(filename[string], mode[constant])
Description
Create a new File object for reading and writing text files.
Arguments
Name
Type
filename string
mode
Description
Filename of the file you want to read/write. If reading, the file must exist. If writing, the file will
be overwritten (if it exists) if mode is File.WRITE, or if mode is File.APPEND it will be appended
to if it exists, or created if it does not.
When reading a file the filename can also be a URL (uniform resource locator) in which case the
file will be read from the remote site. See File.Get() for more details on the format of the URL.
constant The mode to open the file with. Can be File.READ, File.WRITE or File.APPEND. For
File.WRITE or File.APPEND it can also be ORed with File.BINARY if required. By default text
is read and written as ASCII. To read/write text in utf-8 mode can also be ORed with File.UTF8 if
required.
March 2016
77
File class
Return type
File object
Example
To create a new file object to read file "/data/test/file.txt"
var f = new File("/data/test/file.txt", File.READ);
Details of functions
Close()
Description
Close a file opened by a File object.
Arguments
No arguments
Return type
No return value
Example
To close File object f.
f.Close();
Arguments
Name Type Description
source string Source filename you want to copy.
dest
Return type
true if copy successful, false otherwise.
Example
To copy the file "/data/test/file.key" to "/data/test/file.key_backup"
var copied = File.Copy("/data/test/file.key", "/data/test/file.key_backup");
Delete(filename[string]) [static]
Description
Deletes a file
78
March 2016
File class
Arguments
Name
Type Description
Return type
true if successful, false if not.
Example
To delete the file "/data/test/file.key"
var deleted = File.Delete("/data/test/file.key");
Arguments
Name
Type
filename string
format
Description
Filename you want to drive map.
constant The format for the file/directory name. Can be Include.NATIVE, Include.UNIX or
Include.WINDOWS
Return type
string containing drive mapped filename
Example
If Primer has drive S: mapped to "/data" (by using the primer*drive_s preference)
var mapped = File.DriveMapFilename("/data/test/file.key", Include.WINDOWS);
mapped will be "S:\test\file.key".
var mapped = File.DriveMapFilename("S:\\test\\file.key", Include.UNIX);
mapped will be "/data/test/file.key".
Exists(filename[string]) [static]
Description
Check if a file exists. See also File.IsDirectory() and See also File.IsFile().
Arguments
Name
Type Description
Return type
true/false
March 2016
79
File class
Example
To see if the file "/data/test/file.key" exists
if (File.Exists("/data/test/file.key")) { do something }
Arguments
Name
Type
Description
directory
string
type
(optional)
constant Type of things to find. Can be bitwise OR of File.FILE and File.DIRECTORY. If omitted
only files will be returned.
Return type
Array of filenames/directories
Example
To return the filenames in the directory /data/test:
var fileList = File.FindFiles("/data/test")
To return the directories in the directory /data/test:
var fileList = File.FindFiles("/data/test", File.DIRECTORY)
To return the files and directories in the directory /data/test:
var fileList = File.FindFiles("/data/test", File.FILE|File.DIRECTORY)
Arguments
Name
Type Description
contain1
contain2 (optional)
contain3 (optional)
... containn (optional) string alternative string which matching lines must contain
Return type
string read from file or undefined if end of file
80
March 2016
File class
Example
Loop, reading lines from File object f which contain example.
var line;
while ( (line = file.FindLineContaining("example") ) != undefined)
{
}
Arguments
Name
Type Description
start1
start2 (optional)
start3 (optional)
... startn (optional) string alternative string which matching lines must start with
Return type
string read from file or undefined if end of file
Example
Loop, reading lines from File object f which start example.
var line;
while ( (line = file.FindLineStarting("example") ) != undefined)
{
}
Flush()
Description
Flushes a file opened for writing by a File object.
Arguments
No arguments
Return type
No return value
Example
To flush File object f.
f.Flush();
March 2016
81
File class
Arguments
Name
Type Description
url
string URL (uniform resource locator) of remote file you want to get. Currently http and ftp are
supported. For http give the full address including the leading http://. e.g.
http://www.example.com/file.html.
For ftp an optional username and password can be given. e.g.
ftp://ftp.example.com retrieves the directory listing for the root directory.
ftp://ftp.example.com/readme.txt downloads the file readme.txt from the root directory.
ftp://user:password@ftp.example.com/readme.txt retrieves the readme.txt file from the users
home directory.
filename
options
(optional)
object Options for get. Currently the only available properties are username (string), password (string)
and response (boolean). If username and password are set then basic authorization using the
username and password will be used. If response is used and is true then the response code will
be returned instead of true/false. This can be used to retrieve error messages and codes when the
file is not returned successfully.
Return type
true if file was successfully got, false otherwise.
Example
To get the file "http://www.example.com/file.html" and save it to C:\temp:
File.Get("http://www.example.com/file.html", "C:\temp\file.html");
IsAbsolute(filename[string]) [static]
Description
Check if a filename is absolute or relative.
Arguments
Name
Type Description
Return type
true/false
Example
To see if the filename "/data/test" is absolute (which it is!)
if (File.IsAbsolute("/data/test")) { do something }
IsDirectory(filename[string]) [static]
Description
Check if a filename is a directory. See also File.Exists(), File.IsFile(), File.IsReadable() and File.IsWritable().
82
March 2016
File class
Arguments
Name
Type Description
Return type
true/false
Example
To see if the filename "/data/test" is a directory
if (File.IsDirectory("/data/test")) { do something }
IsFile(filename[string]) [static]
Description
Check if a filename is a file. See also File.Exists(), File.IsDirectory(), File.IsReadable() and File.IsWritable().
Arguments
Name
Type Description
Return type
true/false
Example
To see if the filename "/data/test" is a file
if (File.IsFile("/data/test")) { do something }
IsReadable(filename[string]) [static]
Description
Check if a filename has read permissions. See also File.Exists(), File.IsDirectory() and File.IsWritable().
Arguments
Name
Type Description
Return type
true/false
Example
To see if the filename "/data/test" is readable
if (File.IsReadable("/data/test")) { do something }
March 2016
83
File class
IsWritable(filename[string]) [static]
Description
Check if a filename has write permissions. See also File.Exists(), File.IsDirectory() and File.IsReadable().
Arguments
Name
Type Description
Return type
true/false
Example
To see if the filename "/data/test" is writable
if (File.IsWritable("/data/test")) { do something }
Mkdir(directory[string]) [static]
Description
Make a directory.
Arguments
Name
Type Description
Return type
true if successfully created, false if not.
Example
To make the directory "/data/test"
var success = File.Mkdir("/data/test");
Mktemp() [static]
Description
Make a temporary filename for writing a temporary file.
Arguments
No arguments
Return type
String name of temporary filename that can be used.
Example
To get a temp filename"
var filename = File.Mktemp();
84
March 2016
File class
Proxy(name[string]) [static]
Description
Set a proxy for files opened by http, ftp etc. See also File.Get(), File.ProxyPassword() and File.ProxyUsername().
Arguments
Name Type Description
name string The name of the proxy.
Return type
No return value
Example
To set the proxy to "http://example.proxy.com" using port 80:
File.Proxy("http://example.proxy.com:80");
ProxyPassword(name[string]) [static]
Description
Set a proxy password for files opened by http, ftp etc. See also File.Get(), File.Proxy() and File.ProxyUsername().
Arguments
Name Type Description
name string Password for the proxy server.
Return type
No return value
Example
To set the proxy password to "password":
File.ProxyPassword("password");
ProxyUsername(username[string]) [static]
Description
Set a proxy username for files opened by http, ftp etc. See also File.Get(), File.Proxy() and File.ProxyPassword().
Arguments
Name
Type Description
Return type
No return value
March 2016
85
File class
Example
To set the proxy username to "username":
File.ProxyUsername("username");
ReadAll()
Description
Reads all the remaining characters from a file opened for reading by a File object. As this function can read the entire
file as a string be careful when reading large files as it will consume large amounts of memory.
Arguments
No arguments
Return type
characters read from file or
undefined
if end of file
Example
Read all characters from File object f.
var c = f.ReadAll();
ReadArrayBuffer(length (optional)[integer])
Description
Reads binary data from a file opened for reading by a File object. The data is returned as an ArrayBuffer object. For
more details on how to use an ArrayBuffer see the following links:
https://developer.mozilla.org/en/JavaScript_typed_arrays
https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBuffer
https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBufferView
https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView.
Arguments
Name
Type
Description
length
(optional)
integer Number of bytes to try to read from the file. If omitted all the remaining data from the file
will be read.
Return type
ArrayBuffer object or undefined if end of file
Example
To read data as 32bit unsigned integers from File object f.
var ab = f.ReadArrayBuffer();
var u32 = new Uint32Array(ab);
for (var i=0; i<u32.length; i++
{
var value = u32[i];
}
86
March 2016
File class
ReadChar()
Description
Reads a single character from a file opened for reading by a File object.
Arguments
No arguments
Return type
character read from file or
undefined
if end of file
Example
Loop, reading characters from File object f.
var c;
while ( (c = f.ReadChar()) != undefined) { ... }
ReadLine()
Description
Reads a line from a file opened for reading by a File object. To enable this function to be as fast as possible a maximum
line length of 512 characters is used. If you expect a file to have lines longer than 512 characters then use
ReadLongLine which allows lines of any length.
Arguments
No arguments
Return type
string read from file or
undefined
if end of file
Example
Loop, reading lines from File object f.
var line;
while ( (line = f.ReadLine()) != undefined) { ... }
ReadLongLine()
Description
Reads a line from a file opened for reading by a File object. The line can be any length. If your file has lines shorter
than 512 characters then you may want to use ReadLine instead which is faster.
Arguments
No arguments
March 2016
87
File class
Return type
string read from file or
undefined
if end of file
Example
Loop, reading lines from File object f.
var line;
while ( (line = f.ReadLongLine()) != undefined) { ... }
Arguments
Name
Type Description
Return type
true if successful, false if not.
Example
To rename the file "/data/test/file.key" to "/data/test/new_file.key"
var size = File.Rename("/data/test/file.key", "/data/test/new_file.key");
Arguments
Name
Type
Description
offset
integer
origin
(optional)
constant Origin for offset. Must be one of File.START, File.END or File.CURRENT. If omitted
File.START will be used.
Return type
no return value
88
March 2016
File class
Example
To seek to the end of File f:
f.Seek(0, File.END);
To seek to the beginning of File f:
f.Seek(0, File.START);
To move forward 10 characters in File f:
f.Seek(10, File.CURRENT);
Size(filename[string]) [static]
Description
Return the size of a file in bytes
Arguments
Name
Type Description
Return type
size in bytes
Example
To get the size of the file "/data/test/file.key"
var size = File.Size("/data/test/file.key");
Tell()
Description
Return the current file position for a File object. Note that on Windows when reading files if the file is not opened with
File.BINARY this may not return the correct file position for files with unix line endings.
Arguments
No arguments
Return type
integer
Example
To get the current file position for File f:
var pos = f.Tell();
March 2016
89
File class
Arguments
Name
Type Description
filename
url
string URL (uniform resource locator) of the remote location you want to upload the file to. Currently
only http is supported. Give the full address including the leading http://. e.g.
http://www.example.com/file.html.
options
(optional)
object Options for upload. Currently the only available properties are username and password. If both
of these are set then basic authorization using the username and password will be used.
Return type
true if file was successfully uploaded, false otherwise.
Example
To upload the file "C:\temp\file.txt" to "http://www.example.com/file.txt":
File.Upload("C:/temp/file.txt", "http://www.example.com/file.txt");
Arguments
Name Type
Description
string Any valid javascript type The string/item that you want to write
Return type
No return value
Example
To write string "Hello, world!" to File object f
f.Write("Hello, world!\n");
To write the title of model m to File object f
f.Write("The title of model 2 is " + m.title + "\n");
90
March 2016
File class
Arguments
Name
Type
Description
buffer
length
(optional)
integer
Number of bytes to write to the file. If omitted all the data in the ArrayBuffer will be
written (buffer.byteLength bytes)
Return type
No return value
Example
To write ArrayBuffer ab to File object f.
f.WriteArrayBuffer(ab);
Arguments
Name Type
Description
string Any valid javascript type The string/item that you want to write
Return type
No return value
Example
To write string "Hello, world!" to File object f automatically adding a carriage return
f.Writeln("Hello, world!");
To write the title of model m to File object f automatically adding a carriage return
f.Writeln("The title of model 2 is " + m.title);
March 2016
91
GeometrySurface class
GeometrySurface class
The GeometrySurface class gives you access to surfaces in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
CalculateNormal(u[real], y[real])
CalculatePoint(u[real], y[real])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetEdgeIndices()
GetParameter(prop[surface property])
GetTriaIndices()
GetVertices()
Next()
Previous()
ProjectPoint(x[real], y[real], z[real])
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
GeometrySurface properties
Name
Type
Description
exists
logical true if gsrf exists, false if referred to but not defined. (read only)
id
integer GeometrySurface number. Also see the label property which is an alternative name for this. (read
only)
include integer The Include file number that the gsrf is in.
label
integer GeometrySurface number. Also see the id property which is an alternative name for this. (read only)
model
92
March 2016
GeometrySurface class
Detailed Description
The GeometrySurface class allows you to create, modify, edit and manipulate surfaces cards. See the documentation
below for more details.
Details of functions
Blank()
Description
Blanks the surface
Arguments
No arguments
Return type
No return value
Example
To blank surface s:
s.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the surfaces in model m:
GeometrySurface.BlankAll(m);
March 2016
93
GeometrySurface class
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the surfaces in model m flagged with f:
GeometrySurface.BlankFlagged(m, f);
Blanked()
Description
Checks if the surface is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if surface s is blanked:
if (s.Blanked() ) do_something...
CalculateNormal(u[real], y[real])
Description
Calculate the normal vector for a parametric point on a surface.
Arguments
Name Type Description
u
real
u parametric coordinate
real
v parametric coordinate
Return type
Array containing x, y and z values.
Example
To obtain the surface normal at parametric point (0.2, 0.3) on surface s:
var coords = s.CalculateNormal(0.2, 0.3);
94
March 2016
GeometrySurface class
CalculatePoint(u[real], y[real])
Description
Calculate the X, Y and Z coordinates for a parametric point on a surface.
Arguments
Name Type Description
u
real
u parametric coordinate
real
v parametric coordinate
Return type
Array containing x, y and z values.
Example
To obtain the coordinates of parametric point (0.2, 0.3) on surface s:
var coords = s.CalculatePoint(0.2, 0.3);
ClearFlag(flag[Flag])
Description
Clears a flag on the surface.
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for surface s:
s.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the surface.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
March 2016
95
GeometrySurface class
Example
To copy surface s into surface z:
var z = s.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for surface s:
s.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first surface in the model.
Arguments
Name Type
Description
Return type
GeometrySurface object (or null if there are no surfaces in the model).
Example
To get the first surface in model m:
var s = GeometrySurface.First(m);
96
March 2016
GeometrySurface class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
GeometrySurface label.
Example
To get the first free surface label in model m:
var label = GeometrySurface.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the surfaces with flag f in model m:
GeometrySurface.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the surface is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if surface s has flag f set on it:
if (s.Flagged(f) ) do_something...
March 2016
97
GeometrySurface class
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the surfaces in model m:
GeometrySurface.ForEach(m, test);
function test(s)
{
// s is GeometrySurface object
}
To call function test for all of the surfaces in model m with optional object:
var data = { x:0, y:0 };
GeometrySurface.ForEach(m, test, data);
function test(s, extra)
{
// s is GeometrySurface object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of GeometrySurface objects for all of the surfaces in a model in Primer
Arguments
Name Type
Description
Return type
Array of GeometrySurface objects
Example
To make an array of GeometrySurface objects for all of the surfaces in model m
var s = GeometrySurface.GetAll(m);
98
March 2016
GeometrySurface class
GetEdgeIndices()
Description
Return an array of all the edge indices for a surface (in pairs).
Arguments
No arguments
Return type
array
Example
To get edge indices for surface s
var edges = s.GetEdgeIndices();
Arguments
Name Type
Description
Flag
Return type
Array of GeometrySurface objects
Example
To make an array of GeometrySurface objects for all of the surfaces in model m flagged with f
var s = GeometrySurface.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the surface you want the GeometrySurface object for
Return type
GeometrySurface object (or null if surface does not exist).
March 2016
99
GeometrySurface class
Example
To get the GeometrySurface object for surface 100 in model m
var s = GeometrySurface.GetFromID(m, 100);
GetParameter(prop[surface property])
Description
Checks if a GeometrySurface 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 GeometrySurface.ViewParameters() method
and method chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if GeometrySurface property s.example is a parameter:
Options.property_parameter_names = true;
if (s.GetParameter(s.example) ) do_something...
Options.property_parameter_names = false;
To check if GeometrySurface property s.example is a parameter by using the GetParameter method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
GetTriaIndices()
Description
Return an array of all the tria indices for a surface (in triplets).
Arguments
No arguments
Return type
array
Example
To get tria indices for surface s
var trias = s.GetTriaIndices();
GetVertices()
Description
Return an array of all the vertex coordinates for a surface (in triplets).
100
March 2016
GeometrySurface class
Arguments
No arguments
Return type
array
Example
To get vertex coordinates for surface s
var vertices = s.GetVertices();
Last(Model[Model]) [static]
Description
Returns the last surface in the model.
Arguments
Name Type
Description
Return type
GeometrySurface object (or null if there are no surfaces in the model).
Example
To get the last surface in model m:
var s = GeometrySurface.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
GeometrySurface label.
Example
To get the last free surface label in model m:
var label = GeometrySurface.LastFreeLabel(m);
March 2016
101
GeometrySurface class
Next()
Description
Returns the next surface in the model.
Arguments
No arguments
Return type
GeometrySurface object (or null if there are no more surfaces in the model).
Example
To get the surface in model m after surface s:
var s = s.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
GeometrySurface label.
Example
To get the next free surface label in model m:
var label = GeometrySurface.NextFreeLabel(m);
102
March 2016
GeometrySurface class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the gsrf can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
GeometrySurface object (or null if not picked)
Example
To pick a gsrf from model m giving the prompt Pick gsrf from screen:
var d = GeometrySurface.Pick(Pick gsrf from screen, m);
Previous()
Description
Returns the previous surface in the model.
Arguments
No arguments
Return type
GeometrySurface object (or null if there are no more surfaces in the model).
Example
To get the surface in model m before surface s:
var s = s.Previous();
Arguments
Name Type Description
x
real
real
real
Return type
Array containing u and v values.
March 2016
103
GeometrySurface class
Example
To obtain the projection of point (1, 2, 3) on to surface s:
var projection = s.ProjectPoint(1, 2, 3);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the surfaces in model m, from 1000000:
GeometrySurface.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged surfaces will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the surfaces in model m flagged with f, from 1000000:
GeometrySurface.RenumberFlagged(m, f, 1000000);
104
March 2016
GeometrySurface class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only surfaces from that model can be selected. If the
Flag
argument is a Flag then only surfaces that are flagged with limit can be selected (limit should
be different to flag). If omitted, or null, any surfaces can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of surfaces selected or null if menu cancelled
Example
To select surfaces from model m, flagging those selected with flag f, giving the prompt Select surfaces:
GeometrySurface.Select(f, Select surfaces, m);
To select surfaces, flagging those selected with flag f but limiting selection to surfaces flagged with flag l, giving the
prompt Select surfaces:
GeometrySurface.Select(f, Select surfaces, l);
SetFlag(flag[Flag])
Description
Sets a flag on the surface.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for surface s:
s.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the surface. The surface will be sketched until you either call GeometrySurface.Unsketch(),
GeometrySurface.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the surface is sketched. If omitted redraw is true. If
you want to sketch several surfaces and only redraw after the last one then use false for redraw
and call View.Redraw().
March 2016
105
GeometrySurface class
Return type
No return value
Example
To sketch surface s:
s.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing surfaces should be counted. If false or omitted referenced but undefined
surfaces will also be included in the total.
Return type
number of surfaces
Example
To get the total number of surfaces in model m:
var total = GeometrySurface.Total(m);
Unblank()
Description
Unblanks the surface
Arguments
No arguments
Return type
No return value
Example
To unblank surface s:
s.Unblank();
106
March 2016
GeometrySurface class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the surfaces in model m:
GeometrySurface.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the surfaces in model m flagged with f:
GeometrySurface.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all surfaces will be unset in
flag
Flag
Return type
No return value
March 2016
107
GeometrySurface class
Example
To unset the flag f on all the surfaces in model m:
GeometrySurface.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the surface.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the surface is unsketched. If omitted redraw is true. If
you want to unsketch several surfaces and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch surface s:
s.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the surfaces 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().
Return type
No return value
Example
To unsketch all surfaces in model m:
GeometrySurface.UnsketchAll(m);
ViewParameters()
Description
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.
108
March 2016
GeometrySurface class
Arguments
No arguments
Return type
GeometrySurface object.
Example
To check if GeometrySurface property s.example is a parameter by using the GeometrySurface.GetParameter() method:
if (s.ViewParameters().GetParameter(s.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for surface s:
s.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this surface.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for surface s:
var xrefs = s.Xrefs();
March 2016
109
Graphics class
Graphics class
The Graphics class allows you to draw graphics in PRIMER. More...
Class functions
DepthTest(enable[boolean])
DrawingFunction(name[function])
FillColour(colour[Colour])
Finish()
Line(x1[float], y1[float], z1[float], x2[float], y2[float], z2[float])
LineColour(colour[Colour])
LineStyle(style[constant])
LineTo(x[float], y[float], z[float])
LineWidth(width[Integer])
MoveTo(x[float], y[float], z[float])
PolygonFinish()
PolygonStart()
Shape(shape[constant], size[integer])
Start()
Text(text[String])
TextColour(colour[Colour])
TextSize(size[Integer])
Graphics constants
Name
Description
Graphics.CIRCLE
Graphics.DASHDOT_LINE
Graphics.DASH_LINE
Graphics.DIAMOND
Graphics.DOT_LINE
Graphics.FILLED_CIRCLE
Graphics.FILLED_DIAMOND
Graphics.HOURGLASS
Graphics.POINT
Graphics.SOLID_LINE
Graphics.SQUARE
Detailed Description
The Graphics class gives you access to functions to draw lines, shapes etc on the graphics screen in PRIMER. For
example the following will draw a solid thick red line on the screen:
Graphics.Start();
Graphics.LineWidth(3);
Graphics.LineColour(Colour.RED);
Graphics.LineStyle(Graphics.SOLID_LINE);
Graphics.Line(0, 0, 0, 10, 20, 30);
Graphics.Finish();
The drawing commands must be between
110
March 2016
Graphics class
Graphics.Start()
and
Graphics.Finish()
or else nothing will be seen. This is suitable for sketching but the line will disappear if the graphics are redrawn or any
dynamic viewing is done. To draw graphics which will stay on the screen even if dynamic viewing or a redraw is done
you have to register a function using Graphics.DrawingFunction() which will be called every time the graphics are
redrawn by PRIMER. e.g:
var w = new Window("Graphics test", 0.8, 1.0, 0.5, 0.6);
var e = new Widget(w, Widget.BUTTON, 1, 21, 1, 7, "Exit");
e.onClick = Exit;
do_draw();
Graphics.DrawingFunction(do_draw);
w.Show();
////////////////////////////////////////////////////////////////////////////////
function do_draw()
{
Graphics.Start();
Graphics.LineWidth(3);
Graphics.LineColour(Colour.RED);
Graphics.LineStyle(Graphics.SOLID_LINE);
Graphics.Line(0, 0, 0, 10, 20, 30);
Graphics.Finish();
}
See the documentation below for more details.
Details of functions
DepthTest(enable[boolean]) [static]
Description
Allows depth testing (hidden surface removal) to be turned on or off. Temporarily turning depth testing off may be used
to ensure that an item (e.g. some text) is always drawn in front and will not be obscured.
Arguments
Name Type
Description
enable boolean Whether depth testing (hidden surface removal) is performed (true) or not (false)
Return type
No return value
Example
To turn off depth testing:
Graphics.DepthTest(false);
To turn depth testing back on:
Graphics.DepthTest(true);
March 2016
111
Graphics class
DrawingFunction(name[function]) [static]
Description
Set the function to draw graphics from javaScript. This function will be called each time the graphics are redrawn after
PRIMER has finished drawing everything else. This allows you to add extra items to the graphics.
To remove the graphics drawing function use Graphics.DrawingFunction(null).
It is the responsibility of the script developer to ensure that any objects or variables that are used in the drawing
function do not refer to items in Primer that no longer exist. Not doing so may cause PRIMER to crash. For
example, if you use some Node objects in the drawing function that refer to nodes in model 1 and you delete the model,
when the graphics are redrawn PRIMER may crash as the nodes referred to by the Node objects no longer exist. You
should either remove the drawing function by calling Graphics.DrawingFunction(null) or set the Node variables to null
(and test that they exist before using them) in your drawing function before deleting the model.
Arguments
Name Type
Description
name function The name of the function (or null to remove a function)
Return type
No return value
Example
To set function MyRedrawFunction as the Graphics drawing function
Graphics.DrawingFunction(MyRedrawFunction);
FillColour(colour[Colour]) [static]
Description
Sets the colour for drawing polygons. See the Colour class for more details on colours.
Arguments
Name Type
Description
Return type
No return value
Example
To Set the current fill colour to red:
Graphics.FillColour(Colour.RED);
or
Graphics.FillColour( Colour.RGB(255, 0, 0) );
Finish() [static]
Description
Finish any graphics. See also Graphics.Start(). This must be used to finish drawing.
Arguments
No arguments
112
March 2016
Graphics class
Return type
No return value
Example
To finish any graphics operations:
Graphics.Finish();
Arguments
Name Type Description
x1
y1
z1
x2
y2
z2
Return type
No return value
Example
To draw a line from (0.0, 0.0, 0.0) to (10.0, 20.0, 30.0)
Graphics.Line(0.0, 0.0, 0.0, 10.0, 20.0, 30.0);
LineColour(colour[Colour]) [static]
Description
Sets the colour for drawing lines. See the Colour class for more details on colours.
Arguments
Name Type
Description
Return type
No return value
Example
To Set the current drawing colour to red:
Graphics.LineColour(Colour.RED);
or
Graphics.LineColour( Colour.RGB(255, 0, 0) );
March 2016
113
Graphics class
LineStyle(style[constant]) [static]
Description
Sets the style for drawing lines.
Arguments
Name Type
style
Description
constant The style to draw lines with. Can be: Graphics.SOLID_LINE, Graphics.DASH_LINE,
Graphics.DASHDOT_LINE or Graphics.DOT_LINE
Return type
No return value
Example
To Set the current line style to 3:
Graphics.LineStyle(3);
Arguments
Name Type Description
x
float X coordinate
float Y coordinate
float Z coordinate
Return type
No return value
Example
To draw a line from the current point to (10.0, 20.0, 30.0):
Graphics.LineTo(10.0, 20.0, 30.0);
LineWidth(width[Integer]) [static]
Description
Sets the width for drawing lines.
Arguments
Name Type
Description
Return type
No return value
114
March 2016
Graphics class
Example
To Set the current line width to 3:
Graphics.LineWidth(3);
Arguments
Name Type Description
x
float X coordinate
float Y coordinate
float Z coordinate
Return type
No return value
Example
To set the current point to (10.0, 20.0, 30.0):
Graphics.MoveTo(10.0, 20.0, 30.0);
PolygonFinish() [static]
Description
Ends drawing a polygon. See also Graphics.PolygonStart()
Arguments
No arguments
Return type
No return value
Example
To draw a red square:
Graphics.FillColour(Colour.RED);
Graphics.MoveTo(0.0, 0.0, 0.0);
Graphics.PolygonStart();
Graphics.MoveTo(10.0, 0.0, 0.0);
Graphics.MoveTo(10.0, 10.0, 0.0);
Graphics.MoveTo(0.0, 10.0, 0.0);
Graphics.PolygonFinish();
PolygonStart() [static]
Description
Starts drawing a polygon. See also Graphics.PolygonFinish()
March 2016
115
Graphics class
Arguments
No arguments
Return type
No return value
Example
To draw a red square:
Graphics.FillColour(Colour.RED);
Graphics.MoveTo(0.0, 0.0, 0.0);
Graphics.PolygonStart();
Graphics.MoveTo(10.0, 0.0, 0.0);
Graphics.MoveTo(10.0, 10.0, 0.0);
Graphics.MoveTo(0.0, 10.0, 0.0);
Graphics.PolygonFinish();
Arguments
Name Type
Description
shape constant The style to draw lines with. Can be: Graphics.POINT, Graphics.SQUARE, Graphics.CIRCLE,
Graphics.DIAMOND, Graphics.HOURGLASS, Graphics.FILLED_SQUARE, Graphics.FILLED_
CIRCLE, Graphics.FILLED_DIAMOND or Graphics.FILLED_HOURGLASS
size
integer
Return type
No return value
Example
To draw a filled square at (10, 20, 30) at size 10:
Graphics.MoveTo(10, 20, 30);
Graphics.Shape(Graphics.FILLED_SQUARE, 10);
Start() [static]
Description
Start any graphics. See also Graphics.Finish(). This must be used before any drawing is done.
Arguments
No arguments
Return type
No return value
Example
To start drawing graphics:
Graphics.Start();
116
March 2016
Graphics class
Text(text[String]) [static]
Description
Draws text at current position. See Graphics.MoveTo() to set the current position.
Arguments
Name Type Description
text
Return type
No return value
Example
To write "Example" at (10, 20, 30):
Graphics.MoveTo(10, 20, 30);
Graphics.Text("Example");
TextColour(colour[Colour]) [static]
Description
Sets the colour for drawing text. See the Colour class for more details on colours.
Arguments
Name Type
Description
Return type
No return value
Example
To Set the current text drawing colour to red:
Graphics.TextColour(Colour.RED);
or
Graphics.TextColour( Colour.RGB(255, 0, 0) );
TextSize(size[Integer]) [static]
Description
Sets the size for drawing text.
Arguments
Name Type
size
Description
Return type
No return value
March 2016
117
Graphics class
Example
To Set the current text size to 30:
Graphics.TextSize(30);
118
March 2016
Group class
Group class
The Group class gives you access to groups in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
Browse(modal (optional)[boolean])
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Edit(modal (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetDataAll(type[string], index[integer])
GetDataList(type[string], index[integer])
GetDataRange(type[string], index[integer])
GetParameter(prop[group property])
GetTotalAll(type[string])
GetTotalList(type[string])
GetTotalRange(type[string])
GetTotals(type[string])
GetType(row[integer])
Keyword()
KeywordCards()
Next()
Previous()
RemoveDataAll(type[string], index[integer])
RemoveDataList(type[string], index[integer])
RemoveDataRange(type[string], index[integer])
SetDataAll(type[string], index[integer], data[array])
SetDataList(type[string], index[integer], data[array])
SetDataRange(type[string], index[integer], data[array])
SetFlag(flag[Flag])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
toString()
Group constants
March 2016
119
Group class
Name
Description
Group.ADD
Group properties
Name
Type
Description
exists
logical true if group exists, false if referred to but not defined (read only)
include
label
lock
model
string
Group title
Detailed Description
The Group class allows you to create, modify, edit and manipulate groups. See the documentation below for more
details.
Constructor
new Group(Model[Model], label[integer], title (optional)[string])
Description
Create a new Group object.
Arguments
Name
Type
Model
label
Description
Return type
Group object
Example
To create a new group 99 in model m with title "Example":
var g = new Group(m, 99, "Example");
Details of functions
Blank()
Description
Blanks the group
120
March 2016
Group class
Arguments
No arguments
Return type
No return value
Example
To blank group g:
g.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the groups in model m:
Group.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
March 2016
121
Group class
Example
To blank all of the groups in model m flagged with f:
Group.BlankFlagged(m, f);
Blanked()
Description
Checks if the group is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if group g is blanked:
if (g.Blanked() ) do_something...
Browse(modal (optional)[boolean])
Description
Starts an edit panel in Browse mode.
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Browse group g:
g.Browse();
ClearFlag(flag[Flag])
Description
Clears a flag on the group.
Arguments
Name Type Description
flag
Return type
No return value
122
March 2016
Group class
Example
To clear flag f for group g:
g.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the group.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy group g into group z:
var z = g.Copy();
Arguments
Name
Type
Description
Model
Model
modal
(optional)
boolean 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.
Return type
Group object (or null if not made)
Example
To start creating a group g in model m:
var g = Group.Create(m);
Edit(modal (optional)[boolean])
Description
Starts an interactive editing panel.
March 2016
123
Group class
Arguments
Name
Type
Description
modal
(optional)
boolean 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.
Return type
no return value
Example
To Edit group g:
g.Edit();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for group g:
g.Error("My custom error");
First(Model[Model]) [static]
Description
Returns the first group in the model.
Arguments
Name Type
Description
Return type
Group object (or null if there are no groups in the model).
Example
To get the first group in model m:
var g = Group.First(m);
124
March 2016
Group class
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Group label.
Example
To get the first free group label in model m:
var label = Group.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
Return type
No return value
Example
To flag all of the groups with flag f in model m:
Group.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the group is flagged or not.
Arguments
Name Type Description
flag
March 2016
125
Group class
Return type
true if flagged, false if not.
Example
To check if group g has flag f set on it:
if (g.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
Example
To call function test for all of the groups in model m:
Group.ForEach(m, test);
function test(g)
{
// g is Group object
}
To call function test for all of the groups in model m with optional object:
var data = { x:0, y:0 };
Group.ForEach(m, test, data);
function test(g, extra)
{
// g is Group object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Group objects for all of the groups in a model in Primer
126
March 2016
Group class
Arguments
Name Type
Description
Return type
Array of Group objects
Example
To make an array of Group objects for all of the groups in model m
var g = Group.GetAll(m);
GetDataAll(type[string], index[integer])
Description
Returns all data for a given row number and type in the group.
Arguments
Name Type
Description
type
string
index integer Index of all row you want the data for. Note that indices start at 0, not 1.
0 <= index < Group.GetTotalAll()
Return type
An array containing data [Group.ADD or Group.REMOVE, BOX (if defined)].
Example
To get the data for the 3rd SHELL all row in group g:
var data = g.GetDataAll("SHELL", 2);
GetDataList(type[string], index[integer])
Description
Returns list data for a given row number and type in the group.
Arguments
Name Type
Description
type
string
index integer Index of list row you want the data for. Note that indices start at 0, not 1.
0 <= index < Group.GetTotalList()
Return type
An array containing data [Group.ADD or Group.REMOVE, ITEM1 (if defined), ITEM2 (if defined), ITEM3 (if
defined), ITEM4 (if defined), ITEM5 (if defined), BOX (if defined)].
March 2016
127
Group class
Example
To get the data for the 3rd SHELL list row in group g:
var data = g.GetDataList("SHELL", 2);
GetDataRange(type[string], index[integer])
Description
Returns range data for a given row number and type in the group.
Arguments
Name Type
Description
type
string
index integer Index of range row you want the data for. Note that indices start at 0, not 1.
0 <= index < Group.GetTotalRange()
Return type
An array containing data [Group.ADD or Group.REMOVE, START, END, BOX (if defined)].
Example
To get the data for the 3rd SHELL range row in group g:
var data = g.GetDataRange("SHELL", 2);
Arguments
Name Type
Description
Flag
Return type
Array of Group objects
Example
To make an array of Group objects for all of the groups in model m flagged with f
var g = Group.GetFlagged(m, f);
128
March 2016
Group class
Arguments
Name
Type
Description
Model
number integer number of the group you want the Group object for
Return type
Group object (or null if group does not exist).
Example
To get the Group object for group 100 in model m
var g = Group.GetFromID(m, 100);
GetParameter(prop[group property])
Description
Checks if a Group 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 Group.ViewParameters() method and method chaining
(see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Group property g.example is a parameter:
Options.property_parameter_names = true;
if (g.GetParameter(g.example) ) do_something...
Options.property_parameter_names = false;
To check if Group property g.example is a parameter by using the GetParameter method:
if (g.ViewParameters().GetParameter(g.example) ) do_something...
GetTotalAll(type[string])
Description
Returns the total number of all rows for a type in a group
Arguments
Name Type Description
type
March 2016
129
Group class
Return type
The number of all rows defined
Example
To get the total number of shell all rows in group g:
var nrow = g.GetTotalAll("SHELL");
GetTotalList(type[string])
Description
Returns the total number of list rows for a type in a group
Arguments
Name Type Description
type
Return type
The number of list rows defined
Example
To get the total number of shell list rows in group g:
var nrow = g.GetTotalList("SHELL");
GetTotalRange(type[string])
Description
Returns the total number of range rows for a type in a group
Arguments
Name Type Description
type
Return type
The number of range rows defined
Example
To get the total number of shell range rows in group g:
var nrow = g.GetTotalRange("SHELL");
GetTotals(type[string])
Description
Returns the total number of all, list and range rows for a type in a group
130
March 2016
Group class
Arguments
Name Type Description
type
Return type
Array containing number of all, list and range rows defined or null if type not in group.
Example
To get the total number of shell all, list and range rows in group g:
var
var
var
var
totals
nall
nlist
nrange
=
=
=
=
g.GetTotals("SHELL");
totals[0];
totals[1];
totals[2];
GetType(row[integer])
Description
Returns the type for an entry in a group
Arguments
Name Type
row
Description
integer The entry in the group types that you want the type for. Note that entries start at 0, not 1
Return type
The type of the item (string)
Example
To list the types that are present in group g:
for (var t=0; t<g.numtypes; t++)
{
var type = g.GetType(t);
Message(type);
}
Keyword()
Description
Returns the keyword for this group. Note that a carriage return is not added. See also Group.KeywordCards()
Arguments
No arguments
Return type
string containing the keyword.
Example
To get the keyword for goup g:
var key = g.Keyword();
March 2016
131
Group class
KeywordCards()
Description
Returns the keyword cards for the Group. Note that a carriage return is not added. See also Group.Keyword()
Arguments
No arguments
Return type
string containing the cards.
Example
To get the cards for Group g:
var cards = g.KeywordCards();
Last(Model[Model]) [static]
Description
Returns the last group in the model.
Arguments
Name Type
Description
Return type
Group object (or null if there are no groups in the model).
Example
To get the last group in model m:
var g = Group.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Group label.
132
March 2016
Group class
Example
To get the last free group label in model m:
var label = Group.LastFreeLabel(m);
Next()
Description
Returns the next group in the model.
Arguments
No arguments
Return type
Group object (or null if there are no more groups in the model).
Example
To get the group in model m after group g:
var g = g.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Group label.
Example
To get the next free group label in model m:
var label = Group.NextFreeLabel(m);
March 2016
133
Group class
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the Group can be picked from any model.
modal
(optional)
boolean 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.
Return type
Group object (or null if not picked)
Example
To pick a Group from model m giving the prompt Pick Group from screen:
var g = Group.Pick(Pick Group from screen, m);
Previous()
Description
Returns the previous group in the model.
Arguments
No arguments
Return type
Group object (or null if there are no more groups in the model).
Example
To get the group in model m before group g:
var g = g.Previous();
RemoveDataAll(type[string], index[integer])
Description
Removes all data for a given row number and type in the group.
Arguments
Name Type
Description
type
string
index integer Index of all row you want to Remove. Note that indices start at 0, not 1.
0 <= index < Group.GetTotalAll()
Return type
No return value
Example
To remove the data for the 3rd SHELL all row in group g:
g.RemoveDataAll("SHELL", 2);
134
March 2016
Group class
RemoveDataList(type[string], index[integer])
Description
Removes list data for a given row number and type in the group.
Arguments
Name Type
Description
type
string
index integer Index of list row you want to Remove. Note that indices start at 0, not 1.
0 <= index < Group.GetTotalList()
Return type
No return value
Example
To remove the data for the 3rd SHELL list row in group g:
g.RemoveDataList("SHELL", 2);
RemoveDataRange(type[string], index[integer])
Description
Removes range data for a given row number and type in the group.
Arguments
Name Type
Description
type
string
index integer Index of range row you want to Remove. Note that indices start at 0, not 1.
0 <= index < Group.GetTotalRange()
Return type
No return value
Example
To remove the data for the 3rd SHELL range row in group g:
g.RemoveDataRange("SHELL", 2);
Arguments
Name Type
Description
March 2016
135
Group class
Return type
No return value
Example
To renumber all of the groups in model m, from 1000000:
Group.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged groups will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the groups in model m flagged with f, from 1000000:
Group.RenumberFlagged(m, f, 1000000);
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only groups from that model can be selected. If the argument
Flag
is a Flag then only groups that are flagged with limit can be selected (limit should be different
to flag). If omitted, or null, any groups can be selected. from any model.
modal
(optional)
boolean
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.
Return type
Number of groups selected or null if menu cancelled
136
March 2016
Group class
Example
To select groups from model m, flagging those selected with flag f, giving the prompt Select groups:
Group.Select(f, Select groups, m);
To select groups, flagging those selected with flag f but limiting selection to groups flagged with flag l, giving the
prompt Select groups:
Group.Select(f, Select groups, l);
Arguments
Name Type
Description
type
string
index integer Index of all row you want the data for. Note that indices start at 0, not 1.
0 <= index <= Group.GetTotalAll()
data
array
Return type
No return value
Example
To set the data for the 3rd SHELL all row in group g to add box 10:
var data = [Group.ADD, 10];
g.SetDataAll("SHELL", 2, data);
Arguments
Name Type
Description
type
string
index integer Index of list row you want the data for. Note that indices start at 0, not 1.
0 <= index <= Group.GetTotalList()
data
array
An array containing data [Group.ADD or Group.REMOVE, ITEM1 (if defined), ITEM2 (if defined),
ITEM3 (if defined), ITEM4 (if defined), ITEM5 (if defined), BOX (if defined)].
Return type
No return value
Example
To set the data for the 3rd SHELL list row in group g to add 1 2 box 10:
var data = [Group.ADD, 1, 2, 0, 0, 0, 10];
g.SetDataList("SHELL", 2, data);
March 2016
137
Group class
Arguments
Name Type
Description
type
string
index integer Index of all row you want the data for. Note that indices start at 0, not 1.
0 <= index <= Group.GetTotalRange()
data
array
An array containing data [Group.ADD or Group.REMOVE, START, END, BOX (if defined)].
Return type
No return value
Example
To set the data for the 3rd SHELL range row in group g to add 100 200 box 10:
var data = [Group.ADD, 100, 200, 10];
g.SetDataRange("SHELL", 2, data);
SetFlag(flag[Flag])
Description
Sets a flag on the group.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for group g:
g.SetFlag(f);
Sketch(redraw (optional)[boolean])
Description
Sketches the group. The group will be sketched until you either call Group.Unsketch(), Group.UnsketchAll(),
Model.UnsketchAll(), or delete the model
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the group is sketched. If omitted redraw is true. If you
want to sketch several groups and only redraw after the last one then use false for redraw and
call View.Redraw().
138
Description
March 2016
Group class
Return type
No return value
Example
To sketch group g:
g.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing groups should be counted. If false or omitted referenced but undefined
groups will also be included in the total.
Return type
number of groups
Example
To get the total number of groups in model m:
var total = Group.Total(m);
Unblank()
Description
Unblanks the group
Arguments
No arguments
Return type
No return value
Example
To unblank group g:
g.Unblank();
March 2016
139
Group class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the groups in model m:
Group.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the groups in model m flagged with f:
Group.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all groups will be unset in
flag
Flag
Return type
No return value
140
March 2016
Group class
Example
To unset the flag f on all the groups in model m:
Group.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the group.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the group is unsketched. If omitted redraw is true. If
you want to unsketch several groups and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To unsketch group g:
g.Unsketch();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the groups 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().
Return type
No return value
Example
To unsketch all groups in model m:
Group.UnsketchAll(m);
ViewParameters()
Description
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.
March 2016
141
Group class
Arguments
No arguments
Return type
Group object.
Example
To check if Group property g.example is a parameter by using the Group.GetParameter() method:
if (g.ViewParameters().GetParameter(g.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for group g:
g.Warning("My custom warning");
Xrefs()
Description
Returns the cross references for this group.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for group g:
var xrefs = g.Xrefs();
toString()
Description
Creates a string containing the Group data in keyword format. Note that this contains the keyword header and the
keyword cards. See also Group.Keyword() and Group.KeywordCards().
142
March 2016
Group class
Arguments
No arguments
Return type
string
Example
To get data for Group g in keyword format
var s = g.toString();
March 2016
143
Image class
Image class
The Image class enables writing bitmaps to file. More...
Class functions
Image constants
Name
Description
Image.OPTIMISE
Image.SCREEN
Image.X2
Image.X4
Detailed Description
The Image class enables you to write BMP, GIF, JPEG or PNG images from PRIMER. See the documentation below
for more details.
Details of functions
WriteBMP(filename[string], resolution (optional)[constant], 8bit
(optional)[boolean], options (optional)[constant]) [static]
Description
Create a bmp image of the current screen image
Arguments
Name
Type
Description
filename
string
Filename you want to write. The file will be overwritten if it already exists.
resolution
(optional)
constant The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If
omitted screen resolution will be used
8bit
(optional)
boolean BMP images can be written using either 8 bit (256 colours) or 24 bit (16 million colours). If
this is true then an 8 bit image will be written. If false (or omitted) a 24 bit image will be
written.
options
(optional)
constant For 8 bit images (see 8bit argument) the palette can be optimised (Image.OPTIMISE) and/or
dithered (Image.DITHER) and/or compressed (Image.COMPRESS) If 0 (or omitted) no
palette optimising, dithering or compression will be done.
Return type
No return value
144
March 2016
Image class
Example
To create a 24 bit png file "/data/test/image.png" at 2x screen resolution
Image.WritePNG("/data/test/image.png", Image.X2);
Arguments
Name
Type
Description
filename
string
Filename you want to write. The file will be overwritten if it already exists.
resolution
(optional)
constant The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If
omitted screen resolution will be used
palette
(optional)
Return type
No return value
Example
To create a gif file "/data/test/image.gif" at 2x screen resolution
Image.WriteGIF("/data/test/image.gif", Image.X2);
Arguments
Name
Type
Description
filename
string
Filename you want to write. The file will be overwritten if it already exists.
resolution
(optional)
constant The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If
omitted screen resolution will be used
Return type
No return value
Example
To create a jpeg file "/data/test/image.jpg" at 2x screen resolution
Image.WriteJPEG("/data/test/image.jpg", Image.X2);
March 2016
145
Image class
Arguments
Name
Type
Description
filename
string
Filename you want to write. The file will be overwritten if it already exists.
resolution
(optional)
constant The resolution to write the image at. Can be Image.SCREEN, Image.X2 or Image.X4. If
omitted screen resolution will be used
8bit (optional) boolean PNG images can be written using either 8 bit (256 colours) or 24 bit (16 million colours). If
this is true then an 8 bit image will be written. If false (or omitted) a 24 bit image will be
written.
palette
(optional)
constant For 8 bit images (see 8bit argument) the palette can be optimised (Image.OPTIMISE)
and/or dithered (Image.DITHER). If 0 (or omitted) no palette optimising or dithering will be
done.
Return type
No return value
Example
To create a 24 bit png file "/data/test/image.png" at 2x screen resolution
Image.WritePNG("/data/test/image.png", Image.X2);
146
March 2016
Mechanism class
Mechanism class
The Mechanism class gives you access to mechanism cards in PRIMER. More...
Class functions
Member functions
Blank()
Blanked()
ClearFlag(flag[Flag])
Copy(range (optional)[boolean])
Error(message[string], details (optional)[string])
Flagged(flag[Flag])
GetAssembly(index[integer])
GetConnection(index[integer])
GetParameter(prop[mechanism property])
GetPoint(index[integer])
GetPointData(rpt[integer])
GetPointTitle(rpt[integer])
Next()
Previous()
RemoveConnection(index[integer])
RemovePoint(index[integer])
SetConnection(index[integer], data[Object])
SetFlag(flag[Flag])
SetPoint(index[integer], data[Object])
Sketch(redraw (optional)[boolean])
Unblank()
Unsketch(redraw (optional)[boolean])
ViewParameters()
Warning(message[string], details (optional)[string])
Xrefs()
Mechanism constants
Name
Description
Mechanism.PIN
Mechanism properties
March 2016
147
Mechanism class
Name
Type
Description
assemblies
logical true if mechanism exists, false if referred to but not defined. (read only)
id
integer Mechanism number. Also see the label property which is an alternative name for this. (read
only)
include
label
integer Mechanism number. Also see the id property which is an alternative name for this. (read only)
model
points
title
string
Mechanism title.
Detailed Description
The Mechanism class allows you to create, modify, edit and manipulate mechanism cards. See the documentation below
for more details.
Details of functions
Blank()
Description
Blanks the mechanism
Arguments
No arguments
Return type
No return value
Example
To blank mechanism m:
m.Blank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
148
March 2016
Mechanism class
Example
To blank all of the mechanisms in model m:
Mechanism.BlankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank all of the mechanisms in model m flagged with f:
Mechanism.BlankFlagged(m, f);
Blanked()
Description
Checks if the mechanism is blanked or not.
Arguments
No arguments
Return type
true if blanked, false if not.
Example
To check if mechanism m is blanked:
if (m.Blanked() ) do_something...
ClearFlag(flag[Flag])
Description
Clears a flag on the mechanism.
March 2016
149
Mechanism class
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for mechanism m:
m.ClearFlag(f);
Copy(range (optional)[boolean])
Description
Copies the mechanism.
Arguments
Name
Type
Description
range
(optional)
boolean 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() .
Return type
Return class object
Example
To copy mechanism m into mechanism z:
var z = m.Copy();
Arguments
Name
Type Description
message
Return type
No return value
Example
To add an error message "My custom error" for mechanism m:
m.Error("My custom error");
150
March 2016
Mechanism class
First(Model[Model]) [static]
Description
Returns the first mechanism in the model.
Arguments
Name Type
Description
Return type
Mechanism object (or null if there are no mechanisms in the model).
Example
To get the first mechanism in model m:
var m = Mechanism.First(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Mechanism label.
Example
To get the first free mechanism label in model m:
var label = Mechanism.FirstFreeLabel(m);
Arguments
Name Type
Description
Flag
March 2016
151
Mechanism class
Return type
No return value
Example
To flag all of the mechanisms with flag f in model m:
Mechanism.FlagAll(m, f);
Flagged(flag[Flag])
Description
Checks if the mechanism is flagged or not.
Arguments
Name Type Description
flag
Return type
true if flagged, false if not.
Example
To check if mechanism m has flag f set on it:
if (m.Flagged(f) ) do_something...
Arguments
Name
Type
Description
Model
Model
func
extra
(optional)
any
An optional extra object/array/string etc that will appended to arguments when calling the
function
Return type
No return value
152
March 2016
Mechanism class
Example
To call function test for all of the mechanisms in model m:
Mechanism.ForEach(m, test);
function test(m)
{
// m is Mechanism object
}
To call function test for all of the mechanisms in model m with optional object:
var data = { x:0, y:0 };
Mechanism.ForEach(m, test, data);
function test(m, extra)
{
// m is Mechanism object
// extra is data
}
GetAll(Model[Model]) [static]
Description
Returns an array of Mechanism objects for all of the mechanisms in a model in Primer
Arguments
Name Type
Description
Return type
Array of Mechanism objects
Example
To make an array of Mechanism objects for all of the mechanisms in model m
var m = Mechanism.GetAll(m);
GetAssembly(index[integer])
Description
Returns the information for an assembly
Arguments
Name Type
Description
index integer The index of the assembly you want the coordinates for. Note that reference points start at 0, not 1.
0 <= index < assemblies
Return type
Object containing the assembly information (properties label, title, parent)
Example
To get the information for the 3rd assembly for mechanism m:
var info = m.GetAssembly(2);
March 2016
153
Mechanism class
GetConnection(index[integer])
Description
Returns the information for a connection
Arguments
Name Type
Description
index integer The index of the connection you want the information for. Note that connections start at 0, not 1. 0
<= index < connections
Return type
Object containing the connection information. Properties are:
type
label
title
type
assembly1
assembly2
assembly3 (lines only)
factor1 (lines only)
factor2 (lines only)
node1
x1
y1
z1
node2 (lines and hinges only)
x2 (lines and hinges only)
y2 (lines and hinges only)
z2 (lines and hinges only)
pslide (lines only)
nslide (lines only)
distance (lines only)
protation (lines and hinges only)
nrotation (lines and hinges only)
angle (lines and hinges only)
locked
Example
To get the information for the 3rd connection for mechanism m:
var info = m.GetConnection(2);
Arguments
Name Type
Description
Flag
Return type
Array of Mechanism objects
154
March 2016
Mechanism class
Example
To make an array of Mechanism objects for all of the mechanisms in model m flagged with f
var m = Mechanism.GetFlagged(m, f);
Arguments
Name
Type
Description
Model
number integer number of the mechanism you want the Mechanism object for
Return type
Mechanism object (or null if mechanism does not exist).
Example
To get the Mechanism object for mechanism 100 in model m
var m = Mechanism.GetFromID(m, 100);
GetParameter(prop[mechanism property])
Description
Checks if a Mechanism 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 Mechanism.ViewParameters() method and method
chaining (see the examples below).
Arguments
Name Type
prop
Description
Return type
Parameter object if property is a parameter, null if not.
Example
To check if Mechanism property m.example is a parameter:
Options.property_parameter_names = true;
if (m.GetParameter(m.example) ) do_something...
Options.property_parameter_names = false;
To check if Mechanism property m.example is a parameter by using the GetParameter method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
March 2016
155
Mechanism class
GetPoint(index[integer])
Description
Returns the information for a reference point
Arguments
Name Type
Description
index integer The index of the reference point you want the information for. Note that reference points start at 0,
not 1. 0 <= index < points
Return type
Object containing the reference point information (properties label, title, x, y, z, node, assembly, csys, tx, ty, tz, rx, ry,
rz)
Example
To get the information for the 3rd reference point for mechanism m:
var info = m.GetPoint(2);
GetPointData(rpt[integer])
Description
Returns the coordinates of a reference point
Arguments
Name Type
rpt
Description
integer The reference point you want the coordinates for. Note that reference points start at 0, not 1.
Return type
Array containing the reference point coordinates
Example
To get the coordinates of the 3rd reference point for mechanism mec:
var c = mec.GetPointData(2)
GetPointTitle(rpt[integer])
Description
Returns the title of a reference point
Arguments
Name Type
rpt
Description
integer The reference point you want the title for. Note that reference points start at 0, not 1.
Return type
The reference point title
156
March 2016
Mechanism class
Example
To get the title of the 3rd reference point for mechanism mec:
var c = mec.GetPointTitle(2)
Last(Model[Model]) [static]
Description
Returns the last mechanism in the model.
Arguments
Name Type
Description
Return type
Mechanism object (or null if there are no mechanisms in the model).
Example
To get the last mechanism in model m:
var m = Mechanism.Last(m);
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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.
Return type
Mechanism label.
Example
To get the last free mechanism label in model m:
var label = Mechanism.LastFreeLabel(m);
Next()
Description
Returns the next mechanism in the model.
Arguments
No arguments
March 2016
157
Mechanism class
Return type
Mechanism object (or null if there are no more mechanisms in the model).
Example
To get the mechanism in model m after mechanism m:
var m = m.Next();
Arguments
Name
Type
Description
Model
Model
layer
(optional)
Include
number
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).
Return type
Mechanism label.
Example
To get the next free mechanism label in model m:
var label = Mechanism.NextFreeLabel(m);
Arguments
Name
Type
Description
prompt
string
Model
(optional)
Model
Model to limit picking to. If omitted, or null, the mechanism can be picked from any model.
modal
(optional)
boolean 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.
button text
(optional)
string
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.
Return type
Mechanism object (or null if not picked)
158
March 2016
Mechanism class
Example
To pick a mechanism from model m giving the prompt Pick mechanism from screen:
var mec = Mechanism.Pick(Pick mechanism from screen, m);
Previous()
Description
Returns the previous mechanism in the model.
Arguments
No arguments
Return type
Mechanism object (or null if there are no more mechanisms in the model).
Example
To get the mechanism in model m before mechanism m:
var m = m.Previous();
RemoveConnection(index[integer])
Description
Removes a connection from a mechanism
Arguments
Name Type
Description
index integer The index of the connection you want to remove. Note that connections start at 0, not 1. 0 <= index
< connections
Return type
no return value
Example
To remove the 3rd connection for mechanism m:
m.RemoveConnection(2);
RemovePoint(index[integer])
Description
Removes a reference point from a mechanism
Arguments
Name Type
Description
index integer The index of the reference point you want to remove. Note that reference points start at 0, not 1. 0
<= index < points
Return type
no return value
March 2016
159
Mechanism class
Example
To remove the 3rd reference point for mechanism m:
m.RemovePoint(2);
Arguments
Name Type
Description
Return type
No return value
Example
To renumber all of the mechanisms in model m, from 1000000:
Mechanism.RenumberAll(m, 1000000);
Arguments
Name Type
Description
Model Model Model that all the flagged mechanisms will be renumbered in
flag
Flag
start
Return type
No return value
Example
To renumber all of the mechanisms in model m flagged with f, from 1000000:
Mechanism.RenumberFlagged(m, f, 1000000);
160
March 2016
Mechanism class
Arguments
Name
Type
Description
flag
Flag
prompt
string
limit
(optional)
Model or If the argument is a Model then only mechanisms from that model can be selected. If the
Flag
argument is a Flag then only mechanisms that are flagged with limit can be selected (limit
should be different to flag). If omitted, or null, any mechanisms can be selected. from any
model.
modal
(optional)
boolean
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.
Return type
Number of mechanisms selected or null if menu cancelled
Example
To select mechanisms from model m, flagging those selected with flag f, giving the prompt Select mechanisms:
Mechanism.Select(f, Select mechanisms, m);
To select mechanisms, flagging those selected with flag f but limiting selection to mechanisms flagged with flag l,
giving the prompt Select mechanisms:
Mechanism.Select(f, Select mechanisms, l);
SetConnection(index[integer], data[Object])
Description
Sets the data for a connection in a mechanism
Arguments
Name Type
Description
index integer The index of the connection you want to set. Note that connections start at 0, not 1. To add a new
connection use index connections
data
Object Object containing the connection data. The properties can be:
type (required)
title [string]
type [Mechanism.PIN, Mechanism.LINE or Mechanism.HINGE]
assembly1 [integer] (required)
assembly2 [integer] (required)
assembly3 [integer] (optional for lines only)
factor1 [float] (optional for lines only)
factor2 [float] (optional for lines only)
node1 [integer] (not required if using x1, y1 and z1)
x1 [float] (not required if using node1)
y1 [float] (not required if using node1)
z1 [float] (not required if using node1)
node2 [integer] (lines and hinges only. Not required if using x2, y2 and z2)
x2 [float] (lines and hinges only. Not required if using node2)
y2 [float] (lines and hinges only. Not required if using node2)
z2 [float] (lines and hinges only. Not required if using node2)
pslide [float] (optional for lines only)
nslide [float] (optional for lines only)
distance [float] (optional for lines only)
protation [float] (optional for lines and hinges only)
nrotation [float] (optional for lines and hinges only)
angle [float] (optional for lines and hinges only)
locked [boolean] (optional)
March 2016
161
Mechanism class
Return type
no return value
Example
To add a new pin connection to mechanism m between assemblies 5 and 6 at node 1000 with title "Example
connection":
var data = { type:Mechanism.PIN, assembly1:5, assembly2:6, node1:1000,
title:"Example connection" };
m.SetConnection(m.connections, data);
SetFlag(flag[Flag])
Description
Sets a flag on the mechanism.
Arguments
Name Type Description
flag
Return type
No return value
Example
To set flag f for mechanism m:
m.SetFlag(f);
SetPoint(index[integer], data[Object])
Description
Sets the data for a reference point in a mechanism
Arguments
Name Type
Description
index integer The index of the reference point you want to set. Note that reference points start at 0, not 1. To add
a new point use index points
data
Object Object containing the reference point data. The properties can be:
assembly (required)
x [float] (not required if using node)
y [float] (not required if using node)
z [float] (not required if using node)
node [integer] (not required if using x, y and z)
title [string] (optional)
csys [integer] (optional)
tx [boolean] (optional)
ty [boolean] (optional)
tz [boolean] (optional)
rx [boolean] (optional)
ry [boolean] (optional)
rz [boolean] (optional)
Return type
no return value
162
March 2016
Mechanism class
Example
To add a new reference point to mechanism m assembly 5 at node 1000 with title "Example point" restrained in x:
var data = { assembly:5, node:1000, title:"Example point", tx:true };
m.SetPoint(m.points, data);
To add a new reference point to mechanism m assembly 5 at (10, 20, 30) with title "Example point":
var data = { assembly:5, x:10, y:20, z:30, title:"Example point" };
m.SetPoint(m.points, data);
Sketch(redraw (optional)[boolean])
Description
Sketches the mechanism. The mechanism will be sketched until you either call Mechanism.Unsketch(),
Mechanism.UnsketchAll(), Model.UnsketchAll(), or delete the model
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the mechanism is sketched. If omitted redraw is true. If
you want to sketch several mechanisms and only redraw after the last one then use false for
redraw and call View.Redraw().
Return type
No return value
Example
To sketch mechanism m:
m.Sketch();
Arguments
Name
Type
Description
Model
Model
exists
(optional)
boolean true if only existing mechanisms should be counted. If false or omitted referenced but
undefined mechanisms will also be included in the total.
Return type
number of mechanisms
Example
To get the total number of mechanisms in model m:
var total = Mechanism.Total(m);
March 2016
163
Mechanism class
Unblank()
Description
Unblanks the mechanism
Arguments
No arguments
Return type
No return value
Example
To unblank mechanism m:
m.Unblank();
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank all of the mechanisms in model m:
Mechanism.UnblankAll(m);
Arguments
Name
Type
Description
Model
Model
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
164
March 2016
Mechanism class
Example
To unblank all of the mechanisms in model m flagged with f:
Mechanism.UnblankFlagged(m, f);
Arguments
Name Type
Description
Model Model Model that the defined flag for all mechanisms will be unset in
flag
Flag
Return type
No return value
Example
To unset the flag f on all the mechanisms in model m:
Mechanism.UnflagAll(m, f);
Unsketch(redraw (optional)[boolean])
Description
Unsketches the mechanism.
Arguments
Name
Type
Description
redraw
(optional)
boolean If model should be redrawn or not after the mechanism is unsketched. If omitted redraw is
true. If you want to unsketch several mechanisms and only redraw after the last one then use
false for redraw and call View.Redraw().
Return type
No return value
Example
To unsketch mechanism m:
m.Unsketch();
March 2016
165
Mechanism class
Arguments
Name
Type
Description
Model
Model
redraw
(optional)
boolean If model should be redrawn or not after the mechanisms 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().
Return type
No return value
Example
To unsketch all mechanisms in model m:
Mechanism.UnsketchAll(m);
ViewParameters()
Description
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.
Arguments
No arguments
Return type
Mechanism object.
Example
To check if Mechanism property m.example is a parameter by using the Mechanism.GetParameter() method:
if (m.ViewParameters().GetParameter(m.example) ) do_something...
Arguments
Name
Type Description
message
Return type
No return value
Example
To add a warning message "My custom warning" for mechanism m:
m.Warning("My custom warning");
166
March 2016
Mechanism class
Xrefs()
Description
Returns the cross references for this mechanism.
Arguments
No arguments
Return type
Xrefs object.
Example
To get the cross references for mechanism m:
var xrefs = m.Xrefs();
March 2016
167
Model class
Model class
The Model class gives you access to models in PRIMER. More...
Class functions
BlankAll()
DeleteAll()
First()
FirstFreeItemLabel(type[string], layer (optional)[Include number])
GetAll()
GetFromID(model number[integer])
Last()
LastFreeItemLabel(type[string], layer (optional)[Include number])
Merge(Master Model[Model], Slave Model[Model], Option to fix clashes (optional)[constant], Merge nodes
flag (optional)[boolean], dist (required if merge nodes flag used)[float], label (optional)[integer], position
(optional)[integer])
NextFreeItemLabel(type[string], layer (optional)[Include number])
Read(filename[string], filetype (optional)[constant], number (optional)[integer])
Select(prompt[string], modal (optional)[boolean])
Total()
UnblankAll()
Member functions
AreaVolumeFlagged(flag[Flag])
Attached(flag[Flag], redraw (optional)[boolean])
Blank()
BlankFlagged(flag[Flag], redraw (optional)[boolean])
CentreOfGravity()
Check(filename[string], detailed (optional)[boolean], json (optional)[boolean], include (optional)[boolean])
ClearFlag(flag[Flag])
Copy(update (optional)[boolean])
Delete()
DeleteFlagged(flag[Flag], recursive (optional)[boolean])
DeleteInclude(Include label[integer], method (optional)[constant], force (optional)[boolean])
FlagDuplicate(flag[Flag])
GetIncludeTransformOffsets()
Hide()
Import(filename[string])
ImportInclude(filename[string])
ImportIncludeTransform(filename[string], idnoff[integer], ideoff[integer], idpoff[integer], idmoff[integer],
idsoff[integer], idfoff[integer], iddoff[integer], idroff[integer])
Mass()
MassPropCalc(flag[Flag])
MergeNodes(flag[Flag], dist[float], label (optional)[integer], position (optional)[integer])
PopulateInitialVelocities()
PropagateFlag(flag[Flag])
RenumberAll(start[integer])
RenumberFlagged(flag[Flag], start[integer])
SetColour(colour[colour from Colour class.])
SetFlag(flag[Flag])
Show()
Unblank()
UnblankFlagged(flag[Flag], redraw (optional)[boolean])
UnsketchAll(redraw (optional)[boolean])
UpdateGraphics()
UsesLargeLabels()
Write(filename[string], method (optional)[constant], path (optional)[constant], separator (optional)[constant],
version (optional)[string], large (optional)[boolean])
Model constants
Constants for mass_properties_calculation
Name
168
Description
March 2016
Model class
Model.CENTRE_AT_COFG
Model.GLOBAL_AXES
GLOBAL AXES
Model.LOCAL_AXES
LOCAL AXES
Model.PRINCIPAL_AXES
PRINCIPAL AXES
Description
Model.ABAQUS
Model.IGES
Model.LSDYNA
Description
Model.REMOVE_FROM_
SETS
Only deletes items within the include selected but may remove items from sets in other
includes.
Model.REMOVE_
INCLUDE_ONLY
Only deletes items within the include selected without removing items from sets in
other includes.
Model.REMOVE_JUNIOR
Delete items in other includes if they belong to items in this include file but are
considered to be junior in the standard PRIMER hierarchy.
Description
Model.DISCARD_MASTER_CLASH
Model.DISCARD_SLAVE_CLASH
Model.INCREASE_SLAVE_ALWAYS
Model.INCREASE_SLAVE_CLASH
Model properties
Name
Type
Description
control (read
only)
Control object Control cards for model. See Control for more details.
database (read
only)
Database
object
filename (read
only)
string
Name of file that model was read from (blank if model created)
id
logical
March 2016
169
Model class
layer
integer
The current layer for the model. This is the label of the Include file or 0 for the main
file. See also Include.MakeCurrentLayer()
num
string
number
integer
Model number
project
string
readlog
string
stage
string
title
string
Model title
visible
logical
Detailed Description
The Model class allows you to do various operations on models in PRIMER. There are various methods available that
allow you do create, read, blank models etc. See the documentation below for more details.
Constructor
new Model(number (optional)[integer])
Description
Create a new model in PRIMER
Arguments
Name
Type
Description
number (optional) integer Model number to create. If omitted the next free model number will be used.
Return type
Model object
Example
To create a new model
var m = new Model();
To create model 10
var m = new Model(10);
Details of functions
AreaVolumeFlagged(flag[Flag])
Description
Calculates the Area/Volume of the selected items.
Note: The area calculation is based only on shell elements, and the volume calculation is based only on solid elements.
170
March 2016
Model class
Arguments
Name Type Description
flag
Return type
Returns an object with area and volume information.
Example
To calculate the area/volume properties of the items flagged by flag f.
var props = m.AreaVolumeFlagged(f);
var area = props.area;
var volume = props.volume;
Arguments
Name
Type
Description
flag
Flag
redraw
(optional)
boolean If true, the display will be updated to display only the original flagged items and the
attached items.
Return type
No return value
Example
To find items attached to items flagged with flag f in model m:
m.Attached(f);
Blank()
Description
Blanks a model in PRIMER
Arguments
No arguments
Return type
No return value
Example
To blank model object m
m.Blank();
March 2016
171
Model class
BlankAll() [static]
Description
Blanks all models
Arguments
No arguments
Return type
No return value
Example
To blank all models
Model.BlankAll();
Arguments
Name
Type
Description
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To blank everything in model m flagged with flag f:
m.BlankFlagged(f);
CentreOfGravity()
Description
Returns the centre of gravity for a model
Arguments
No arguments
Return type
An array containing the x, y and z coordinates for the CofG.
172
March 2016
Model class
Example
To get the centre of gravity for model m:
var
var
var
var
cofg = m.CentreOfGravity();
x = cofg[0];
y = cofg[1];
z = cofg[2];
Arguments
Name
Type
Description
filename
string
detailed
(optional)
boolean If set, detailed error messages are given. If omitted detailed will be set to false
json
(optional)
boolean If set, output in filename will be written in JSON format. If omitted json will be set to false.
If JSON format is written then detailed will automatically be set.
include
(optional)
boolean If set, error messages will be written in include by include layout. This option is not
applicable if JSON is set.
Return type
No return value
Example
To check model m, writing detailed errors to file errors.txt in include layout:
m.Check(errors.txt, true, false, true);
To check a model writing the warnings/errors as JSON to file errors.json, parse it and write them to the dialogue box:
m.Check(errors.json, true, true);
var f = new File(errors.json, File.READ);
var json = f.ReadAll();
f.Close();
var o = JSON.parse(json);
for (var e in o)
// "error" or "warning"
{
Message(e);
for (var t in o[e])
// type
{
Message(" "+t);
for (var m in o[e][t])
// message
{
Message("
"+m);
for (var i=0; i<o[e][t][m].length; i++) // Array of objects
containing label and include
{
Message("
"+o[e][t][m][i].label+" (include
"+o[e][t][m][i].include+")");
}
}
}
}
March 2016
173
Model class
ClearFlag(flag[Flag])
Description
Clears the flagging for a model in PRIMER. See also Model.PropagateFlag(), Model.SetFlag(), global.AllocateFlag()
and global.ReturnFlag().
Arguments
Name Type Description
flag
Return type
No return value
Example
To clear flag f for everything in model m:
m.ClearFlag(f);
Copy(update (optional)[boolean])
Description
Copy model to the next free model in PRIMER
Arguments
Name
Type
Description
update
(optional)
boolean If the graphics should be updated after the model is copied. If omitted update will be set to
false
Return type
Model object for new model.
Example
To copy model m to the next free model in PRIMER.
var mnew = m.Copy();
Delete()
Description
Deletes a model in PRIMER
Do not use the Model object after calling this method.
Arguments
No arguments
Return type
No return value
174
March 2016
Model class
Example
To delete model m in PRIMER
m.Delete();
DeleteAll() [static]
Description
Deletes all existing models from PRIMER
Arguments
No arguments
Return type
No return value
Example
To delete all models
Model.DeleteAll();
Arguments
Name
Type
Description
flag
Flag
recursive
(optional)
boolean If deletion is recursive (for example, if a shell is deleted with recursion on the shell nodes
will be deleted if possible). If omitted recursive will be set to true.
Return type
No return value
Example
To delete everything in model m flagged with flag f:
m.DeleteFlagged(f);
March 2016
175
Model class
Arguments
Name
Type
Description
Include
label
integer
method
(optional)
force
(optional)
boolean Forcible deletion option (for example, a node is deleted even when it is referenced by a shell
which is not deleted). This will remove the include file (not just the contents) from the model.
If this argument is omitted, force will be set to false.
Return type
true if include successfully deleted, false otherwise
Example
To delete include file number 5 in model m removing items from sets in other includes if required:
m.DeleteInclude(5, 1);
First() [static]
Description
Returns the Model object for the first model in PRIMER (or null if there are no models)
Arguments
No arguments
Return type
Model object
Example
To get the Model object for the first model:
var m = Model.First();
Arguments
Name
Type
Description
type
string
The type of the item (for a list of types see Appendix I of the PRIMER manual).
layer
(optional)
Include
number
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).
176
March 2016
Model class
Return type
integer
Example
To get the first free node label in model m:
var label = m.FirstFreeItemLabel("NODE");
FlagDuplicate(flag[Flag])
Description
Flag all nodes referenced in two different includes
Arguments
Name Type Description
flag
Return type
No return value
Example
To Flag with flag f all the nodes referenced in different includes from model m
m.FlagDuplicate(f);
GetAll() [static]
Description
Returns an array of Model objects for all the models in PRIMER
Arguments
No arguments
Return type
Array
Example
To make an array of Model objects for all of the models in PRIMER
var m = Model.GetAll();
Arguments
Name
Type
Description
model number integer number of the model you want the Model object for
March 2016
177
Model class
Return type
Model object
Example
To get the Model object for model number 1
var m = Model.GetFromID(1);
GetIncludeTransformOffsets()
Description
Looks at all of the items in the model and determines values for IDNOFF, IDEOFF, IDPOFF etc that could be used
with Model.ImportIncludeTransform to guarantee that there would not be any clashes with existing items in the model.
Arguments
No arguments
Return type
object containing properties idnoff, ideoff, idpoff, idmoff, idsoff, idfoff, iddoff and idroff. null if error
Example
To determine offsets for model m and then import an include transform "test.inc":
var o = m.GetIncludeTransformOffsets();
if (o)
{
var success = m.ImportIncludeTransform("test.inc", o.idnoff, o.ideoff,
o.idpoff, o.idmoff, o.idsoff, o.idfoff, o.iddoff, o.idroff);
}
Hide()
Description
Hides a model in PRIMER
Arguments
No arguments
Return type
No return value
Example
To hide model m in PRIMER
m.Hide();
Import(filename[string])
Description
Imports a file into model m. The model can already contain items. However, note that if the file cannot be imported
because of a label clash or other problem PRIMER may delete the model and the script will terminate.
178
March 2016
Model class
Arguments
Name
Type Description
filename string Filename of the LS-Dyna keyword file you want to import
Return type
0: No errors/warnings.
> 0: This number of errors occurred.
< 0: Absolute number is the number of warnings that occurred.
Example
To import file "test.key" into model m
m.Import("test.key");
ImportInclude(filename[string])
Description
Imports a file as an include file for model m. The labels of any items in the include file that clash with existing labels
will automatically be renumbered.
Arguments
Name
Type Description
filename string Filename of the LS-Dyna include file you want to import
Return type
Include object for include file
Example
To import include file "include.key" into model m
m.ImportInclude("include.key");
March 2016
179
Model class
Arguments
Name
Type
filename string
Description
Filename of the LS-Dyna include file you want to import
idnoff
ideoff
idpoff
idmoff
idsoff
idfoff
iddoff
idroff
Return type
Include object if successful, null if not
Example
To import include transform file "include.key" into model m using 1000 for all offsets
m.ImportIncludeTransform("include.key", 1000, 1000, 1000, 1000, 1000, 1000,
1000, 1000);
Last() [static]
Description
Returns the Model object for the last model in PRIMER (or null if there are no models)
Arguments
No arguments
Return type
Model object
Example
To get the Model object for the last model:
var m = Model.Last();
180
March 2016
Model class
Arguments
Name
Type
Description
type
string
The type of the item (for a list of types see Appendix I of the PRIMER manual).
layer
(optional)
Include
number
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.
Return type
integer
Example
To get the last free node label in model m:
var label = m.LastFreeItemLabel("NODE");
Mass()
Description
Returns the mass for a model
Arguments
No arguments
Return type
float
Example
To get the mass for model m:
var mass = m.Mass();
MassPropCalc(flag[Flag])
Description
Calculates the Mass, CoG, and Intertia Tensor of the flagged items and returns an object with the above properties.
Arguments
Name Type Description
flag
Return type
Returns an object with mass properties information, or null if non found.
March 2016
181
Model class
Example
To calculate the mass properties of the items flagged by flag f
var props = m.MassPropCalc(f);
var mass = props.mass;
var cofgx = props.cofgx;
var cofgy = props.cofgy;
var cofgz = props.cofgz;
var inerxx = props.inerxx;
var inerxy = props.inerxy;
var inerxz = props.inerxz;
var ineryy = props.ineryy;
var ineryz = props.ineryz;
var inerzz = props.inerzz;
Arguments
Name
Type
Description
Master Model
Model
Slave Model
Model
Option to fix
constant Type of fix. Can be Model.INCREASE_SLAVE_ALWAYS, Model.INCREASE_
clashes (optional)
SLAVE_CLASH, Model.DISCARD_SLAVE_CLASH, Model.INCREASE_MASTER_
ALWAYS, Model.INCREASE_MASTER_CLASH or Model.DISCARD_MASTER_
CLASH
Merge nodes flag boolean If this flag is set to true, Primer will merge nodes after the model merge.
(optional)
dist (required if
float
merge nodes flag
used)
label (optional)
integer
Label to keep after merge. If > 0 then highest label kept. If <= 0 then lowest kept. If
omitted the lowest label will be kept.
position
(optional)
integer
Position to merge at. If > 0 then merged at highest label position. If < 0 then merged at
lowest label position. If 0 then merged at midpoint. If omitted the merge will be done at
the lowest label.
Return type
Model object (or null if the merge is unsuccessful)
Example
To merge models m1 and m2 together:
var m = Model.Merge(m1, m2);
182
March 2016
Model class
Arguments
Name
Type
Description
flag
Flag
dist
float
label
(optional)
integer Label to keep after merge. If > 0 then highest label kept. If <= 0 then lowest kept. If omitted
the lowest label will be kept.
position
(optional)
integer Position to merge at. If > 0 then merged at highest label position. If < 0 then merged at lowest
label position. If 0 then merged at midpoint. If omitted the merge will be done at the lowest
label.
Return type
The number of nodes merged
Example
To (try to) merge nodes on everything in model m flagged with flag f, with a distance of 0.1:
m.MergeNodes(f, 0.1);
Arguments
Name
Type
Description
type
string
The type of the item (for a list of types see Appendix I of the PRIMER manual).
layer
(optional)
Include
number
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).
Return type
integer
Example
To get the next free node label in model m:
var label = m.NextFreeItemLabel("NODE");
PopulateInitialVelocities()
Description
Populate the initial velocity field (nvels) for all nodes of the model
March 2016
183
Model class
Arguments
No arguments
Return type
No return value
Example
m.PopulateInitialVelocities();
PropagateFlag(flag[Flag])
Description
Propagates the flagging for a model in PRIMER. For example if a part in the model is flagged, this will flag the
elements in the part, the nodes on those elements... See also Model.ClearFlag(), Model.SetFlag(), global.AllocateFlag()
and global.ReturnFlag().
Arguments
Name Type Description
flag
Return type
No return value
Example
To propagate the flagging in model m for flag f
m.PropagateFlag(f);
Arguments
Name
Type
Description
filename
string
filetype
(optional)
number
(optional)
integer
Model number to read file into. If omitted the next free model number will be used.
Return type
Model object (or null if error)
184
March 2016
Model class
Example
To read the keyword file /data/test/file.key
Model.Read("/data/test/file.key");
To read the NASTRAN file /data/test/file.dat
Model.Read("/data/test/file.dat", Model.NASTRAN);
To read the keyword file /data/test/file.key into model 10
Model.Read("/data/test/file.key", Model.LSDYNA, 10);
RenumberAll(start[integer])
Description
Renumbers all of the items in the model.
Arguments
Name Type
start
Description
Return type
No return value
Example
To renumber everything in model m, starting at 1000000:
m.RenumberAll(1000000);
RenumberFlagged(flag[Flag], start[integer])
Description
Renumbers all of the flagged items in the model.
Arguments
Name Type
Description
flag
Flag
start
Return type
No return value
Example
To renumber everything in model m flagged with flag f, starting at 1000000:
m.RenumberFlagged(f, 1000000);
March 2016
185
Model class
Arguments
Name
Type
Description
prompt
string
modal
(optional)
boolean 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.
Return type
Model object (or null if no models present).
Example
To select a model giving the prompt Select model:
var m = Model.Select(Select model);
Arguments
Name Type
Description
colour colour from Colour class. The colour you want to set the model to
Return type
No return value
Example
To set the colour of model m to red:
m.SetColour(Colour.RED);
or
m.SetColour(Colour.RGB(255, 0, 0));
SetFlag(flag[Flag])
Description
Sets the flagging for a model in PRIMER. See also Model.PropagateFlag(), Model.ClearFlag(), global.AllocateFlag()
and global.ReturnFlag().
Arguments
Name Type Description
flag
186
March 2016
Model class
Return type
No return value
Example
To set flag f for everything in model m:
m.SetFlag(f);
Show()
Description
Shows a model in PRIMER
Arguments
No arguments
Return type
No return value
Example
To show model m in PRIMER
m.Show();
Total() [static]
Description
Returns the total number of models.
Arguments
No arguments
Return type
integer
Example
To find how many models there are in PRIMER:
var num = Model.Total();
Unblank()
Description
Unblanks a model in PRIMER
Arguments
No arguments
Return type
No return value
March 2016
187
Model class
Example
To unblank model m
m.Unblank();
UnblankAll() [static]
Description
Unblanks all models
Arguments
No arguments
Return type
No return value
Example
To unblank all models
Model.UnblankAll();
Arguments
Name
Type
Description
flag
Flag
redraw
(optional)
boolean 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().
Return type
No return value
Example
To unblank everything in model m flagged with flag f:
m.UnblankFlagged(f);
UnsketchAll(redraw (optional)[boolean])
Description
Unsketches all of the sketched items in the model.
Arguments
Name
Type
redraw
(optional)
boolean If model should be redrawn or not after the items 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().
188
Description
March 2016
Model class
Return type
No return value
Example
To unsketch all the sketched objects in model m:
m.UnsketchAll();
UpdateGraphics()
Description
Updates the graphics for a model in PRIMER
Arguments
No arguments
Return type
No return value
Example
To update the graphics for model m
m.UpdateGraphics();
UsesLargeLabels()
Description
Checks to see if a model uses large labels
Arguments
No arguments
Return type
true if model uses large labels, false otherwise
Example
To check if model m uses large labels:
var large = m.UsesLargeLabels();
March 2016
189
Model class
Arguments
Name
Type
Description
filename
string
method
(optional)
constant The method used to write include files. Can be Include.MASTER_ONLY, Include.MERGE,
Include.NOT_WRITTEN, Include.SUBDIR (default) or Include.SAME_DIR
path
(optional)
constant The method used to write include paths. Can be Include.ABSOLUTE (default) or
Include.RELATIVE
separator
(optional)
constant The directory separator used when writing include files. Can be Include.NATIVE (default),
Include.UNIX or Include.WINDOWS
version
(optional)
string
large
(optional)
boolean If true then large format will be used to write the file. If false (default) then the normal
LS-DYNA format will be used. Note that large format is only available from version R7.1
and above.
The LS-DYNA version used to write the file. Can be "971R5", "971R4", "971R3",
"970v6763" etc (see the version popup in Model->Write >>> LS-Dyna output options for a
full list). See also Options.dyna_version
Return type
No return value
Example
To Write model m to file /data/test/file.key
m.Write("/data/test/file.key");
190
March 2016
Options class
Options class
The Options class enables you to access several options in PRIMER. More...
Type
auto_confirm logical
browse_
missing_
include_file
logical
dyna_version string
Description
If true then Primer will automatically confirm (i.e. press the OK button) on (most)
message boxes that are mapped. If false (default) then the message boxes will be shown
and wait for the user to press a button. This option may be useful to help automate an
operation where Primer would normally show a message box and wait for the user to press
a button.
If true (default) then primer will popup a "BROWSE MISSING INCLUDE FILE" panel
while reading the model. If false then it will throw an missing include file error and
continue reading the model.
The LS-DYNA version used to write keyword files. Can be "971R5", "971R4", "971R3",
"970v6763" etc (see the version popup in Model->Write >>> LS-Dyna output options
for a full list). See also Model.Write and Include.Write
edit_keep_
on_top
logical
If true edit panels created from the Edit() or Create() methods will be kept on top of other
windows. If false (default) then they can be lowered.
exception_
messages
logical
If true (default) error messages will be printed to the dialogue box/stdout when an
exception occurs in the API. If false they will not be printed. This option may be useful if
you are using try/catch to manage exceptions and you do not want any error messages to
be printed.
model_tabs_
active
logical
If true (default) then Primer will show model tabs in the object selection menu. If false
then Primer will hide model tabs in object selection menu.
node_
replace_asrg
logical
pick_
window_
position
constant
or
Window
Position that the pick window will be shown on the screen. It can be any combination
(bitwise OR) of Window.LEFT, Window.CENTRE, Window.RIGHT, Window.TOP,
Window.MIDDLE and Window.BOTTOM or a Window object. If a window obect is used
the pick window will be shown in the middle of that window. The default is
Window.RIGHT|Window.TOP.
property_
parameter_
names
logical
If true object properties which are parameters will be returned as parameter names. If false
object properties which are parameters will be returned as parameter values. (see the
version popup in Model->Write >>> LS-Dyna output options for a full list).
reset_cwd
logical
If true then the current working directory will not be changed after selecting a file. If false
(default) then the current working directory will be changed after selecting a file. This
option only applies to Windows machines.
Type
connection_angle_ float
tol
Description
The angle tolerance used for spotwelds in the connections algorithm
connection_edge_
dist
float
connection_file
string
connection_max_
thickness
float
March 2016
191
Options class
integer The part ID selected for connections
connection_part
connection_write_ integer Flag that will be set on selected connections when writing. This can be used in the user
JavaScript to write connections to find which are selected.
flag (read only)
solid_spotweld_
diameter
float
spotweld_
element_type
Type
Description
mass_properties_centre_x
float
mass_properties_centre_y
float
mass_properties_centre_z
float
logical Option to include lumped mass attached to the nodes of rigid elements. Default
is OFF.
mass_properties_inertia_
center
integer Option to set the centre used in inertia properties calculation. By default Centre
at CofG is used. Available options are: Model.CENTRE_AT_COFG,
Model.USER_DEFINED_CENTRE.
mass_properties_local_axes
Type
Description
Type
Description
max_widgets integer The maximum number of Widgets that can be made for one Window. The default value is
1000
max_
window_
lines
192
integer The maximum number of lines that can be made for a Window.Error(), Window.Information(),
Window.Message(), Window.Question() or Window.Warning() window. The default value is
25
March 2016
Options class
Detailed Description
The Options class is used to get/set options that PRIMER uses for certain functions. The options are available as class
properties. See the documentation below for more details.
March 2016
193
PopupWindow class
PopupWindow class
The PopupWindow class allows you to create popup windows for a graphical user interface. More...
Detailed Description
The PopupWindow class allows you to make popup windows (that you can place Widgets in) and link them to Widgets.
The popup window is then displayed by right clicking on the Widget the popup is linked to. The following very simple
example shows how to create a popup window and link it to a label Widget.
// Create popup window
var pw = new PopupWindow();
// Create some widgets in the popup window
var pl = new Widget(pw, Widget.LABEL,
1, 30, 1, 7, "Label");
var pb = new Widget(pw, Widget.BUTTON, 1, 30, 7, 13, "Button");
var pt = new Widget(pw, Widget.TEXTBOX, 1, 30, 20, 26, "Textbox");
// Create window with title "Popup example" from 0.8-1.0 in x and 0.5-0.6 in y
var w = new Window("Popup example", 0.8, 1.0, 0.5, 0.6);
// Create label widget
var l = new Widget(w, Widget.LABEL,
1, 50, 1, 7, "Right click for popup...");
// link popup window to widget
l.popupWindow = pw;
// Assign the onPopup callback method to the function do_popup
// This is only required if you want to make any changes before the popup
appears
l.onPopup = do_popup;
// Show the widget and start event loop
w.Show();
////////////////////////////////////////////////////////////////////////////////
function do_popup()
{
Message("Showing popup");
}
See the documentation below and the Widget class for more details.
Constructor
new PopupWindow()
Description
Create a new PopupWindow object.
Arguments
No arguments
Return type
PopupWindow object
Example
To create a PopupWindow containing the buttons "Create" and "Edit" and link it to button b:
var pw = new PopupWindow();
var c = new Widget(pw, Widget.BUTTON, 1, 30, 1, 7, "Create");
var e = new Widget(pw, Widget.BUTTON, 1, 30, 7, 13, "Edit");
b.popupWindow = pw;
194
March 2016
Utils class
Utils class
The Utils class contains various useful utility functions. More...
Class functions
Ascii85Decode(encoded[string])
Ascii85Encode(data[ArrayBuffer], length (optional)[integer])
Build()
CheckoutLicense(feature[string])
GarbageCollect()
Version()
Detailed Description
The Utils class is used to provide various useful functions.
Details of functions
Ascii85Decode(encoded[string]) [static]
Description
Decodes an ASCII85 encoded string. See Utils.Ascii85Encode() for details on the method.
Arguments
Name
Type Description
Return type
ArrayBuffer object
Example
To decode an ASCII85 encoded string:
var decoded = Utils.Ascii85Decode(encoded);
March 2016
195
Utils class
Arguments
Name
Type
Description
data
length
(optional)
integer
Length of data in array buffer to encode. If omitted the whole array buffer will be
encoded
Return type
string
Example
To encode ArrayBuffer data:
var encoded = Utils.Ascii85Encode(data);
Build() [static]
Description
Returns the build number
Arguments
No arguments
Return type
integer
Example
To get the current build number
var build = Utils.Build();
CheckoutLicense(feature[string]) [static]
Description
Checks out a license for a feature
Arguments
Name Type Description
feature string feature to check license for
Return type
true if license available, false if not
Example
To checkout a license for "EXAMPLE":
var got = Utils.CheckoutLicense("EXAMPLE");
if (got == false) Exit();
196
March 2016
Utils class
GarbageCollect() [static]
Description
Forces garbage collection to be done. This should not normally need to be called but in exceptional circumstances it can
be called to ensure that garbage collection is done to return memory.
Arguments
No arguments
Return type
no return value
Example
To force garbage collection to be done:
Utils.GarbageCollect();
Version() [static]
Description
Returns the version number
Arguments
No arguments
Return type
real
Example
To get the current version number
var version = Utils.Version();
March 2016
197
View class
View class
The View class allows you to control the view and plotting modes in PRIMER. More...
Class functions
Ac()
Ct()
Hi()
Li()
Redraw()
Sh()
Show(View type[constant])
Si()
Vec()
View constants
Name
Description
Detailed Description
The View class gives you access to the different plotting modes and views. See the documentation below for more
details.
Details of functions
Ac() [static]
Description
Autoscales the view
Arguments
No arguments
Return type
No return value
Example
To autoscale
View.Ac();
Ct() [static]
Description
Does a contour plot
Arguments
No arguments
198
March 2016
View class
Return type
No return value
Example
To do a contour plot
View.Ct();
Hi() [static]
Description
Does a Hidden line plot
Arguments
No arguments
Return type
No return value
Example
To do a hidden line plot
View.Hi();
Li() [static]
Description
Does a line (wireframe) plot
Arguments
No arguments
Return type
No return value
Example
To do a line plot
View.Li();
Redraw() [static]
Description
Redraws the plot using the current plot mode.
Arguments
No arguments
Return type
No return value
March 2016
199
View class
Example
To redraw
View.Redraw();
Sh() [static]
Description
Does a shaded plot
Arguments
No arguments
Return type
No return value
Example
To do a shaded plot
View.Sh();
Arguments
Name
Type
Description
View type constant The view to show. Can be +/-View.XY, +/-View.YZ, +/-View.XZ or +/-View.ISO
Return type
No return value
Example
To do an isometric view from the negative direction:
View.Show(-View.ISO);
Si() [static]
Description
Does a shaded image contour plot
Arguments
No arguments
Return type
No return value
200
March 2016
View class
Example
To do a shaded image contour plot
View.Si();
Vec() [static]
Description
Does a vector plot
Arguments
No arguments
Return type
No return value
Example
To do a vector plot
View.Vec();
March 2016
201
Widget class
Widget class
The Widget class allows you to create components for a graphical user interface. More...
Class functions
CtrlPressed()
PixelsPerUnit()
ShiftPressed()
StringLength(text[string], monospace (optional)[boolean])
Member functions
Widget constants
Name
Description
Widget.BUTTON
Button widget
Label widget
Widget.LISTBOX
Listbox widget
Widget.TEXTBOX
Description
Left justification
Right justification
Widget.SCALE
202
March 2016
Widget class
Widget.TOP
Top justification
Description
Widget.SELECT_
ENHANCED
Multiple WidgetItems in a ListBox Widget can be selected. When the user selects a WidgetItem
the selection is cleared and the new WidgetItem selected. However, if the user presses the Ctrl
key when clicking on a WidgetItem, the clicked WidgetItem gets toggled and all other
WidgetItems are left untouched. If the user presses the Shift key while clicking on a
WidgetItem, all WidgetItems between the last selected WidgetItem and the clicked WidgetItem
are selected or unselected, depending on the state of the clicked WidgetItem.
Widget.SELECT_
MULTIPLE
Multiple WidgetItems in a ListBox Widget can be selected. When the user selects a WidgetItem,
the selection status of that WidgetItem is toggled and the other WidgetItems are left alone.
Widget.SELECT_
NONE
Widget.SELECT_
SINGLE
A single WidgetItem in a ListBox Widget can be selected. When the user selects a WidgetItem,
any already-selected WidgetItem becomes unselected, and the user cannot unselect the selected
WidgetItem by clicking on it.
Description
Widget.BLACK
Colour black
Widget.BLUE
Colour blue
Widget.CYAN
Colour cyan
Widget.DARKBLUE
Widget.DARKRED
Widget.DEFAULT
Widget.GREEN
Colour green
Widget.GREY
Colour grey
Widget.LIGHTGREY
Widget.MAGENTA
Colour magenta
Widget.ORANGE
Colour orange
Widget.RED
Colour red
Widget.WHITE
Colour white
Widget.YELLOW
Colour yellow
Widget properties
Name
Type
Description
active
logical
March 2016
203
Widget class
background
constant
bottom
integer
foreground
constant
hover
string
imageHeight
(read only)
integer
imageWidth
(read only)
integer
justify
constant
left
integer
lineWidth
integer
macroTag
string
Tag to use for this widget when recording a macro. If empty then the text property
value will be used.
monospace
boolean
true if the widget uses a monspace font instead of a proportional width font
(default). Label and button Widgets only.
onChange
function
onClick
function
onPopup
function
onTimer
function
Function to call for a widget when timerDelay ms have elapsed after setting this.
Additionally if timerRepeat is set this function will be called repetitively, every
timerDelay ms. The Widget object is accessible in the function using the this
keyword.
To unset the function set the property to null.
Note that as soon as this property is set the timer starts!
popupDirection
constant
popupSymbol
logical
204
March 2016
Widget class
popupWindow
PopupWindow
object
PopupWindow for this Widget. Only available for Button, Label and Textbox
Widgets. To remove a PopupWindow from a Widget set to null.
pushed
logical
If widget is pushed (true) or not (false). This only affects Widget.BUTTON with
the Widget.toggle property set, and Widget.CHECKBOX widgets.
right
integer
select
constant
selectedItem
WidgetItem
object
shown (read
only)
boolean
true if the widget is visible. To alter the visibility of a widget use the Show() and
Hide() methods.
text
string
Widget text. For a ComboBox Widget this will be the text for the currently
selected WidgetItem
textHidden
boolean
true if the widget text is hidden and replaced by asterisks. This may be used to
create textboxes to type passwords in. TextBox Widgets only.
timerDelay
integer
Delay in ms before the function set for onTimer will be called. The initial value is
1000 (ms). Also see timerRepeat.
timerRepeat
logical
If the function set for onTimer will be called once (false) or repeatedly (true). The
initial value is false. Also see timerDelay.
toggle
logical
If widget can be toggled (true) or not (false). This only affects Widget.BUTTON
widgets.
top
integer
window (read
only)
xResolution
integer
yResolution
integer
Detailed Description
The Widget class allows you to create Widgets (buttons, textboxes etc) in a Window for a graphical user interface.
Callback functions can be declared for widgets to give actions when a button is pressed or the text in a textbox is
selected etc. The following example displays various widgets in a window. Several callback methods are used. The exit
button allows the user to exit the script but the button is only made active if the checkbox widget is ticked. If the button
widgets are pressed feedback is given to the user
var count = 0;
// Create window
var w = new Window("Test", 0.8, 1.0, 0.5,
// Create all of the widgets
var l = new Widget(w, Widget.LABEL,
1,
var t = new Widget(w, Widget.TEXTBOX, 31,
var b = new Widget(w, Widget.BUTTON,
1,
var b2= new Widget(w, Widget.BUTTON, 31,
var c = new Widget(w, Widget.CHECKBOX,62,
var l2= new Widget(w, Widget.LABEL,
1,
button yet...");
var e = new Widget(w, Widget.BUTTON,
1,
// Allow button widget b2 to toggle
0.6);
30,
80,
30,
61,
68,
80,
1, 7, "Text:");
1, 7, "Enter text");
8, 14, "Press me");
8, 14, "Dont press me");
8, 14);
15, 21, "You havent pressed the
March 2016
205
Widget class
b2.toggle = true;
// The exit button is initially inactive
e.active = false;
// Assign the callback functions
b.onClick = clicked;
b2.onClick = clicked;
c.onClick = clicked;
t.onChange = changed;
e.onClick = confirm_exit;
// Show the window and start event loop
w.Show();
////////////////////////////////////////////////////////////////////////////////
function clicked()
{
// If checkbox is clicked then set the state of the exit button
if (this === c)
{
Message("Checkbox clicked");
e.active = c.pushed;
}
// If the "Dont press me button is pressed then change the colour if the
button is pressed in.
else if (this === b2)
{
Message("I said dont press!!!");
if (b2.pushed) b2.background = Widget.WHITE;
else
b2.background = Widget.DEFAULT;
}
// If the "Press me" button is pressed then update the text in the label widget
// with how many times the button has been pressed.
else
{
Message("You pressed...");
count++;
l2.text = "Button pressed " + count + " times";
}
}
////////////////////////////////////////////////////////////////////////////////
function changed()
{
// If the user has changed the text in the textbox then give a message in
// the dialogue box
Message("Text has changed to " + this.text);
}
////////////////////////////////////////////////////////////////////////////////
function confirm_exit()
{
// Map confirm box
var ret = Window.Question("Confirm exit", "Are you sure you want to quit?");
// If the user has answered yes then exit from the script.
if (ret == Window.YES) Exit();
}
Graphics (lines, circles, rectanges etc) can be drawn on Widget.LABEL and Widget.BUTTON widgets. If these
methods are used the resolution of the widget is 100 units in x and y and the origin is at the top left of the widget. See
the documentation below and the WidgetItem and Window classes for more details.
Constructor
new Widget(window[Window or PopupWindow], type[constant], left[integer],
right[integer], top[integer], bottom[integer], text (optional for LABEL, BUTTON
and TEXTBOX, not required for CHECKBOX, COMBOBOX and
LISTBOX)[string])
Description
Create a new Widget object.
206
March 2016
Widget class
Arguments
Name
Type
Description
window
Window or
PopupWindow
type
constant
left
integer
right
integer
top
integer
bottom
integer
Return type
Widget object
Details of functions
AddWidgetItem(item[WidgetItem], position (optional)[integer])
Description
Adds a WidgetItem to the Widget. Also see Widget.RemoveAllWidgetItems and Widget.RemoveWidgetItem.
Arguments
Name
Type
Description
item
position
(optional)
integer
Position on Widget to add the WidgetItem. Any existing WidgetItems will be shifted
down as required. If omitted the WidgetItem will be added to the end of the existing ones.
Note that positions start at 0.
Return type
No return value
Example
To add WidgetItem wi to widget w:
w.AddWidgetItem(wi);
March 2016
207
Widget class
Arguments
Name Type
Description
xc
integer
yc
integer
radius integer
radius of circle.
Return type
no return value
Example
To draw a red filled circle, radius 25, at (50, 50) on widget w:
w.Circle(Widget.RED, true, 50, 50, 25);
Clear()
Description
Clears any graphics on the widget. Only possible for Widget.LABEL and Widget.BUTTON widgets. Note that the
widget graphics will only be updated when the widget is redrawn. This is to allow the user to do multiple drawing
commands on a widget. To force the widget to be redrawn call Show().
Arguments
No arguments
Return type
no return value
Example
To clear any graphics for widget w:
w.Clear();
ClearSelection()
Description
Clears selection of any WidgetItems on the widget. Only possible for Widget.COMBOBOX and Widget.LISTBOX
widgets.
Arguments
No arguments
Return type
no return value
Example
To clear selection of any WidgetItems for widget w:
w.ClearSelection();
208
March 2016
Widget class
Cross(colour (optional)[constant])
Description
Draws a cross symbol on the widget. Only possible for Widget.LABEL and Widget.BUTTON widgets.
Arguments
Name
Type
Description
colour
(optional)
constant Colour of cross symbol. See foreground for colours. If omitted, current foreground colour
is used.
Return type
no return value
Example
To draw a red cross symbol on widget w:
w.Cross(Widget.RED);
CtrlPressed() [static]
Description
Check to see if the Ctrl key is pressed
Arguments
No arguments
Return type
true/false
Example
To test if someone has the Ctrl key pressed:
if (Widget.CtrlPressed()) { ... }
Delete()
Description
Deletes the widget from PRIMER (removing it from the window it is defined in) and returns any memory/resources
used for the widget. This function should not normally need to be called. However, sometimes a script may want to
recreate widgets in a window many times and unless the old widgets are deleted PRIMER will reach the maximum
number of widgets for a window (Options.max_widgets). To avoid this problem this method can be used to force
PRIMER to delete and return the resources for a widget. Do not use the Widget object after calling this method.
Arguments
No arguments
Return type
no return value
Example
To delete widget w:
w.Delete();
March 2016
209
Widget class
DumpImageString(filename[string])
Description
Dumps a string representation of an image for a widget to a file in a form that can be used by
Widget.ReadImageString(). Only possible for Widget.LABEL and Widget.BUTTON widgets.
Arguments
Name
Type Description
Return type
no return value
Example
To dump the image data to file image_data for widget w:
w.DumpImageString(image_data);
Hide()
Description
Hides the widget on the screen
Arguments
No arguments
Return type
No return value
Example
To hide widget w
w.Hide();
ItemAt(index[integer])
Description
Returns the WidgetItem object used at index in this Widget. See also Widget.TotalItems() and Widget.WidgetItems().
Arguments
Name Type
Description
index integer index to return WidgetItem for. Note that indices start at 0.
Return type
WidgetItem object.
210
March 2016
Widget class
Example
To loop over the WidgetItems used in Widget w
for (i=0; i<w.TotalItems(); i++)
{
wi = w.ItemAt(i);
}
Arguments
Name Type
Description
integer
y1
integer
x2
integer
y2
integer
Return type
no return value
Example
To draw a red line from (10, 90) to (90, 10) on widget w:
w.Line(Widget.RED, 10, 90, 90, 10);
PixelsPerUnit() [static]
Description
Returns the number of pixels per unit coordinate. This will vary depending on the monitor PRIMER is running on.
Arguments
No arguments
Return type
pixels/unit (float)
Example
To return how many pixels there are per unit coordinate:
var ppu = Widget.PixelsPerUnit();
March 2016
211
Widget class
Arguments
Name Type
Description
x1
integer
x coordinate of point 1.
y1
integer
y coordinate of point 1.
x2
integer
x coordinate of point 2.
y2
integer
y coordinate of point 2.
... xn
integer
x coordinate of point n.
... yn
integer
y coordinate of point n.
Alternatively instead of x1, y1 etc you can specify a single argument which is an array of coordinates to use. In either
case the number of points (x, y pairs) is limited to 30. Any extra points will be ignored.
Return type
no return value
Example
To draw a red filled triangle with corners (20, 20) and (50, 80) and (80, 20) on widget w:
w.Polygon(Widget.RED, true, 20, 20, 50, 80, 80, 20);
Arguments
Name
Type
Description
filename
string
Image file (BMP, GIF, JPEG or PNG) to read. To remove an image use null.
justify
(optional)
constant
transparent
colour
value
(integer)
Transparent colour. Must be a colour returned by Colour.RGB(). If given then this colour
will be replaced by a transparent colour. i.e. the widget background colour will be shown. If
omitted or null no transparency will be used.
212
March 2016
Widget class
Return type
no return value
Example
To read image example.png for widget w and place it at the top left:
w.ReadImageFile("example.png", Widget.TOP|Widget.LEFT);
To read image example.png for widget w and place it at the top left, scaling it to fit the widget:
w.ReadImageFile("example.png", Widget.TOP|Widget.LEFT|Widget.SCALE);
To read image example.png for widget w and place it at the top left, replacing red with a transparent colour:
w.ReadImageFile("example.png", Widget.TOP|Widget.LEFT, Colour.RGB(255, 0, 0));
To remove an image from widget w:
w.ReadImageFile(null);
Arguments
Name
Type
Description
string
string
justify
(optional)
constant
transparent
colour
value
(integer)
Transparent colour. Must be a colour returned by Colour.RGB(). If given then this colour
will be replaced by a transparent colour. i.e. the widget background colour will be shown. If
omitted or null no transparency will be used.
Return type
no return value
Example
To read image data from string s for widget w and place it at the top left:
w.ReadImageString(s, Widget.TOP|Widget.LEFT);
To read image data from string s for widget w and place it at the top left, scaling it to fit the widget:
w.ReadImageString(s, Widget.TOP|Widget.LEFT|Widget.SCALE);
To read image data from string s for widget w and place it at the top left, replacing red with a transparent colour:
w.ReadImageString(s, Widget.TOP|Widget.LEFT, Colour.RGB(255, 0, 0));
To remove an image from widget w:
w.ReadImageString(null);
March 2016
213
Widget class
Arguments
Name Type
Description
x1
integer
y1
integer
x2
integer
y2
integer
Return type
no return value
Example
To draw a red filled rectangle with corners (20, 20) and (80, 80) on widget w:
w.Rectangle(Widget.RED, true, 20, 20, 80, 80);
RemoveAllWidgetItems()
Description
Removes any WidgetItems from the Widget. Also see Widget.AddWidgetItem and Widget.RemoveWidgetItem.
Arguments
No arguments
Return type
No return value
Example
To remove all WidgetItems from widget w:
w.RemoveAllWidgetItems();
RemoveWidgetItem(item[WidgetItem])
Description
Removes a WidgetItem from the Widget. Also see Widget.AddWidgetItem and Widget.RemoveAllWidgetItems.
214
March 2016
Widget class
Arguments
Name Type
item
Description
Return type
No return value
Example
To remove WidgetItem wi from widget w:
w.RemoveWidgetItem(wi);
ShiftPressed() [static]
Description
Check to see if the Shift key is pressed
Arguments
No arguments
Return type
true/false
Example
To test if someone has the Shift key pressed:
if (Widget.ShiftPressed()) { ... }
Show()
Description
Shows the widget on the screen
Arguments
No arguments
Return type
No return value
Example
To show widget w:
w.Show();
Static()
Description
Windows have two different regions for Widgets. A normal region which can be scrolled if required (if the window is
made smaller scrollbars will be shown which can be used to scroll the contents) and a static region at the top of the
Window which is fixed and does not scroll. For an example of a static region in a Window see any of the keyword
editing panels. The Dismiss, Create, Reset etc buttons are in the static region. By default Widgets are put into the
normal region of the Window. This method puts the Widget to the static region of the Window.
March 2016
215
Widget class
Arguments
No arguments
Return type
No return value
Example
To put widget w in the static part of the window:
w.Static();
Arguments
Name
Type
Description
text
string
monospace
(optional)
boolean If true then width will be calculated using a monospace font. If false (default) then the
normal proportional width font will be used
Return type
integer
Example
To get the width of string Example:
var len = Widget.StringLength(Example);
Tick(colour (optional)[constant])
Description
Draws a tick symbol on the widget. Only possible for Widget.LABEL and Widget.BUTTON widgets.
Arguments
Name
Type
Description
colour
(optional)
constant Colour of tick symbol. See foreground for colours. If omitted, current foreground colour is
used.
Return type
no return value
Example
To draw a red tick symbol on widget w:
w.Tick(Widget.RED);
216
March 2016
Widget class
TotalItems()
Description
Returns the number of the WidgetItem objects used in this Widget (or 0 if none used). See also Widget.ItemAt() and
Widget.WidgetItems().
Arguments
No arguments
Return type
integer
Example
To return the total number of WidgetItems used for Widget w
var total = w.TotalItems();
WidgetItems()
Description
Returns an array of the WidgetItem objects used in this Widget (or null if none used). See also Widget.ItemAt() and
Widget.TotalItems().
Arguments
No arguments
Return type
array
Example
To return WidgetItems used for Widget w
var wi = w.WidgetItems();
March 2016
217
WidgetItem class
WidgetItem class
The WidgetItem class allows you to create items for combobox Widgets. More...
WidgetItem properties
Name
Type
Description
background
foreground
index (read
only)
index
onClick
function Function to call when a widget item in a COMBOBOX or LISTBOX widget is clicked. The
Widgetitem object is accessible in the function using the this keyword.
The index of this widgetitem in the parent widget (undefined if widgetitem is not assigned
to a widget).
onMouseOver function Function to call when the mouse moves over a widget item in a COMBOBOX or LISTBOX
widget. The Widgetitem object is accessible in the function using the this keyword.
selectable
logical
selected
logical
text
string
Widget text
widget (read
only)
object
Detailed Description
The WidgetItem class allows you to create items for combobox Widgets in a Window for a graphical user interface. The
following example shows how WidgetItems are used to create a Combobox Widget and how to assign callbacks to
determine when the selection has been changed.
var items = ["D3PLOT", "PRIMER", "SHELL", "REPORTER", "T/HIS"]
// Create window
var w = new Window("Combobox example", 0.8, 1.0, 0.5, 0.6);
// A simple combobox with a few items
var cl= new Widget(w, Widget.LABEL,
1, 30, 1, 7, "Programs:");
var cb= new Widget(w, Widget.COMBOBOX, 31, 61, 1, 7);
// Add WidgetItems to Combobox
for (i=0; i<items.length; i++)
var wi = new WidgetItem(cb, items[i]);
// A combobox with many items showing a slider.
var li= new Widget(w, Widget.LABEL,
1, 30, 8, 14, "Long list:");
var ci= new Widget(w, Widget.COMBOBOX, 31, 61, 8, 14);
// Add WidgetItems to Combobox
// As an example we also make some of the WidgetItems unselectable and
// change the background colour
for (i=1; i<=100; i++)
{
var wi = new WidgetItem(ci, "Item "+i);
if ( (i % 10) == 5)
{
wi.selectable = false;
wi.background = Widget.WHITE;
}
}
var e = new Widget(w, Widget.BUTTON,
1, 21, 15, 21, "Exit");
// Assign callbacks
cb.onClick = clicked;
218
March 2016
WidgetItem class
cb.onChange = changed;
ci.onClick = clicked;
ci.onChange = changed;
e.onClick
= confirm_exit
// Show the window and start event loop
w.Show();
////////////////////////////////////////////////////////////////////////////////
function clicked()
{
// If combobox is clicked then print the current selection
if (this.selectedItem)
Message("selection is currently "+this.selectedItem.text+"");
}
////////////////////////////////////////////////////////////////////////////////
function changed()
{
// If combobox selection is changed then print the new selection
if (this.selectedItem)
Message("selection is now "+this.selectedItem.text+"");
}
////////////////////////////////////////////////////////////////////////////////
function confirm_exit()
{
// Map confirm box
var ret = Window.Question("Confirm exit", "Are you sure you want to quit?");
// If the user has answered yes then exit from the script.
if (ret == Window.YES) Exit();
}
See the documentation below and the Window and Widget classes for more details.
Constructor
new WidgetItem(widget[Widget], text[string], selectable (optional)[boolean])
Description
Create a new WidgetItem object.
Arguments
Name
Type
Description
widget
Widget Widget that widget item will be created in. This can be null in which case the WidgetItem
will be created but not assigned to a Widget. It can be assigned later by using
Widget.AddWidgetItem().
text
string
selectable
(optional)
boolean If the widget item can be selected. If omitted the widget item will be selectable.
Return type
WidgetItem object
March 2016
219
Window class
Window class
The Window class allows you to create windows for a graphical user interface. More...
Class functions
BottomBorder()
Error(title[string], error[string], buttons (optional)[constant])
GetDirectory(initial (optional)[string])
GetFile(extension (optional)[string], save (optional)[boolean], initial (optional)[string])
GetFilename(title[string], message[string], extension (optional)[string], initial (optional)[string], save
(optional)[boolean])
GetFiles(extension (optional)[string])
GetInteger(title[string], message[string], initial (optional)[integer])
GetNumber(title[string], message[string], initial (optional)[float])
GetString(title[string], message[string], initial (optional)[string])
Information(title[string], info[string], buttons (optional)[constant])
MasterResolution()
Message(title[string], message[string], buttons (optional)[constant])
MiddleBorder()
Question(title[string], question[string], buttons (optional)[constant])
RightBorder()
SetGraphicsWindowPosition(left[float], right[float], bottom[float], top[float])
TopBorder()
UpdateGUI()
Warning(title[string], warning[string], buttons (optional)[constant])
Member functions
Delete()
Hide()
Recompute()
Redraw()
Show(modal (optional)[boolean])
Window constants
Name
Description
Window.CANCEL
Window.NO
Show NO button
Show OK button
Window.YES
Description
Window.TOP
Window properties
220
March 2016
Window class
Name
Type
Description
active
boolean If true (default) then the window then the window is active and widgets in the window can
be used. If false then the window is inactive and the widgets cannot be used.
background
bottom
float
height
float
height of window
keepOnTop
boolean If true then the window will be kept "on top" of other windows. If false (default) then the
window stacking order can be changed.
left
float
onAfterShow
function Function to call after a Window is shown. The Window object is accessible in the function
using the this keyword. This may be useful to ensure that certain actions are done after the
window is shown. It can also be used to show another window so this enables multiple
windows to be shown.
To unset the function set the property to null.
onBeforeShow function Function to call before a Window is shown. The Window object is accessible in the
function using the this keyword. This may be useful to ensure that buttons are
shown/hidden etc before the window is shown. Note that it cannot be used to show another
window. Use onAfterShow for that.
To unset the function set the property to null.
onClose
function Function to call when a Window is closed by pressing the X on the top right of the window.
The Window object is accessible in the function using the this keyword.
To unset the function set the property to null.
resize
constant Window resizing. By default when a Window is shown it is allowed to resize on all sides
(left, right, top and bottom) to try to make enough room to show the Widgets. The
behaviour can be changed by using this property. It can be any combination (bitwise OR) of
Window.LEFT, Window.RIGHT, Window.TOP or Window.BOTTOM or 0. In addition
Window.REDUCE can also be added to allow the window to reduce in size when resizing.
Note that when Window.Show is called this property is set to 0 (i.e. not to resize on any
side).
right
float
showClose
boolean If true (default) then a close (X) button will automatically be added on the top right of the
window. If false then no close button will be shown.
shown (read
only)
title
string
Window title
top
float
width
float
width of window
Detailed Description
The Window class allows you to make windows that you can place Widgets in to create a graphical user interface. The
Widget class also gives a number of static methods for convenience. e.g. Window.GetInteger(). The following very
simple example displays some text in a window with a button that unmaps the window when it is pressed and the user
confirms that (s)he wants to exit.
// Create window with title "Text" from 0.8-1.0 in x and 0.5-0.6 in y
var w = new Window("Text", 0.8, 1.0, 0.5, 0.6);
// Create label widget
var l = new Widget(w, Widget.LABEL,
1, 40, 1, 7, "Press OK to exit");
// Create button widget
var e = new Widget(w, Widget.BUTTON, 11, 30, 8, 14, "OK");
// Assign the onClick callback method to the function confirm_exit
e.onClick = confirm_exit;
March 2016
221
Window class
// Show the widget and start event loop
w.Show();
////////////////////////////////////////////////////////////////////////////////
function confirm_exit()
{
// Map confirm window
var ret = Window.Question("Confirm exit", "Are you sure you want to quit?");
// If the user has answered Yes then exit.
if (ret == Window.YES) w.Exit();
}
See the documentation below and the Widget class for more details.
Constructor
new Window(title[string], left[float], right[float], bottom[float], top[float])
Description
Create a new Window object.
Arguments
Name Type Description
title
left
float
right
float
bottom float
top
float
Return type
Window object
Example
To create a Window Example in the top right half of the screen:
var w = new Window(Example, 0.5, 1.0, 0.5, 1.0);
Details of functions
BottomBorder() [static]
Description
Returns the vertical position of the bottom border (in range 0-1). This can be used to help position windows on the
screen.
Arguments
No arguments
Return type
float in range 0-1
Example
To obtain the position of the bottom border:
var b = Window.BottomBorder();
222
March 2016
Window class
Delete()
Description
Deletes the window from PRIMER and returns any memory/resources used for the window. This function should not
normally need to be called. However, in exceptional circumstances if a script recreates windows many times PRIMER
may run out of USER objects on Microsoft Windows because of the way PRIMER creates and shows windows. To
avoid this problem this method can be used to force PRIMER to return the resources for a window. Do not use the
Window object after calling this method.
Arguments
No arguments
Return type
No return value
Example
To delete window w:
w.Delete();
Arguments
Name
Type
Description
title
string
error
string
Error message to show in window. The maximum number of lines that can be shown is
controlled by the Options.max_window_lines option.
buttons
(optional)
Return type
Button pressed
Example
To show error Critical error!\nAbort? in window with title Error with Yes and No buttons:
var answer = Window.Error("Error", "Critical error!\nAbort?", Window.YES |
Window.NO);
if (answer == Window.YES) Exit();
March 2016
223
Window class
Arguments
Name
Type Description
Return type
directory (string), (or null if cancel pressed).
Example
To select a directory:
var dir = Window.GetDirectory();
Arguments
Name
Type
Description
extension
(optional)
string
save
(optional)
boolean If true the file selector is to be used for saving a file. If false (default) the file selector is for
opening a file. Due to native operating system file selector differences, on linux new filenames
can only be given when saving a file. On windows it is possible to give new filenames when
opening or saving a file.
initial
(optional)
string
Return type
filename (string), (or null if cancel pressed).
Example
To select a file using extension .key:
var file = Window.GetFile(".key");
224
March 2016
Window class
Arguments
Name
Type
Description
title
string
message
string
extension
(optional)
string
initial
(optional)
string
Initial value.
save
(optional)
boolean If true the file selector is to be used for saving a file. If false (default) the file selector is for
opening a file. Due to native operating system file selector differences, on linux new filenames
can only be given when saving a file. On windows it is possible to give new filenames when
opening or saving a file.
Return type
filename (string), (or null if cancel pressed).
Example
To create an file input window with title Choose file and message Choose the file to open and return the filename input:
var filename = Window.GetFilename("Choose file", "Choose the file to open");
Arguments
Name
Type Description
Return type
Array of filenames (strings), or null if cancel pressed.
Example
To select multiple files using extension .key:
var files = Window.GetFiles(".key");
March 2016
225
Window class
Arguments
Name
Type
Description
title
string
message
string
Return type
value input (integer), or null if cancel pressed.
Example
To create an input window with title Input and message Input integer and return the value input:
var value = Window.GetInteger("Input", "Input integer");
Arguments
Name
Type Description
title
message
Initial value.
Return type
value input (float), or null if cancel pressed.
Example
To create an input window with title Input and message Input number and return the value input:
var value = Window.GetNumber("Input", "Input number");
Arguments
Name
Type Description
title
message
Return type
value input (string), or null if cancel pressed.
226
March 2016
Window class
Example
To create an input window with title Input and message Input string and return the value input:
var value = Window.GetString("Input", "Input string");
Hide()
Description
Hides (unmaps) the window.
Arguments
No arguments
Return type
No return value
Example
To hide window w:
w.Hide();
Arguments
Name
Type
Description
title
string
info
string
Information to show in window. The maximum number of lines that can be shown is
controlled by the Options.max_window_lines option.
buttons
(optional)
Return type
Button pressed
Example
To show information Information in window with title Example with OK and Cancel buttons:
var answer = Window.Information("Example", "Information", Window.OK |
Window.CANCEL);
if (answer == Window.CANCEL) Message("You pressed the Cancel button");
MasterResolution() [static]
Description
Returns the resolution of the master programme window in pixels
March 2016
227
Window class
Arguments
No arguments
Return type
Array containing x and y resolution in pixels
Example
To get the resolution of the main window:
var res = Window.MasterResolution();
Arguments
Name
Type
Description
title
string
message
string
Message to show in window. The maximum number of lines that can be shown is controlled by
the Options.max_window_lines option.
buttons
(optional)
Return type
Button pressed
Example
To show message Press YES or NO in window with title Example with YES and NO buttons:
var answer = Window.Message("Example", "Press YES or NO", Window.YES |
Window.NO);
if (answer == Window.NO) Message("You pressed No");
MiddleBorder() [static]
Description
Returns the vertical position of the middle border (in range 0-1). The middle border is the border between the
tools/keywords window and the docked windows. This can be used to help position windows on the screen.
Arguments
No arguments
Return type
float in range 0-1
Example
To obtain the position of the middle border:
var b = Window.MiddleBorder();
228
March 2016
Window class
Arguments
Name
Type
Description
title
string
question
string
Question to show in window. The maximum number of lines that can be shown is controlled
by the Options.max_window_lines option.
buttons
(optional)
Return type
Button pressed
Example
To show question Do you want to continue? in window with title Question:
var answer = Window.Question("Question", "Do you want to continue?");
if (answer == Window.NO) Message("You pressed No");
Recompute()
Description
Recomputes the positions of widgets in the window. If you have static widgets and normal widgets in a window and
you show and/or hide widgets the window needs to be recomputed to refresh the graphics, scroll bars etc. Calling this
method will recompute and redraw the window.
Arguments
No arguments
Return type
No return value
Example
To recompute window w:
w.Recompute();
Redraw()
Description
Redraws the window. Sometimes if you show, hide or draw graphics on widgets the window needs to be redrawn to
refresh the graphics. Calling this method will redraw the window refreshing the graphics.
Arguments
No arguments
Return type
No return value
March 2016
229
Window class
Example
To redraw window w:
w.Redraw();
RightBorder() [static]
Description
Returns the horizontal position of the right border (in range 0-1). This can be used to help position windows on the
screen.
Arguments
No arguments
Return type
float in range 0-1
Example
To obtain the position of the right border:
var b = Window.RightBorder();
Arguments
Name Type Description
left
float left coordinate of graphics window in range 0.0 (left) to 1.0 (right)
right
float right coordinate of graphics window in range 0.0 (left) to 1.0 (right)
bottom float bottom coordinate of graphics window in range 0.0 (bottom) to 1.0 (top)
top
float top coordinate of graphics window in range 0.0 (bottom) to 1.0 (top)
Return type
No return value
Example
To move/resize the graphics window to be in the top left half of the screen:
Window.SetGraphicsWindowPosition(0.0, 0.5, 0.5, 1.0);
Show(modal (optional)[boolean])
Description
Shows (maps) the window and waits for user input.
230
March 2016
Window class
Arguments
Name
Type
Description
modal
(optional)
boolean If this window is modal (true) then the user is blocked from doing anything else in PRIMER
until this window is dismissed). If non-modal (false) then the user can still use other functions
in PRIMER.
If omitted the window will be modal.
Note that making a window modal will stop interaction in all other windows and may prevent
operations such as picking from working in any macros that are run from scripts.
Return type
No return value
Example
To show window w:
w.Show();
To show window w allowing the user to use other functions in PRIMER:
w.Show(false);
TopBorder() [static]
Description
Returns the vertical position of the top border (in range 0-1). This can be used to help position windows on the screen.
This is no longer used in PRIMER and will always be 1 but is left for backwards compatibility.
Arguments
No arguments
Return type
float in range 0-1
Example
To obtain the position of the top border:
var b = Window.TopBorder();
UpdateGUI() [static]
Description
Force GUI to be updated. This function is not normally needed but if you are doing a computationally expensive
operation and want to update the GUI it may be necessary as the GUI update requests are cached until there is spare
time to update them. Calling this function forces any outstanding requests to be flushed.
Arguments
No arguments
Return type
No return value
Example
To force update of GUI:
Window.UpdateGUI();
March 2016
231
Window class
Arguments
Name
Type
Description
title
string
warning
string
Warning message to show in window. The maximum number of lines that can be shown is
controlled by the Options.max_window_lines option.
buttons
(optional)
Return type
Button pressed
Example
To show warning Title is blank\nSet to ID? in window with title Warning with Yes and No buttons:
var answer = Window.Warning("Warning", "Title is blank\nSet to ID?", Window.YES
| Window.NO);
if (answer == Window.NO) Message("You pressed No");
232
March 2016
XMLParser class
XMLParser class
The XMLParser class enables reading data from XML files. More...
Member functions
Parse(filename[string])
XMLParser properties
Name
Type
Description
characterDataHandler function Function to call when character data is found. The function will be called with 1
argument which is a string containing the character data
commentHandler
function Function to call when a comment is found. The function will be called with 1
argument which is a string containing the text inside the comment
endCDATAHandler
function Function to call at the end of a CDATA section. The function does not have any
arguments.
endElementHandler
function Function to call when an element end tag is found. The function will be called with 1
argument which is a string containing the name of the element
startCDATAHandler function Function to call at the start of a CDATA section. The function does not have any
arguments.
startElementHandler
function Function to call when an element start tag is found. The function will be called with
2 arguments. Argument 1 is a string containing the name of the element. Argument 2
is an object containing the element attributes
Detailed Description
The XMLParser class provides a stream-oriented parser to enable you to read XML files. You register callback (or
handler) functions with the parser and then parse the document. As the parser recognizes parts of the document, it will
call the appropriate handler for that part (if youve registered one.) The document is fed to the parser in pieces. This
allows you to parse really huge documents that wont fit into memory.
There are currently 6 handlers which can be set: XMLParser.startElementHandler, XMLParser.endElementHandler,
XMLParser.characterDataHandler, XMLParser.commentHandler, XMLParser.startCDATAHandler and
XMLParser.endCDATAHandler.
The following simple example shows how the parser could be used.
// Create a new parser object
var p = new XMLParser();
// assign handlers
p.startElementHandler = startElem;
p.endElementHandler
= endElem;
p.characterDataHandler = text;
p.commentHandler
= comment;
// parse the file
p.Parse("/data/test.xml");
////////////////////////////////////////////////////////////////////////////////
function startElem(name, attr)
{
// handler to be called when a start element is found
// Print element name
Println("START: " + name);
// Print attributes
for (n in attr)
{
Println(" attr: " + n + "=" + attr[n]);
}
}
function endElem(name)
{
// handler to be called when an end element is found
// Print element name
Println("END: " + name);
March 2016
233
XMLParser class
}
function text(str)
{
// handler to be called when text is found
// Print text
Println("TEXT: " + str + "");
}
function comment(str)
{
// handler to be called when a comment is found
// Print comment
Println("COMMENT: " + str + "");
}
See the documentation below for more details.
Constructor
new XMLParser()
Description
Create a new XMLParser object for reading XML files.
Arguments
No arguments
Return type
XMLParser object
Example
To create a new XMLParser object to read XML file "/data/test/file.xml"
var p = new XMLParser("/data/test/file.xml");
Details of functions
Parse(filename[string])
Description
starts parsing an XML file
Arguments
Name
Type Description
Return type
No return value
Example
To parse XML file "/data/test.xml"
var p = new XMLParser();
p.parse("/data/test.xml");
234
March 2016
Xrefs class
Xrefs class
The Xrefs class gives you access to cross references. More...
Member functions
Xrefs properties
Name
Type
Description
numtypes integer The number of different types that this item is referenced by. (read only)
total
integer The total number of cross references of all types to this item. (read only)
Detailed Description
The Xrefs class allows you to look at what things use an item. e.g. a node may be used on several shells. See the
documentation below for more details.
Details of functions
GetID(type[string], pos[integer]) [deprecated]
This function is deprecated in version 10.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.
Use Xrefs.GetItemID() instead.
GetItemID(type[string], pos[integer])
Description
Returns the ID of the item in the reference list.
Arguments
Name Type
Description
type
string
The type of the item in the reference list (for a list of types see Appendix I of the PRIMER manual).
pos
integer The position in the list for this item. Note that positions start at 0, not 1
Return type
ID of item
March 2016
235
Xrefs class
Example
To list all of the xrefs for node n:
var xrefs = n.Xrefs();
for (var t=0; t<xrefs.numtypes; t++)
{
var type = xrefs.GetType(t);
var num = xrefs.GetTotal(type);
for (var ref=0; ref<num; ref++)
{
var id = xrefs.GetItemID(type, ref);
Message(type + " " + id + "\n");
}
}
GetItemType(type[string], pos[integer])
Description
Returns the type of the item in the reference list. This function is only required when trying to look at cross references
to *DEFINE_CURVE items. These items are used in a slightly different way in PRIMER (each time a curve is used a
LOADCURVE REFERENCE structure is created to store things like the units and descriptions of each axis for the
curve). If you try to get the cross references for a curve all the references will be of type LOADCURVE REFERENCE
and numtypes will be 1. GetItemID() will correctly return the ID of the item from the LOADCURVE REFERENCE
structure but to get the type of the item this function is required.
Arguments
Name Type
Description
type
string
The type of the item in the reference list (for a list of types see Appendix I of the PRIMER manual).
pos
integer The position in the list for this item. Note that positions start at 0, not 1
Return type
type of item (String). For every item apart from *DEFINE_CURVE items this will be the same as the type argument.
Example
To list all of the xrefs for Curve c:
var xrefs = c.Xrefs();
for (var t=0; t<xrefs.numtypes; t++)
{
var type = xrefs.GetType(t);
var num = xrefs.GetTotal(type);
for (var ref=0; ref<num; ref++)
{
var id = xrefs.GetItemID(type, ref);
var itype = xrefs.GetItemType(type, ref);
Message(itype + " " + id + "\n");
}
}
GetTotal(type[string])
Description
Returns the total number of references of a type.
236
March 2016
Xrefs class
Arguments
Name Type Description
type
string The type of the item in the reference list (for a list of types see Appendix I of the PRIMER manual).
Return type
Number of refs (integer)
Example
To find the total number of shell references that node n has:
var xrefs = n.Xrefs();
var num = xrefs.GetTotal("SHELL");
GetType(n[integer])
Description
Returns the type for
Arguments
Name Type
n
Description
integer The entry in the reference types that you want the type for. Note that entries start at 0, not 1
Return type
The type of the item (string)
Example
To list the types of items that have cross references for node n:
var xrefs = n.Xrefs();
for (var t=0; t<xrefs.numtypes; t++)
{
var type = xrefs.GetType(t);
var num = xrefs.GetTotal(type);
Message(num + " references of type " + type + "\n");
}
March 2016
237
Zip class
Zip class
The Zip class enables reading/writing/creating zip files. More...
Member functions
AddFile(filename[string], zipname[string])
Close()
Information()
Next()
ReadFile(filename[string])
Zip constants
Name
Description
Zip.WRITE
Zip properties
Name
Type
Description
Name of the zip file
constant Mode the zip file was opened with (Zip.READ, Zip.WRITE or Zip.APPEND)
Detailed Description
The Zip class provides functions to enable you to read, write and create zip files. The following simple example shows
how to write a zip file and then read it again:
Message("Creating zip file");
var z = new Zip("C:/temp/test.zip", Zip.WRITE);
z.AddFile("C:/temp/bpost.key",
"bpost/bpost.key");
z.AddFile("C:/temp/door.key",
"door/door.key");
z.AddFile("C:/temp/barrier.key", "other.key");
z.Close();
Message("Done");
var entry = 0;
Message("Reading zip file");
var z = new Zip("C:/temp/test.zip", Zip.READ);
while (true)
{
entry++;
Message("Entry "+entry);
var info = z.Information();
for (var x in info)
Message("
"+x+"="+info[x]);
z.ReadFile(entry+".txt");
if (!z.Next()) break;
}
z.Close();
Message("Done")
238
March 2016
Zip class
Constructor
new Zip(filename[string], mode[constant])
Description
Create a new Zip object for reading/writing zip files.
Arguments
Name
Type
filename string
mode
Description
Filename of the zip file you want to read/write. If reading (Zip.READ) or appending
(Zip.APPEND), the file must exist. If writing (Zip.WRITE) the file will be overwritten (if it
exists).
constant The mode to open the file with. Can be Zip.READ, Zip.WRITE or Zip.APPEND.
Return type
Zip object
Example
To create a new Zip object to read Zip file "/data/test/file.zip"
var p = new Zip("/data/test/file.zip");
Details of functions
AddFile(filename[string], zipname[string])
Description
Add a file to the Zip file
Arguments
Name
Type Description
filename string Name of the file you want to add to the zip file
zipname string Name to give the file in the zip file
Return type
No return value
Example
To add file C:/temp/test.key to Zip file z with zip name test.key:
z.AddFile(C:/temp/test.key, test.key);
Close()
Description
Close a Zip file
Arguments
No arguments
March 2016
239
Zip class
Return type
No return value
Example
To close Zip file z:
z.Close();
Information()
Description
Gets information for the current entry in the Zip file such as name, size etc
Arguments
No arguments
Return type
object containing information
Example
To get the information:
var info = z.Information();
for (var x in info) Println(x + = + info[x]);
Next()
Description
Go to the next entry in the Zip file
Arguments
No arguments
Return type
true if there is a next entry, false if there are no more entries
Example
To go to the next entry in zip file z:
var next = z.Next();
ReadFile(filename[string])
Description
Reads the current entry to a file from the Zip file
Arguments
Name
Type Description
240
March 2016
Zip class
Return type
No return value
Example
To read the current entry in Zip file z to a file test.key:
z.ReadFile(test.key);
March 2016
241