Oasys.THIS.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.GetWorkflowDataFromPath(folder, workflow_name=Oasys.gRPC.defaultArg)

Returns user data in the specified folder. This will first search for user data in *.json files in the specified folder and upwards in parent folders if there is no user data in the specified folder. The number of folders it will search is controlled by the preference oasys*workflow_max_upward_folder_search_depth. Additionally, if the preference oasys*workflow_user_directory_name is defined it will search in the folder with that name too in the specified folder and parent folders. Secondly, it will search for user data in keyword files in the specified folder

Parameters:
  • folder (string) – The folder to search for user data

  • workflow_name (string) – Optional. The workflow name to return the user data for. If not specified it will return user data for all the workflows found

Returns:

List of dicts with properties

data:

(object) User data as an object

model_unit_system:

(integer) Model unit system associated with the user data

workflow_data_filename:

(string) Filename where workflow data was read from

workflow_definition:

(string) Workflow definition filename

workflow_name:

(string) Workflow name

Return type:

list

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

Returns the id of a model selected by the user by index (starting at 0)

Parameters:
  • model_index (integer) – The index of the model to return the ID for. If the workflow is run from the workflow menu and the name argument is not defined, it is the index in the list of models selected by the user. If the workflow is run from the workflow menu and the name argument is defined, it is the index of the model that has user data for the named workflow, out of the list of models selected by the user. If the workflow is run from REPORTER, it is the index in the list of all the models loaded in the session that have user data for the named workflow

  • workflow_name (string) – Optional. The workflow name to return the model id for. 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 selected by the user

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

To get the id of the second model and workflow name “Automotive Assessment”

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

Returns the unit system of a model selected by the user 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. If the workflow is run from the workflow menu and the name argument is not defined, it is the index in the list of models selected by the user. If the workflow is run from the workflow menu and the name argument is defined, it is the index of the model that has user data for the named workflow, out of the list of models selected by the user. If the workflow is run from REPORTER, it is the index in the list of all the models loaded in the session that have user data for the named workflow

  • workflow_name (string) – Optional. The workflow name to return the unit system for

Returns:

integer

Return type:

int

Example

To get the unit system for the workflow selected from the menu, for the first model selected by the user

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

To get the unit system of the second model and workflow name “Automotive Assessment”

unit_system = Oasys.THIS.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 build number for. If the workflow is run from the workflow menu and the name argument is not defined, it is the index in the list of models selected by the user. If the workflow is run from the workflow menu and the name argument is defined, it is the index of the model that has user data for the named workflow, out of the list of models selected by the user. If the workflow is run from REPORTER, it is the index in the list of all the models loaded in the session that have user data for the named workflow

  • workflow_name (string) – Optional. The workflow name to return the build number for

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.THIS.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.THIS.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. If the workflow is run from the workflow menu and the name argument is not defined, it is the index in the list of models selected by the user. If the workflow is run from the workflow menu and the name argument is defined, it is the index of the model that has user data for the named workflow, out of the list of models selected by the user. If the workflow is run from REPORTER, it is the index in the list of all the models loaded in the session that have user data for the named workflow

  • 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.THIS.Workflow.ModelUserDataFromIndex(0)

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

user_data = Oasys.THIS.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. If the workflow is run from the workflow menu and the name argument is not defined, it is the index in the list of models selected by the user. If the workflow is run from the workflow menu and the name argument is defined, it is the index of the model that has user data for the named workflow, out of the list of models selected by the user. If the workflow is run from REPORTER, it is the index in the list of all the models loaded in the session that have user data for the named workflow

  • workflow_name (string) – Optional. The workflow name to return the program name for

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.THIS.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.THIS.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. If the workflow is run from the workflow menu and the name argument is not defined, it is the index in the list of models selected by the user. If the workflow is run from the workflow menu and the name argument is defined, it is the index of the model that has user data for the named workflow, out of the list of models selected by the user. If the workflow is run from REPORTER, it is the index in the list of all the models loaded in the session that have user data for the named workflow

  • workflow_name (string) – Optional. The workflow name to return the program version for

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.THIS.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.THIS.Workflow.ModelUserDataVersionFromIndex(1, "Automotive Assessment")
classmethod Workflow.NumberOfSelectedModels(workflow_name=Oasys.gRPC.defaultArg)

Returns the number of models selected by the user

Parameters:

workflow_name (string) – Optional. The workflow name to return the number of models for. If it’s not defined the number of models that were selected by the user on the workflow menu is returned. If it’s defined and the workflow was run from the workflow menu, the number of models, out of the models selected by the user, that have data for the named workflow is returned. If it’s defined and the workflow is run from REPORTER, the number of models, out of all the models loaded in the session, that have data for the named workflow is returned

Returns:

integer

Return type:

int

Example

To get the number of models selected by the user in the workflow menu

n = Oasys.THIS.Workflow.NumberOfSelectedModels()

To get the number of models that have user data for the “Automotive Assessment” workflow

n = Oasys.THIS.Workflow.NumberOfSelectedModels("Automotive Assessment")
classmethod Workflow.Refresh()

Scan for fresh workflow data

Returns:

No return value

Return type:

None

Example

Oasys.THIS.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. This is required when a POST item is generated from REPORTER. If it is not specified the first workflow 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 worklow definition filename that the script has been run with

workflow_definition_filename = Oasys.THIS.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")