Oasys.PRIMER.Include class

Constants

Include.COPY_INTO_CURRENT

Copied elements are put into the current layer. See also Options.copy_target_include

Include.COPY_INTO_SOURCE

Copied elements are put into the include of the original element. See also Options.copy_target_include

Include.MASTER_ONLY

Only write the master file. See also Model.Write()

Include.MERGE

Merge include files into the master file. See also Model.Write()

Include.NOT_WRITTEN

Prevent include files from being written. See also Model.Write()

Include.SAME_DIR

Write master and include files into the same directory. See also Model.Write()

Include.SELECT

Select include files to be written out. See also Model.Write()

Include.SUBDIR

Write include files to subdirectory. See also Model.Write()

Directory separators

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()

Pathnames

Include.ABSOLUTE

Write include file with absolute pathname. See also Model.Write()

Include.RELATIVE

Write include file with relative pathname. See also Model.Write()

Transformation offsets

Include.ENDOFF

Offset applied to PRIMER post end keywords (Dummy, Mechanism etc.)

Include.IDDOFF

Offset to define ID (used in Include.SetTransformOffset() )

Include.IDEOFF

Offset to element ID (used in Include.SetTransformOffset() )

Include.IDFOFF

Offset to function and table ID (used in Include.SetTransformOffset() )

Include.IDMOFF

Offset to material ID (used in Include.SetTransformOffset() )

Include.IDNOFF

Offset to node ID (used in Include.SetTransformOffset() )

Include.IDPOFF

Offset to part ID (used in Include.SetTransformOffset() )

Include.IDROFF

Offset to other ID (used in Include.SetTransformOffset() )

Include.IDSOFF

Offset to set ID (used in Include.SetTransformOffset() )

compress mode

Include.INDIVIDUAL_GZIP

Each file ‘name.key’ is ‘gzipped’ to become the individual file ‘name.key.gz’

Include.INDIVIDUAL_ZIP

Each file ‘name.key’ is ‘zipped’ to become the individual file ‘name.key.zip’

Include.KEEP_ORIGINAL

Each file ‘name.key’ is written using its original compression: uncompressed, ‘.gz. or ‘.zip’ format

Properties

property Include.comments: string

Comments stored at the top of the include file. Note that this property is not supported for master include file

property Include.fctchg: float

Electric charge transformation factor. Note that this property is not supported for master include file

property Include.fctlen: float

Length transformation factor. Note that this property is not supported for master include file

property Include.fctmas: float

Mass transformation factor. Note that this property is not supported for master include file

property Include.fcttem: string

Temperature transformation factor. Note that this property is not supported for master include file

property Include.fcttim: float

Time transformation factor. Note that this property is not supported for master include file

property Include.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

property Include.genmax: integer

Include maximum label range value for general items

property Include.genmin: integer

Include minimum label range value for general items

property Include.iddoff(read only): integer

Offset to define ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.ideoff(read only): integer

Offset to element ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.idfoff(read only): integer

Offset to function and table ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.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

property Include.idnoff(read only): integer

Offset to node ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.idpoff(read only): integer

Offset to part, nodal rigid body and constrained node set ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.idroff(read only): integer

Offset to other ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.idsoff(read only): integer

Offset to set ID. To set property use Include.SetTransformOffset(). Note that this property is not supported for master include file

property Include.incout: integer

Create file containing transformed data. Note that this property is not supported for master include file

property Include.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

property Include.model: integer

The Model number that the include is in

property Include.n_locked_range: integer

Number of locked label ranges. Note that this does not include label ranges locked model-wide (ALL includes)

property Include.name: string

The filename for this include file excluding any path. Note that this property is not supported for master include file. Also see the file and path properties

property Include.nelmax: integer

Include maximum label range value for nodes/elements/nrbc/const. spotwelds/define HWA items

property Include.nelmin: integer

Include minimum label range value for nodes/elements/nrbc/const. spotwelds/define HWA items

property Include.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

property Include.path: string

The path for this include file. Note that this property is not supported for master include file. Also see the file and name properties

property Include.suppressed: boolean

If keyout of Include file has been suppressed. Note that this property is not supported for master include file

property Include.tranid: integer

Define transformation number. Note that this property is not supported for master include file

property Include.transform: boolean

true if this include file is an *INCLUDE_TRANSFORM, false otherwise. Note that this property is not supported for master include file

Constructor

classmethod Include(model, name, parent=Oasys.gRPC.defaultArg)

Create a new Include object

Parameters:
  • model (Model) – Model that include will be created in

  • name (string) – Include filename

  • parent (integer) – Optional. Parent include file number. If omitted parent will be 0 (main file)

Returns:

Include object

Return type:

dict

Example

To create a new include file /path/to/include.key in model m

i = Oasys.PRIMER.Include(m, "/path/to/include.key")

Static methods

classmethod Include.BlankAll(model, redraw=Oasys.gRPC.defaultArg, masterinclude=Oasys.gRPC.defaultArg)

Blanks all of the includes in the model

Parameters:
  • model (Model) – Model that all includes will be blanked in

  • redraw (boolean) – Optional. 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 (boolean) – Optional. If masterInclude file should be blanked or not. If omitted masterInclude is false. The master file is include file number 0

Returns:

No return value

Return type:

None

Example

To blank all of the includes in model m:

Oasys.PRIMER.Include.BlankAll(m)
classmethod Include.BlankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Blanks all of the flagged include files in the model

Parameters:
  • model (Model) – Model that all the flagged includes will be blanked in

  • flag (Flag) – Flag set on the includes that you want to blank

  • redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To blank all of the include files in model m flagged with f:

Oasys.PRIMER.Include.BlankFlagged(m, f)
classmethod Include.First(model)

Returns the first include file in the model

Parameters:

model (Model) – Model to get first include in

Returns:

Include object (or None if there are no includes in the model)

Return type:

Include

Example

To get the first include in model m:

i = Oasys.PRIMER.Include.First(m)
classmethod Include.FlagAll(model, flag, masterinclude=Oasys.gRPC.defaultArg)

Flags all of the includes in the model with a defined flag

Parameters:
  • model (Model) – Model that all includes will be flagged in

  • flag (Flag) – Flag to set on the includes

  • masterinclude (boolean) – Optional. If masterInclude file should be flagged or not. If omitted masterInclude is false. The master file is include file number 0

Returns:

No return value

Return type:

None

Example

To flag all of the includes with flag f in model m:

Oasys.PRIMER.Include.FlagAll(m, f)
classmethod Include.GetAll(model, masterinclude=Oasys.gRPC.defaultArg)

Returns a list of Include objects for all of the includes in a model in PRIMER

Parameters:
  • model (Model) – Model to get includes from

  • masterinclude (boolean) – Optional. If masterInclude file should be included or not. If omitted masterInclude is false. The master file is include file number 0

Returns:

List of Include objects

Return type:

list

Example

To make a list of Include objects for all of the includes in model m

i = Oasys.PRIMER.Include.GetAll(m)
classmethod Include.GetFromID(model, include_number)

Returns the Include object for an include label.
Note that items that are in the main keyword file will have a layer value of 0 which can be used as the include number argument to this function to return master include file

Parameters:
  • model (Model) – Model to find the include in

  • include_number (integer) – number of the include you want the Include object for

Returns:

Include object (or None if include does not exist)

Return type:

Include

Example

To get the Include object for include 10 in model m

i = Oasys.PRIMER.Include.GetFromID(m, 10)
classmethod Include.Last(model)

Returns the last include file in the model

Parameters:

model (Model) – Model to get last include in

Returns:

Include object (or None if there are no includes in the model)

Return type:

Include

Example

To get the last include in model m:

i = Oasys.PRIMER.Include.Last(m)
classmethod Include.Pick(prompt, limit=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg, button_text=Oasys.gRPC.defaultArg)

Allows the user to pick an include

Parameters:
  • prompt (string) – Text to display as a prompt to the user

  • limit (Model or Flag) – Optional. If the argument is a Model then only includes from that model can be picked. If the argument is a Flag then only includes that are flagged with limit can be selected. If omitted, or None, any includes from any model can be selected. from any model

  • modal (boolean) – Optional. 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 (string) – Optional. By default the window with the prompt will have a button labelled ‘Cancel’ which if pressed will cancel the pick and return None. If you want to change the text on the button use this argument. If omitted ‘Cancel’ will be used

Returns:

Include object (or None if not picked)

Return type:

dict

Example

To pick an includee from model m giving the prompt ‘Pick include from screen’:

i = Oasys.PRIMER.Include.Pick('Pick include from screen', m)
classmethod Include.Select(flag, prompt, model=Oasys.gRPC.defaultArg, modal=Oasys.gRPC.defaultArg)

Allows the user to select includes using standard PRIMER object menus

Parameters:
  • flag (Flag) – Flag to use when selecting includes

  • prompt (string) – Text to display as a prompt to the user

  • model (Model) – Optional. Model to select from

  • modal (boolean) – Optional. 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

Returns:

Number of items selected or None if menu cancelled

Return type:

int

Example

To select an include from model m, flagging those selected with flag f, giving the prompt ‘Select include’:

Oasys.PRIMER.Include.Select(f, 'Select include', m)
classmethod Include.Total(model)

Returns the total number of include files in the model

Parameters:

model (Model) – Model to get include total from

Returns:

integer

Return type:

int

Example

To get the number of include files in model m:

t = Oasys.PRIMER.Include.Total(m)
classmethod Include.UnblankAll(model, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the includes in the model

Parameters:
  • model (Model) – Model that all includes will be unblanked in

  • redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To unblank all of the includes in model m:

Oasys.PRIMER.Include.UnblankAll(m)
classmethod Include.UnblankFlagged(model, flag, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the flagged include files in the model

Parameters:
  • model (Model) – Model that all the flagged includes will be unblanked in

  • flag (Flag) – Flag set on the includes that you want to unblank

  • redraw (boolean) – Optional. 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()

Returns:

No return value

Return type:

None

Example

To unblank all of the include files in model m flagged with f:

Oasys.PRIMER.Include.UnblankFlagged(m, f)
classmethod Include.UnflagAll(model, flag)

Unsets a defined flag on all of the includes in the model

Parameters:
  • model (Model) – Model that the defined flag for all includes will be unset in

  • flag (Flag) – Flag to unset on the includes

Returns:

No return value

Return type:

None

Example

To unset the flag f on all of the includes in model m:

Oasys.PRIMER.Include.UnflagAll(m, f)

Instance methods

Include.ClearFlag(flag, clear_contents=Oasys.gRPC.defaultArg)

Clears a flag on the include

Parameters:
  • flag (Flag) – Flag to clear on the include

  • clear_contents (boolean) – Optional. 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

Returns:

Number of item flags cleared

Return type:

int

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:

ncleared = i.ClearFlag(f, True)
Include.Flagged(flag)

Checks if the include is flagged or not

Parameters:

flag (Flag) – Flag to test on the include

Returns:

True if flagged, False if not

Return type:

bool

Example

To check if include i has flag f set on it:

i.Flagged(f) )
Include.GetDetailedRange(type_argument)

Gets detailed min and max label ranges for specified type from the include

Parameters:

type_argument (string) – Entity type for which ranges are returned

Returns:

A list containing the min and max label ranges for the specified type or None if no range defined for this type

Return type:

list

Example

To get node ranges for include i:

ranges = i.GetDetailedRange("NODE")
min = ranges[0]
max = ranges[1]
Include.GetLockedLabelData(rangenum)

Returns the locked label data for include files. Also see the n_locked_range property

Parameters:

rangenum (integer) – The range number you want the data for; includes can have multiple ranges. Note that range numbers start at 0, not 1

Returns:

A list containing the include name (string can also be “ALL” if range is applicable model-wide), start (min) label (integer), end (max) label (integer), safe range (0 or 1 for False or True), and entity type (string)

Return type:

list

Example

To get the locked label data for the 3rd range for include i:

if i.n_locked_range >= 3:
    locked_label_data = i.GetLockedLabelData(2)
Include.IsEmpty()

Returns true if include is Empty (contains no INSTALLED static/sort/kid/include items)

Returns:

logical

Return type:

bool

Example

To see if include inc is empty

inc.Empty())
Include.Keyword()

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

Returns:

string containing the keyword

Return type:

str

Example

To get the keyword for include i:

key = i.Keyword()
Include.KeywordCards()

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

Returns:

string containing the cards

Return type:

str

Example

To get the cards for include i:

cards = i.KeywordCards()
Include.MakeCurrentLayer()

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

Returns:

No return value

Return type:

None

Example

To make include i the current layer:

i.MakeCurrentLayer()
Include.Modified(listing)

Returns true if include has been modified

Parameters:

listing (boolean) – false for no listing output, true for listing output

Returns:

logical

Return type:

bool

Example

To see if include inc is modified

inc.Modified(False)) ... (no listing output)
Include.Next()

Returns the next include in the model. Note that this function is not supported for the master include file

Returns:

Include object (or None if there are no more includes in the model)

Return type:

Include

Example

To get the include in model m after include i:

i = i.Next()
Include.Previous()

Returns the previous include in the model. Note that this function is not supported for the master include file

Returns:

Include object (or None if there are no more includes in the model)

Return type:

Include

Example

To get the include in model m before include i:

i = i.Previous()
Include.RemoveLockedLabelData(rangenum)

Removes the locked label data for a range in include files. Also see the n_locked_range property

Parameters:

rangenum (integer) – The locked label range you want to remove. Note that range numbers start at 0, not 1

Returns:

No return value

Return type:

None

Example

To remove the locked labels for the 3rd range for include i:

i.RemoveLockedLabelData(2)
Include.SetDetailedRange(type_argument, min_label, max_label)

Sets detailed min and max label ranges for specified type on the include

Parameters:
  • type_argument (string) – Entity type for which ranges are to be defined

  • min_label (integer) – Defines the smallest label for entities of this type

  • max_label (integer) – Defines the largest label for entities of this type

Returns:

No return value

Return type:

None

Example

To set node ranges for include i:

i.SetDetailedRange("NODE", 50000, 60000)
Include.SetFlag(flag, flag_contents=Oasys.gRPC.defaultArg)

Sets a flag on the include

Parameters:
  • flag (Flag) – Flag to set on the include

  • flag_contents (boolean) – Optional. If true then the items in the include file will also be flagged. If false (default) then the include file contents are not flagged

Returns:

Number of items flagged

Return type:

int

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:

nflagged = i.SetFlag(f, True)
Include.SetLockedLabelData(rangenum, min, max, type, safe=Oasys.gRPC.defaultArg, all_includes=Oasys.gRPC.defaultArg)

Sets the locked label data for a particular range for an include file. Also see the n_locked_range property

Parameters:
  • rangenum (integer) – The range you want to set the data for. Note that range numbers start at 0, not 1

  • min (integer) – Start (min) label for a locked range

  • max (integer) – End (max) label for a locked range

  • type (string) – Entity type code - “NODE”, “SHELL” etc. Can also be “ALL” (for a list of types see Appendix I of the PRIMER manual)

  • safe (boolean) – Optional. Determines whether a locked range is safe (protected)

  • all_includes (boolean) – Optional. Specified range will be set model-wide (all includes). Only useful when working with the ‘master’ include

Returns:

No return value

Return type:

None

Example

To set the locked label data for the 3rd range with min 99, max 199, for nodes for include i:

i.SetLockedLabelData(3, 99, 199, "NODE")
Include.SetTransformOffset(offset, value, check_only=Oasys.gRPC.defaultArg)

Sets offset values for include transform. This function is required to change the offset values rather than changing the properties directly so that the include can be checked to ensure that the new value does not cause any label clashes with existing items or any negative labels when the transform is unapplied when writing the include. Note that this function is not supported for the master include file

Parameters:
  • offset (constant) – The include transform offset type to change. Can be Include.IDNOFF, Include.IDEOFF, Include.IDPOFF, Include.IDMOFF, Include.IDSOFF, Include.IDFOFF, Include.IDDOFF or Include.IDROFF

  • value (integer) – The value to change the offset to

  • check_only (boolean) – Optional. Sometimes it may be necessary to check if changing an offset for an include will cause an error or label clash rather than actually changing it. If check only is true then PRIMER will just check to see if the new value for the offset will cause any label clashes or negative labels and not change the offset value or any item labels. If false or omitted then the offset and labels will be updated if there are no errors

Returns:

logical, True if change successful. False if the change would cause a clash of labels or negative labels, in which case the value is not changed

Return type:

bool

Example

To set idpoff for include i to 1000, checking that the change is successful:

success = i.SetTransformOffset(Oasys.PRIMER.Include.IDPOFF, 1000)
Include.Write(filename, options=Oasys.gRPC.defaultArg)

Writes an include file. Note that this function is not supported for the master include file

Parameters:
  • filename (string) – Filename of the LS-Dyna keyword file you want to write

  • options (dict) –

    Optional. Options specifying how the file should be written out. If omitted the default values below will be used. The properties available are:

    binary (optional):

    (boolean) If true then the output file will be written out in binary. If false (default) then an ascii file will be written

    compress (optional):

    (boolean) If true then the output file will be compressed. If false (default) then an uncompressed file will be written

    compressLevel (optional):

    (integer) Compression level for .gz and .zip files. Must be in the range 1 to 9 with 1 being the least compression (fastest speed) to 9 being the greatest compression (slowest speed)

    compressMode (optional):

    (integer) This option can be used to specify the mode of compression. Can be Include.KEEP_ORIGINAL or Include.INDIVIDUAL_GZIP or Include.INDIVIDUAL_ZIP

    fileStartAscii (optional):

    (boolean) If true then the begining of the file (*CONTROL etc) file is written out in ascii. If false (default) then the entire file is converted to binary.

    i10 (optional):

    (boolean) If true then i10 format will be used to write the file. If false (default) then the normal LS-DYNA format will be used

    large (optional):

    (boolean) If true then large format will be used to write the file. If false (default) then the normal LS-DYNA format will be used. Note that large format is only available from version R7.1 and above

    path (optional):

    (integer) The method used to write include paths. Can be Include.ABSOLUTE (default) or Include.RELATIVE

    separator (optional):

    (integer) The directory separator used when writing include files. Can be Include.NATIVE (default), Include.UNIX or Include.WINDOWS

    version (optional):

    (string) The 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

Returns:

No return value

Return type:

None

Example

To Write include i to file /data/test/file.key as a compressed gzip in version R10.0

output_dict = dict()
output_dict["version"] = "R10.0"
output_dict["compress"] = True
output_dict["compressMode"] = Oasys.PRIMER.Include.INDIVIDUAL_GZIP
i.Write("/data/test/file.key", output_dict)