Oasys.PRIMER.Model class

Constants

compress mode

Model.INDIVIDUAL_GZIP

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

Model.INDIVIDUAL_ZIP

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

Model.KEEP_ORIGINAL

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

Model.PACKAGED_ZIP

Suitable for models with include files where the entire model is packed into a single .zip file, preserving its directory structure

compress switch

Model.COMPRESS_KEEP

Keeps the keyout compression format same as that of what was read in

Model.COMPRESS_OFF

Switches off compression during keyout

Model.COMPRESS_ON

Switches on compression during keyout

filetype

Model.ABAQUS

ABAQUS input file

Model.IGES

IGES 5.3 geometry file

Model.LSDYNA

LS-DYNA keyword file

Model.NASTRAN

NASTRAN bulk data file

Model.RADIOSS

RADIOSS block format file

include deletion

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

mass_properties_calculation

Model.CENTRE_AT_COFG

Uses the centre at centre of gravity in calculation of inertia properties

Model.GLOBAL_AXES

GLOBAL AXES

Model.LOCAL_AXES

LOCAL AXES

Model.PRINCIPAL_AXES

PRINCIPAL AXES

Model.USER_DEFINED_CENTRE

Uses the user defined centre in calculation of inertia properties

merge

Model.DISCARD_PRIMARY_CLASH

Merge option - discard primary items only on clash

Model.DISCARD_SECONDARY_CLASH

Merge option - discard secondary items only on clash

Model.INCREASE_PRIMARY_ALWAYS

Merge option - increase primary items always

Model.INCREASE_PRIMARY_CLASH

Merge option - increase primary items only on clash

Model.INCREASE_SECONDARY_ALWAYS

Merge option - increase secondary items always

Model.INCREASE_SECONDARY_CLASH

Merge option - increase secondary items only on clash

renumber

Model.IGNORE_CLASH

Renumber option - Ignore clashes

Model.MOVE_CLASH_UP

Renumber option - Move clashing > highest label

Model.RENUMBER_TO_FREE

Renumber option - Renumber to next free label

Model.SHIFT_ALL_UP

Renumber option - Shift upwards to make space

write hook

Model.WRITE_DIALOGUE

Flag that triggers the write hook script from the dialogue box

Model.WRITE_INCLUDE_TREE

Flag that triggers the write hook script from the include file tree

Model.WRITE_MODEL

Flag that triggers the write hook script from the model tab

Model.WRITE_SELECT_INCLUDES

Flag that triggers the write hook script from the select include files panel

Class properties

class property Model.highest(read only): integer

The highest model number present in PRIMER

Properties

property Model.binary(read only): boolean

If model is in binary then it will be 1(true) else 0(false)

property Model.comments: string

Comments stored at the top of the primary model file

property Model.compress(read only): boolean

If model is compressed then it will be 1(true) else 0(false)

property Model.compressMode(read only): integer

This option can be used to know the mode of compression. Can be Model.INDIVIDUAL_GZIP or Model.INDIVIDUAL_ZIP or Model.PACKAGED_ZIP

property Model.control(read only): Control dictionary

Control cards for model. See Control for more details

property Model.damping(read only): Damping dictionary

Damping cards for model. See Damping for more details

property Model.database(read only): Database dictionary

Database cards for model. See Database for more details

property Model.fileStartAscii(read only): boolean

If the beginning of the master file (*CONTROL etc) is in ascii then 1(true) else 0(false)(NOTE: If master file is ascii then fileStartAscii won’t be checked and show 0(false))

property Model.filename(read only): string

Name of file that model was read from (blank if model created)

property Model.id: boolean

If ID flag set for *KEYWORD card

property Model.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()

property Model.loadBody(read only): LoadBody dictionary

LoadBody cards for model. See LoadBody for more details

property Model.masterAscii(read only): boolean

If master file is in ascii then 1(true) else 0(false)

property Model.num: string

Model num (for _ID)

property Model.number: integer

Model number

property Model.path(read only): string

Path that model was read from (blank if model created)

property Model.project: string

Model project (for _ID)

property Model.readlog: string

Full path of the readlog file

property Model.stage: string

Model stage (for _ID)

property Model.title: string

Model title

property Model.visible: boolean

Model visibility flag

Constructor

classmethod Model(number=Oasys.gRPC.defaultArg)

Create a new model in PRIMER

Parameters:

number (integer) – Optional. Model number to create. If omitted the next free model number will be used

Returns:

Model object

Return type:

dict

Example

To create a new model

m = Oasys.PRIMER.Model()

To create model 10

m = Oasys.PRIMER.Model(10)

Static methods

classmethod Model.BlankAll()

Blanks all models

Returns:

No return value

Return type:

None

Example

To blank all models

Oasys.PRIMER.Model.BlankAll()
classmethod Model.DeleteAll()

Deletes all existing models from PRIMER

Returns:

No return value

Return type:

None

Example

To delete all models

Oasys.PRIMER.Model.DeleteAll()
classmethod Model.First()

Returns the Model object for the first model in PRIMER (or None if there are no models)

Returns:

Model object

Return type:

Model

Example

To get the Model object for the first model:

m = Oasys.PRIMER.Model.First()
classmethod Model.FirstFreeItemLabel(type, layer=Oasys.gRPC.defaultArg)

Returns the first free label for an item type in the model. Also see Model.LastFreeItemLabel() and Model.NextFreeItemLabel()

Parameters:
  • type (string) – The type of the item (for a list of types see Appendix I of the PRIMER manual)

  • layer (Include number) – Optional. 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)

Returns:

integer

Return type:

int

Example

To get the first free node label in model m:

label = m.FirstFreeItemLabel("NODE")
classmethod Model.GetAll()

Returns a list of Model objects for all the models in PRIMER

Returns:

List of Model objects

Return type:

list

Example

To make a list of Model objects for all of the models in PRIMER

m = Oasys.PRIMER.Model.GetAll()
classmethod Model.GetFromID(model_number)

Returns the Model object for a model ID or None if model does not exist

Parameters:

model_number (integer) – number of the model you want the Model object for

Returns:

Model object

Return type:

Model

Example

To get the Model object for model number 1

m = Oasys.PRIMER.Model.GetFromID(1)
classmethod Model.Last()

Returns the Model object for the last model in PRIMER (or None if there are no models)

Returns:

Model object

Return type:

Model

Example

To get the Model object for the last model:

m = Oasys.PRIMER.Model.Last()
classmethod Model.LastFreeItemLabel(type, layer=Oasys.gRPC.defaultArg)

Returns the last free label for an item type in the model. Also see Model.FirstFreeItemLabel() and Model.NextFreeItemLabel()

Parameters:
  • type (string) – The type of the item (for a list of types see Appendix I of the PRIMER manual)

  • layer (Include number) – Optional. 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

Returns:

integer

Return type:

int

Example

To get the last free node label in model m:

label = m.LastFreeItemLabel("NODE")
classmethod Model.Merge(primary_model, secondary_model, option_to_fix_clashes=Oasys.gRPC.defaultArg, merge_nodes_flag=Oasys.gRPC.defaultArg, dist=Oasys.gRPC.defaultArg, label=Oasys.gRPC.defaultArg, position=Oasys.gRPC.defaultArg)

Merge 2 models together to make a new model

Parameters:
  • primary_model (Model) – Primary Model for merge

  • secondary_model (Model) – Secondary Model for merge

  • option_to_fix_clashes (constant) – Optional. Type of fix. Can be Model.INCREASE_SECONDARY_ALWAYS, Model.INCREASE_SECONDARY_CLASH, Model.DISCARD_SECONDARY_CLASH, Model.INCREASE_PRIMARY_ALWAYS, Model.INCREASE_PRIMARY_CLASH or Model.DISCARD_PRIMARY_CLASH

  • merge_nodes_flag (boolean) – Optional. If this flag is set to true, PRIMER will merge nodes after the model merge

  • dist (float) – Optional. Nodes closer than dist will be potentially merged

  • label (integer) – Optional. 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 (integer) – Optional. 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

Returns:

Model object (or None if the merge is unsuccessful)

Return type:

Model

Example

To merge models m1 and m2 together:

m = Oasys.PRIMER.Model.Merge(m1, m2)
classmethod Model.NextFreeItemLabel(type, layer=Oasys.gRPC.defaultArg)

Returns the next free label for an item type in the model. Also see Model.FirstFreeItemLabel() and Model.LastFreeItemLabel()

Parameters:
  • type (string) – The type of the item (for a list of types see Appendix I of the PRIMER manual)

  • layer (Include number) – Optional. 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)

Returns:

integer

Return type:

int

Example

To get the next free node label in model m:

label = m.NextFreeItemLabel("NODE")
classmethod Model.Read(filename, filetype=Oasys.gRPC.defaultArg, number=Oasys.gRPC.defaultArg)

Reads a file into the first free model in PRIMER

Parameters:
  • filename (string) – Filename you want to read

  • filetype (constant) – Optional. Filetype you want to read. Can be Model.LSDYNA, Model.ABAQUS, Model.NASTRAN, Model.RADIOSS or Model.IGES. If omitted the file is assumed to be a DYNA3D file. For Model.NASTRAN there are options that change how the model is read. See Options for details

  • number (integer) – Optional. Model number to read file into. If omitted the next free model number will be used

Returns:

Model object (or None if error)

Return type:

Model

Example

To read the keyword file /data/test/file.key

Oasys.PRIMER.Model.Read("/data/test/file.key")

To read the NASTRAN file /data/test/file.dat

Oasys.PRIMER.Model.Read("/data/test/file.dat", Oasys.PRIMER.Model.NASTRAN)

To read the keyword file /data/test/file.key into model 10

Oasys.PRIMER.Model.Read("/data/test/file.key", Oasys.PRIMER.Model.LSDYNA, 10)
classmethod Model.Select(prompt, modal=Oasys.gRPC.defaultArg)

Allows the user to select a model using standard PRIMER object menus. If there are no models in memory then Select returns None. If only one model is present then the model object is returned. If there is more than one model in memory then an object menu is mapped allowing the user to choose a model

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

  • 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:

Model object (or None if no models present)

Return type:

Model

Example

To select a model giving the prompt ‘Select model’:

m = Oasys.PRIMER.Model.Select('Select model')
classmethod Model.Total()

Returns the total number of models

Returns:

integer

Return type:

int

Example

To find how many models there are in PRIMER:

num = Oasys.PRIMER.Model.Total()
classmethod Model.UnblankAll()

Unblanks all models

Returns:

No return value

Return type:

None

Example

To unblank all models

Oasys.PRIMER.Model.UnblankAll()

Instance methods

Model.AreaVolumeFlagged(flag)

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

Parameters:

flag (Flag) – Flag set on entities you wish to calculate area/volume for

Returns:

Dict with properties

area:

(real) Area of flagged items

volume:

(real) Volume of flagged items

Return type:

dict

Example

To calculate the area/volume properties of the items flagged by flag f

props = m.AreaVolumeFlagged(f)
area = props["area"]
volume = props["volume"]
Model.Attached(flag, redraw=Oasys.gRPC.defaultArg)

Finds attached items to flagged items. The attached items are flagged with the same flag

Parameters:
  • flag (Flag) – Flag set on items that you want to find attached to

  • redraw (boolean) – Optional. If true, the display will be updated to display only the original flagged items and the attached items

Returns:

No return value

Return type:

None

Example

To find items attached to items flagged with flag f in model m:

m.Attached(f)
Model.Autofix()

Autofix option does a model check and autofixes all the fixable errors in the model

Returns:

No return value

Return type:

None

Example

To autofix fixable errors of the model ‘m’

m.Autofix()
Model.Blank()

Blanks a model in PRIMER

Returns:

No return value

Return type:

None

Example

To blank model object m

m.Blank()
Model.BlankFlagged(flag, redraw=Oasys.gRPC.defaultArg)

Blanks all of the flagged items in the model

Parameters:
  • flag (Flag) – Flag set on items 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 everything in model m flagged with flag f:

m.BlankFlagged(f)
Model.CentreOfGravity()

Returns the centre of gravity for a model

Returns:

A list containing the x, y and z coordinates for the CofG

Return type:

list

Example

To get the centre of gravity for model m:

cofg = m.CentreOfGravity()
x = cofg[0]
y = cofg[1]
z = cofg[2]
Model.Check(filename, detailed=Oasys.gRPC.defaultArg, json=Oasys.gRPC.defaultArg, include=Oasys.gRPC.defaultArg)

Checks a model, writing any errors to file

Parameters:
  • filename (string) – Name of file to write errors to

  • detailed (boolean) – Optional. If set to “true”, detailed error messages are given

  • json (boolean) – Optional. 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. Note that when writing JSON format the labels produced can be strings instead of integers in some rare cases. If you are writing a script to read a JSON file, it must be able to cope with this. Specifically if the item is a character label the label will be a string. For child collect sets the label will be a string of the format ‘X_Y’ where X is the parent set label and Y will be the child set number (1, 2, 3 …). In this case use Set.GetCollectChild() to get the object

  • include (boolean) – Optional. If set, error messages will be written in include by include layout. This option is not applicable if JSON is set

Returns:

No return value

Return type:

None

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)
f = open("errors.json", "r")
jsonn = f.read()
o = json.loads(jsonn)
f.close()
for e in o: #"error" or "warning"
    print(e)
for t in o[e]: #type
    print(" "+t)
for m in o[e][t]: #message
    print(" "+m)
for i in range(len(o[e][t][m])): #List of objects containing label and include
    print(" ", o[e][t][m][i]["label"], " (include ", o[e][t][m][i]["include"], ")")
Model.ClearFlag(flag)

Clears the flagging for a model in PRIMER. See also Model.PropagateFlag(), Model.SetFlag(), global.AllocateFlag() and global.ReturnFlag()

Parameters:

flag (Flag) – Flag to clear

Returns:

No return value

Return type:

None

Example

To clear flag f for everything in model m:

m.ClearFlag(f)
Model.Copy(update=Oasys.gRPC.defaultArg)

Copy model to the next free model in PRIMER

Parameters:

update (boolean) – Optional. If the graphics should be updated after the model is copied. If omitted update will be set to false

Returns:

Model object for new model

Return type:

dict

Example

To copy model m to the next free model in PRIMER

mnew = m.Copy()
Model.CopyFlagged(flag, update=Oasys.gRPC.defaultArg)

Copy flagged items in a model to the next free model in PRIMER

Parameters:
  • flag (Flag) – Flag set on items that you want to copy

  • update (boolean) – Optional. If the graphics should be updated after the model is copied. If omitted update will be set to false

Returns:

Model object for new model

Return type:

dict

Example

To copy everything in model m flagged with flag f to the next free model in PRIMER

mnew = m.CopyFlagged(f)
Model.Delete()

Deletes a model in PRIMER
Do not use the Model object after calling this method

Returns:

No return value

Return type:

None

Example

To delete model m in PRIMER

m.Delete()
Model.DeleteFlagged(flag, recursive=Oasys.gRPC.defaultArg)

Deletes all of the flagged items in the model. Note that this may not actually delete all of the items. For example if a node is flagged but the node is used in a shell which is not flagged then the node will not be deleted

Parameters:
  • flag (Flag) – Flag set on items that you want to delete

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

Returns:

No return value

Return type:

None

Example

To delete everything in model m flagged with flag f:

m.DeleteFlagged(f)
Model.DeleteInclude(_py_class_include___label, method=Oasys.gRPC.defaultArg, force=Oasys.gRPC.defaultArg)

Tries to delete an include file from the model. Note that this may not actually delete the include file. For example if some of the items in the include file are required by other things in different includes then the include file will not be deleted

Parameters:
  • _py_class_include___label (integer) – label of include file that you want to delete

  • method (constant) – Optional. Method for deleting items. Must be Model.REMOVE_FROM_SETS (default), Model.REMOVE_JUNIOR or Model.REMOVE_INCLUDE_ONLY.
    Model.REMOVE_FROM_SETS will only delete items within the include selected but may remove items from sets in other includes.
    Model.REMOVE_JUNIOR may delete items in other includes - this will happen if they ‘belong’ to items in this include and are considered ‘junior’
    Model.REMOVE_INCLUDE_ONLY does the same as Model.REMOVE_FROM_SETS but will not remove items from sets in other includes

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

Returns:

True if include successfully deleted, False otherwise

Return type:

bool

Example

To delete include file number 5 in model m removing items from sets in other includes if required:

m.DeleteInclude(5, 1)
Model.FlagDuplicate(flag)

Flag all nodes referenced in two different includes

Parameters:

flag (Flag) – Flag which will be used to flag the “duplicate” nodes

Returns:

No return value

Return type:

None

Example

To Flag with flag f all the nodes referenced in different includes from model m

m.FlagDuplicate(f)
Model.GetIncludeTransformOffsets()

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

Returns:

Dict with properties

iddoff:

(integer) Offset to define id

ideoff:

(integer) Offset to element id

idfoff:

(integer) Offset to function id

idmoff:

(integer) Offset to material id

idnoff:

(integer) Offset to node id

idpoff:

(integer) Offset to part id

idroff:

(integer) Offset to section, hourglass, EOS id

idsoff:

(integer) Offset to set id

Return type:

dict

Example

To determine offsets for model m and then import an include transform “test.inc”:

o = m.GetIncludeTransformOffsets()
if(o):
    success = m.ImportIncludeTransform("test.inc", o["idnoff"], o["ideoff"], o["idpoff"], o["idmoff"], o["idsoff"], o["idfoff"], o["iddoff"], o["idroff"])
Model.Hide()

Hides a model in PRIMER

Returns:

No return value

Return type:

None

Example

To hide model m in PRIMER

m.Hide()
Model.Import(filename)

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. Note prior to v17 of PRIMER imported data would always be imported to the master model, irrespective of the current layer. From v17 onwards this has been corrected and the current layer is used to determine the destination of imported data

Parameters:

filename (string) – Filename of the LS-DYNA keyword file you want to import

Returns:

0: No errors/warnings.
> 0: This number of errors occurred.
< 0: Absolute number is the number of warnings that occurred

Return type:

int

Example

To import file “test.key” into model m

m.Import("test.key")
Model.ImportInclude(source, target=Oasys.gRPC.defaultArg)

Imports a keyword file or an Include object from different model as a new include or into an existing include file for model m. The labels of any items in the imported include contents that clash with existing labels will automatically be renumbered with one exception. The behaviour for *SET_COLLECT cards can be controlled with Options.merge_set_collect

Parameters:
  • source (String OR Include Object) – Can either be a Filename of the LS-DYNA include file you want to import, OR Include object of another model you want to import

  • target (Include Object) – Optional. Include file object of current model if the Import has to be done in an existing include

Returns:

Include object for include file

Return type:

dict

Example

To import include file “include.key” into model m:

m.ImportInclude("include.key")

To import include file “include.key” into existing include incl in model m:

m.ImportInclude("include.key", incl)

To import include number 5 from model m2 into model m:

incl = Oasys.PRIMER.Include.GetFromID(m2, 5)
m.ImportInclude(incl)
Model.ImportIncludeTransform(filename, idnoff, ideoff, idpoff, idmoff, idsoff, idfoff, iddoff, idroff)

Imports a file as an include transform file for model m. The labels of any items in the include file will be renumbered by idnoff, ideoff etc

Parameters:
  • filename (string) – Filename of the LS-DYNA include file you want to import

  • idnoff (integer) – Offset for nodes in the file

  • ideoff (integer) – Offset for elements in the file

  • idpoff (integer) – Offset for parts in the file

  • idmoff (integer) – Offset for materials in the file

  • idsoff (integer) – Offset for sets in the file

  • idfoff (integer) – Offset for functions and tables in the file

  • iddoff (integer) – Offset for defines in the file

  • idroff (integer) – Offset for other labels in the file

Returns:

Include object if successful, None if not

Return type:

dict

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)
Model.Mass()

Returns the mass for a model

Returns:

float

Return type:

float

Example

To get the mass for model m:

mass = m.Mass()
Model.MassPropCalc(flag)

Calculates the Mass, CoG, and Intertia Tensor of the flagged items and returns an object with the above properties. See Properties for mass properties calculation under options class to configure inclusion of lumped mass, etc

Parameters:

flag (Flag) – Calculate mass propetries of flagged items

Returns:

Dict with properties

cofgx:

(real) X coordinate of centre of gravity

cofgy:

(real) Y coordinate of centre of gravity

cofgz:

(real) Z coordinate of centre of gravity

inerxx:

(real) XX inertia

inerxy:

(real) XY inertia

inerxz:

(real) XZ inertia

ineryy:

(real) YY inertia

ineryz:

(real) YZ inertia

inerzz:

(real) ZZ inertia

mass:

(real) Mass

Return type:

dict

Example

To calculate the mass properties of the items flagged by flag f

props = m.MassPropCalc(f)
Model.MergeNodes(flag, dist, label=Oasys.gRPC.defaultArg, position=Oasys.gRPC.defaultArg)

Attempts to merge nodes on items flagged with flag for this model in PRIMER. Merging nodes on *AIRBAG_SHELL_REFERENCE_GEOMETRY can be controlled by using Options.node_replace_asrg. Also see Node.Merge()

Parameters:
  • flag (Flag) – Flag set on items to merge nodes

  • dist (float) – Nodes closer than dist will be potentially merged

  • label (integer) – Optional. 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 (integer) – Optional. 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

Returns:

The number of nodes merged

Return type:

int

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)
Model.PopulateInitialVelocities()

Populate the initial velocity field (nvels) for all nodes of the model

Returns:

No return value

Return type:

None

Example

m.PopulateInitialVelocities()
Model.PropagateFlag(flag)

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

Parameters:

flag (Flag) – Flag to propagate

Returns:

No return value

Return type:

None

Example

To propagate the flagging in model m for flag f

m.PropagateFlag(f)
Model.RenumberAll(start)

Renumbers all of the items in the model

Parameters:

start (integer) – Start point for renumbering

Returns:

No return value

Return type:

None

Example

To renumber everything in model m, starting at 1000000:

m.RenumberAll(1000000)
Model.RenumberFlagged(flag, start, mode=Oasys.gRPC.defaultArg)

Renumbers all of the flagged items in the model

Parameters:
Returns:

No return value

Return type:

None

Example

To renumber everything in model m flagged with flag f, starting at 1000000, using mode MOVE_CLASH_UP:

m.RenumberFlagged(f, 1000000, Oasys.PRIMER.Model.MOVE_CLASH_UP)
Model.SetColour(colour)

Sets the colour of the model

Parameters:

colour (colour from Colour class) – The colour you want to set the model to

Returns:

No return value

Return type:

None

Example

To set the colour of model m to red:

m.SetColour(Colour.RED)

or

m.SetColour(Colour.RGB(255, 0, 0))
Model.SetFlag(flag)

Sets the flagging for a model in PRIMER. See also Model.PropagateFlag(), Model.ClearFlag(), global.AllocateFlag() and global.ReturnFlag()

Parameters:

flag (Flag) – Flag to set

Returns:

No return value

Return type:

None

Example

To set flag f for everything in model m:

m.SetFlag(f)
Model.Show()

Shows a model in PRIMER

Returns:

No return value

Return type:

None

Example

To show model m in PRIMER

m.Show()
Model.Unblank()

Unblanks a model in PRIMER

Returns:

No return value

Return type:

None

Example

To unblank model m

m.Unblank()
Model.UnblankFlagged(flag, redraw=Oasys.gRPC.defaultArg)

Unblanks all of the flagged items in the model

Parameters:
  • flag (Flag) – Flag set on items 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 everything in model m flagged with flag f:

m.UnblankFlagged(f)
Model.UnsketchAll(redraw=Oasys.gRPC.defaultArg)

Unsketches all of the sketched items in the model

Parameters:

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

Returns:

No return value

Return type:

None

Example

To unsketch all the sketched objects in model m:

m.UnsketchAll()
Model.UpdateGraphics()

Updates the graphics for a model in PRIMER

Returns:

No return value

Return type:

None

Example

To update the graphics for model m

m.UpdateGraphics()
Model.UsesLargeLabels()

Checks to see if a model uses large labels

Returns:

logical, True if model uses large labels, False otherwise

Return type:

bool

Example

To check if model m uses large labels:

large = m.UsesLargeLabels()
Model.Write(filename, options=Oasys.gRPC.defaultArg)

Writes a model in PRIMER to 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 entire output file will be written out in binary, if false then the entire file will be written in ascii. If not defined the default is for each file in the model to be written in its original format, or if this is a newly created model ascii will be used

    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) Only relevant if binary output format has been selected. If true then the beginning 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 original LS-DYNA format in which the file was written will be used, or if this is a newly created model the smallest format which will contain it will be used. Note that large format is only available from version R9 and above. See also the large property

    kbyExt (optional):

    (boolean) If true then a binary format output file will be given the extension .kby, replacing the existing extension

    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

    masterAscii (optional):

    (boolean) Only relevant if binary output format has been selected. If true then the whole master file is written out in ascii. If false (default) then the master file is also converted to binary

    method (optional):

    (integer) The method used to write include files. Can be Include.MASTER_ONLY, Include.MERGE, Include.NOT_WRITTEN, Include.SUBDIR (default) or Include.SAME_DIR

    parametersAsValues (optional):

    (boolean) If true then the underlying values of any parameters will be written when they are used in data fields rather than ‘&name’. If false then ‘&name’ will be written. See also Options.keyout_parameter_values

    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 model m to file /data/test/file.key as a compressed gzip in version R10.0

output_obj = {
    "version": "R10.0",
    "compress": True,
    "compressMode": Oasys.PRIMER.Model.INDIVIDUAL_GZIP
}
m.Write("/data/test/file.key", output_obj)