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.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 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 model id for
- 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
orWorkflow.UNIT_SYSTEM_U1
orWorkflow.UNIT_SYSTEM_U2
orWorkflow.UNIT_SYSTEM_U3
orWorkflow.UNIT_SYSTEM_U4
orWorkflow.UNIT_SYSTEM_U5
orWorkflow.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 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.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 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
- Returns:
Dict
- Return type:
dict
Example
To get the user data for the workflow selected from the menu, for the first model selected by the user
user_data = Oasys.THIS.Workflow.ModelUserDataFromIndex(0)To get the user data for the second model that has user data for the workflow name “Automotive Assessment”
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
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.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
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.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:
user_data (object) – Object containing user data required for the workflow
output_filename (string) – Filename to write to
workflow_definition_filename (string) – Filename of the workflow definition file
extra (dict) –
Optional. Extra workflow information
- model_unit_system (optional):
(integer) The model unit system. Can be
Workflow.UNIT_SYSTEM_NONE
orWorkflow.UNIT_SYSTEM_U1
orWorkflow.UNIT_SYSTEM_U2
orWorkflow.UNIT_SYSTEM_U3
orWorkflow.UNIT_SYSTEM_U4
orWorkflow.UNIT_SYSTEM_U5
orWorkflow.UNIT_SYSTEM_U6
- 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")