
Dictionary of Internal Scripting Objects
Internal scripts work with objects internal to NairnFEAMPM. This page documents all possible objects. The section on Object Attributes and Properties explains the meaning of each section defined for each object. The possible objects are as follows:
Object Attributes and Properties
Objects, which are instances of a certain class type, are defined in internal scripts using object names and those names can be used to get object attributes, to get and set object properties, or to target that object with an object command. The features, which are common to all object types, are as follows:
- To-many object lists
- Objects many be connected to a list of other objects. To get one of these lists, use the get command. For example
rdoc.get archs,"archives"
gets a list of MPMArchives in a Results Document (with object namerdoc
) and assigns object namearchs
to the list. The returned result will always be a list and it will be an empty list if the object does not have any of the requested objects. You can check the length of any list with@archs.count
. - To single objects
- Objects may be connected to one type of object. To get one of these objects, use the get command. If any "to-single" object is not found, the get command will return a special None object that can the checked using the ifDef or ifNDef commands or by the class of the returned object.
- Properties and "@" Expressions
- Object properties are strings or numbers related to the object. Each property can be read with an "@" expression, which as a period-delimited list of keys. Each element can be text or a variable name starting in
#
, in which case the element is the value of that variable. For example:#time = @archs.3.time
This example assumesarchs
is a list of MPMArchives and the second element picks one (by 0-based index and the number can be a variable with a number). Finally "time" is the property that is read. Such "@" expressions can be set equal to a variable (as above) or be used within any expression. Properties that are not designated as read only (or "r/o") can be set using the set command.
If the initial object in an "@" expression is a List containing strings or numbers, the expression can extract any one of those items using:#value = @mylist.4
NairnFEAMPM Application
All internal scripts automatically define nfmapp
as the object name for the the main NairnFEAMPM application. This object name can be use by internal scripting commands.
Inheritance
- None
To-many object lists
- commandDocuments : an ordered list of opened Command documents. Item 0 is the front most command document. The list will not include the currently-running script, but may include other scripts (if any are open).
- resultsDocuments : an ordered list of opened Results documents. Item 0 is the front most results document.
To single objects
- frontCommandDocument : the front-most opened Command document not counting the currently-running script.
- frontResultsDocument : the front-most opened Results document
Properties
- class (r/o) : equal to "application"
- name (r/o): Application name will be "NairnFEAMPM" but if current script is being run in NairnFEAMPMViz Java app, the name will change to "NairnFEAMPMViz"
- version (r/o) : The current version number of the application
Supported Object Commands
(return to Object Index)
Document
An opened NairnFEAMPM document. This abstract object is not ever used in scripts. It defines relations, properties, and commands that are shared by Command documents and Results document.
Inheritance
- None
To-many object lists
- None
To single objects
- None
Properties
- name (r/o): The document's file name (or "Untitled" if it has never been saved)
- path (r/o): The document's file path (or "" if it has never been saved)
- folder (r/o) : The document's folder path (or "" if it has never been saved)
Supported Object Commands
- None
(return to Object Index)
Commands Document
Commands document are documents with commands to set up and run MPM and FEA calculations. A common tasks for internal scripts is to automatically run calculations defined by Command documents.
Inheritance
To-many object lists
- None
To single objects
- None
Properties
- class (r/o) : equal to "CommandDocument"
- get.varname (r/o) : FEA and MPM commands documents can read all variables defined in scripts, but any changes made to those variables are not communicated back to the internal script. Furthermore, command documents may define other variables that would be useful to know in a script. Once FEA or MPM commands have been interpreted or run, this propperty can read any variable, where
varname
is the variable to read.
Supported Object Commands
(return to Object Index)
Results Document
Results documents have the output from FEA or MPM calculations. Scripts common run calculations and then extract simulations results from Results documents.p
Inheritance
To-many object lists
- arhives : a list of MPM archives for the document
To single objects
- None
Properties
- class (r/o) : equal to "ReultsDocument"
- energy (r/o) : Returns the total strain energy in the document (assuming the output file contains the strain energy results). It is a common quantity to read when doing script control of FEA calculations.
- section.sectionName (r/o) : Returns the entire text to the section titled
sectionName
, which must be a string, a quoted string, or a string variable. The section names are the complete, case-sensitive text of the sections listed on the top left index of a results document. Hint: the text read from a section can be parsed usingLines
andWords
commands and string expressions.
Supported Object Commands
(return to Object Index)
MPM Archive
Information on one MPM archive file for the current Results document.
Inheritance
- None
To-many object lists
- None
To single objects
- None
Properties
- class (r/o) : equal to "MPMAchive".
- filename (r/o) : full path name to the archive file.
- time (r/o) : the time for the archive.
- step (r/o): the step number of the archive.
Supported Object Commands
- None
(return to Object Index)
List
This class lets a script create a list that can contain objects or strings (see CreateList command). Various commands are available to work with the list members. Also, all "to-many" object attributes of other classes return this type of list.
Inheritance
- None
To-many object lists
- None
To single objects
- None
Properties
- class (r/o) : equal to "list"
- count (r/o) : number of elements in the list. When using the get command, lists are numbered starting from zero and the last element is at index
count-1
.
Supported Object Commands
(return to Object Index)
Dictionary
This class lets a script create a dictionary that contains key-value pairs. Various commands are available to work with the keys and values.
Inheritance
- None
To-many object lists
- allkeys : A list of all keys in the dictionary (in no particular order; to order them, see next two relations).
- keysSortedByNumericValues : A list of all keys sorted by their numeric values. Keys that are not numbers sort to the end in random order.
- keysSortedByStringValues : A list of all keys sorted by their string values. Keys that do not have a string value are sorted to the end in random order.
- allValues : A list of all values in the dictionary.
To single objects
- None
Properties
- class (r/o) : equal to "dictionary"
- count (r/o) : number of key-value pairs in the dictionary.
Supported Object Commands
(return to Object Index)
None
This object is returned by any "To-One" object attribute that does not have that connection and by several other commands when an object cannot be found. If objName
is a "None" type object, the conditional ifDef objName is false and the conditional ifNDef objName is true. Alternatively, you can check for "None" type object by seeing if @objName.class
is equal to "none".
Inheritance
- None
To-many object lists
- None
To single objects
- None
Properties
- class : equal to "none"
Supported Object Commands
- None
(return to Object Index)