Oasys.PRIMER.Workflow class

Constants

UnitSystem

Workflow.UNIT_SYSTEM_NONE

No unit system

Workflow.UNIT_SYSTEM_U1

U1 unit system (m, kg, s)

Workflow.UNIT_SYSTEM_U2

U2 unit system (mm, t, s)

Workflow.UNIT_SYSTEM_U3

U3 unit system (mm, kg, ms)

Workflow.UNIT_SYSTEM_U4

U4 unit system (mm, g, ms)

Workflow.UNIT_SYSTEM_U5

U5 unit system (ft, slug, s)

Workflow.UNIT_SYSTEM_U6

U6 unit system (m, t, s)

Static methods

classmethod Workflow.ModelIdFromIndex(model_index, workflow_name=Oasys.gRPC.defaultArg)

Returns the id of a model that has data for the selected workflow by index (starting at 0)

Parameters:
  • model_index (integer) – The index of the model to return the id for

  • workflow_name (string) – Optional. If defined the id of the model that has data for the named workflow is returned. If it is not specified it uses the name of the workflow selected by the user from the workflow menu

Returns:

integer

Return type:

int

Example

To get the id of the first model that has data for the workflow selected by the user

id = Oasys.PRIMER.Workflow.ModelIdFromIndex(0)

To get the id of the first model that has data for the specified workflow “Automotive Assessment”

id = Oasys.PRIMER.Workflow.ModelIdFromIndex(0, "Automotive Assessment")
classmethod Workflow.ModelUnitSystemFromIndex(model_index, workflow_name=Oasys.gRPC.defaultArg)

Returns the unit system of a model that has data for the selected workflow by index (starting at 0). Will be Workflow.UNIT_SYSTEM_NONE or Workflow.UNIT_SYSTEM_U1 or Workflow.UNIT_SYSTEM_U2 or Workflow.UNIT_SYSTEM_U3 or Workflow.UNIT_SYSTEM_U4 or Workflow.UNIT_SYSTEM_U5 or Workflow.UNIT_SYSTEM_U6

Parameters:
  • model_index (integer) – The index of the model to return the unit system for

  • workflow_name (string) – Optional. The workflow name to return the unit system for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the first workflow unit system associated with the model is returned (this is the ‘normal’ case where a user launches a workflow from the workflow menu)

Returns:

integer

Return type:

int

Example

To get the unit system of the first model that has data for the workflow selected by the user

unit_system = Oasys.PRIMER.Workflow.ModelUnitSystemFromIndex(0)

To get the unit system of the second model that has data for the “Automotive Assessment” workflow

unit_system = Oasys.PRIMER.Workflow.ModelUnitSystemFromIndex(1, "Automotive Assessment")
classmethod Workflow.ModelUserDataBuildFromIndex(model_index, workflow_name=Oasys.gRPC.defaultArg)

Returns the build number of the program that was used to write out the user data of a model for the selected workflow by index (starting at 0)

Parameters:
  • model_index (integer) – The index of the model to return the program build number for

  • workflow_name (string) – Optional. The workflow name to return the build number for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the build number for the first user data associated with the model is returned (this is the ‘normal’ case where a user launches a workflow from the workflow menu)

Example

To get the build number of the program that was used to write user data for the first model that has data for the workflow selected by the user

build = Oasys.PRIMER.Workflow.ModelUserDataBuildFromIndex(0)

To get the build number of the program that was used to write user data for the second model that has data for the “Automotive Assessment” workflow

build = Oasys.PRIMER.Workflow.ModelUserDataBuildFromIndex(1, "Automotive Assessment")
classmethod Workflow.ModelUserDataFromIndex(model_index, workflow_name=Oasys.gRPC.defaultArg)

Returns the user data associated with a model that has data for the selected workflow by index (starting at 0)

Parameters:
  • model_index (integer) – The index of the model to return the user data for

  • workflow_name (string) – Optional. The workflow name to return the user data for. If it is not specified it uses the name of the workflow selected by the user from the workflow menu

Returns:

Dict

Return type:

dict

Example

To get the user data for the first model that has data for the workflow selected by the user

user_data = Oasys.PRIMER.Workflow.ModelUserDataFromIndex(0)

To get the user data for the second model that has data for the “Automotive Assessment” workflow

user_data = Oasys.PRIMER.Workflow.ModelUserDataFromIndex(1, "Automotive Assessment")
classmethod Workflow.ModelUserDataProgramFromIndex(model_index, workflow_name=Oasys.gRPC.defaultArg)

Returns the name of the program that was used to write out the user data of a model for the selected workflow by index (starting at 0)

Parameters:
  • model_index (integer) – The index of the model to return the program name for

  • workflow_name (string) – Optional. The workflow name to return the program name for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the program name for the first user data associated with the model is returned (this is the ‘normal’ case where a user launches a workflow from the workflow menu)

Returns:

string

Return type:

str

Example

To get the name of the program that was used to write user data for the first model that has data for the workflow selected by the user

program = Oasys.PRIMER.Workflow.ModelUserDataProgramFromIndex(0)

To get the name of the program that was used to write user data for the second model that has data for the “Automotive Assessment” workflow

program = Oasys.PRIMER.Workflow.ModelUserDataProgramFromIndex(1, "Automotive Assessment")
classmethod Workflow.ModelUserDataVersionFromIndex(model_index, workflow_name=Oasys.gRPC.defaultArg)

Returns the version of the program that was used to write out the user data of a model for the selected workflow by index (starting at 0)

Parameters:
  • model_index (integer) – The index of the model to return the program version for

  • workflow_name (string) – Optional. The workflow name to return the version for. This is required when a PRIMER item is generated from REPORTER. If it is not specified the version for the first user data associated with the model is returned (this is the ‘normal’ case where a user launches a workflow from the workflow menu)

Example

To get the version of the program that was used to write user data for the first model that has data for the workflow selected by the user

version = Oasys.PRIMER.Workflow.ModelUserDataVersionFromIndex(0)

To get the version of the program that was used to write user data for the second model that has data for the “Automotive Assessment” workflow

version = Oasys.PRIMER.Workflow.ModelUserDataVersionFromIndex(1, "Automotive Assessment")
classmethod Workflow.NumberOfModels(workflow_name=Oasys.gRPC.defaultArg)

Returns the number of models that have data for the workflow selected by the user

Parameters:

workflow_name (string) – Optional. If defined the number of models that have data for the named workflow is returned. If not defined the number of models that have data for the workflow selected by the user on the workflow menu is returned

Returns:

integer

Return type:

int

Example

To get the number of models that have data

n = Oasys.PRIMER.Workflow.NumberOfModels()
classmethod Workflow.Refresh()

Scan for fresh workflow data

Returns:

No return value

Return type:

None

Example

Oasys.PRIMER.Workflow.Refresh()
classmethod Workflow.WorkflowDefinitionFilename(workflow_name=Oasys.gRPC.defaultArg)

Returns the workflow definition filename

Parameters:

workflow_name (string) – Optional. The workflow name to return the workflow defintion filename for. If it is not specified it uses the name of the workflow selected by the user from the workflow menu

Returns:

string

Return type:

str

Example

To get the worklow definition filename that the script has been run with

workflow_definition_filename = Oasys.PRIMER.Workflow.WorkflowDefinitionFilename()
classmethod Workflow.WriteToFile(user_data, output_filename, workflow_definition_filename, extra=Oasys.gRPC.defaultArg)

Writes a workflow to a JSON file. If the file already exists the workflow is added to the file (or updated if it is already in the file)

Parameters:
Returns:

No return value

Return type:

None

Example

To write the file “C:my_workflow.json” with some user data and the contents of the workflow definition file “C:workflowsmy_workflow_definition.json”

user_data = { "part_ids": [1, 2, 10, 100], "node_ids": [12, 23, 24] }
      Oasys.PRIMER.Workflow.WriteToFile(user_data, "C:\\my_workflow.json", "C:\\workflows\\my_workflow_definition.json")
classmethod Workflow.WriteToModel(user_data, model, workflow_definition_filename, extra=Oasys.gRPC.defaultArg)

Writes a workflow to a model (updating it if it already exists)

Parameters:
Returns:

No return value

Return type:

None

Example

To write the workflow to the first model with some user data and the contents of the workflow definition file “C:workflowsmy_workflow_definition.json”

user_data = { "part_ids": [1, 2, 10, 100], "node_ids": [12, 23, 24] }
      m = Oasys.PRIMER.Model.First()
      Oasys.PRIMER.Workflow.WriteToModel(user_data, m, "C:\\workflows\\my_workflow_definition.json")