Skip to main content
Version: 14

viktor.external.robot

RobotAnalysis

class viktor.external.robot.RobotAnalysis(input_file, *, return_model=True, return_results=True, requested_results=None)

Bases: ExternalProgram

Perform an analysis using Autodesk Robot on a third-party worker. To start an analysis call the method execute(), with an appropriate timeout (in seconds).

To retrieve the results call the method get_results(), after execute(). The evaluated model file can be retrieved by calling get_model_file(). Usage:

robot_analysis = RobotAnalysis(input_file, return_model=True)
robot_analysis.execute(timeout=10)
results = robot_analysis.get_results()
model_file = robot_analysis.get_model_file()

Exceptions which can be raised during calculation:

  • ExecutionError: generic error. Error message provides more information

Parameters
  • input_file (File) – Robot input file in STR format

  • return_results (bool) – If True, an analysis will be run and the result file is returned.

  • return_model (bool) – If True, the model file (.rtd) is returned.

  • requested_results (dict) – (optional) Dictionary containing the requested results. If requested_results is None and return_results is True, the worker will return all results. For the allowed components see the Autodesk Robot SDK documentation. The dictionary should be formatted as follows:

{
    "bar_forces": List[string],
    "bar_displacements": List[string],
    "bar_stresses": List[string],
    "bar_deflections": List[string],
    "node_reactions": List[string],
    "node_displacements": List[string],
}
get_model_file()

Retrieve the model file (only if return_model = True) in .rtd format.

execute() must be called first.

Return type

Optional[File]

get_results()

Retrieve the results (only if return_results = True). execute() must be called first.

The format of the returned dictionary is:

{
    'bar_forces': {
        '1': {  # case id
            '1': {  # bar id
                '0.000000': {   # positions
                    'FX': 26070.462297973572    # components
                }
            }
        }
    },
    'bar_displacements': {
        '1': {
            '1': {
                '0.000000': {
                    'RX': 0
                }
            }
        }
    },
    'bar_stresses': {
        '1': {
            '1': {
                '0.000000': {
                    'FXSX': 19750.350225737555
                }
            }
        }
    },
    'bar_deflections': {
        '1': {
            '1': {
                '0.000000': {
                    'PosUX': 0
                }
            }
        }
    },
    'node_reactions': {
        '1': {  # case id
            '1': {  # node id
                'FX': -9.89530235528946e-09 # components
            }
        }
    },
    'node_displacements': {
        '1': {
            '1': {
                'RX': 0
            }
        }
    }
}
Return type

Optional[dict]