Internal API

Contents

Internal API#

Python 3#

These modules are intended purely for use in Python 3. They do not need to be Abaqus Python compatible.

scons_extensions#

turbo_turtle.scons_extensions.cli_builder(
program: str = 'turbo-turtle',
subcommand: str = '',
required: str = '',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a generic Turbo-Turtle CLI builder.

This builder provides a template action for the Turbo-Turtle CLI. The default behavior will not do anything unless the subcommand argument is updated to one of the Turbo-Turtle CLI Sub-commands.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

This builder and any builders created from this template will be most useful if the options argument places SCons substitution variables in the action string, e.g. --argument ${argument}, such that the task definitions can modify the options on a per-task basis. Any option set in this manner must be provided by the task definition.

Builder/Task keyword arguments

  • program: The Turbo-Turtle command line executable absolute or relative path

  • subcommand: A Turbo-Turtle subcommand

  • required: A space delimited string of subcommand required arguments

  • options: A space delimited string of subcommand optional arguments

  • abaqus_command: The Abaqus command line executable absolute or relative path. When provided as a task keyword argument, this must be a space delimited string, not a list.

  • cubit_command: The Cubit command line executable absolute or relative path. When provided as a task keyword argument, this must be a space delimited string, not a list.

  • backend: The backend software, e.g. Abaqus or Cubit.

  • cd_action_prefix: Advanced behavior. Most users should accept the defaults.

  • redirect_action_postfix: Advanced behavior. Most users should accept the defaults.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend {backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleCLIBuilder": turbo_turtle.scons_extensions.cli_builder(
        program=env["turbo_turtle],
        subcommand="geometry",
        required="--input-file ${SOURCES.abspath} --output-file ${TARGET.abspath}"
    )
})
env.TurboTurtleCLIBuilder(
    target=["target.cae"],
    source=["source.csv"],
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

Returns:

SCons Turbo-Turtle CLI builder

turbo_turtle.scons_extensions.cylinder(
program: str = 'turbo-turtle',
subcommand: str = 'cylinder',
required: str = '--output-file ${TARGET.abspath} --inner-radius ${inner_radius} --outer-radius ${outer_radius} --height ${height}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle cylinder subcommand CLI builder

See the cylinder CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

Unless the required argument is overridden, the following task keyword arguments are required:

  • inner_radius

  • outer_radius

  • height

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleCylinder": turbo_turtle.scons_extensions.cylinder(
        program=env["turbo_turtle]
    )
})
env.TurboTurtleCylinder(
    target=["target.cae"],
    source=["SConstruct"],
    inner_radius=1.,
    outer_radius=2.,
    height=1.
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.export(
program: str = 'turbo-turtle',
subcommand: str = 'export',
required: str = '--input-file ${SOURCE.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle export subcommand CLI builder

See the export CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleExport": turbo_turtle.scons_extensions.export(
        program=env["turbo_turtle]
    )
})
env.TurboTurtleExport(
    target=["target.inp"],
    source=["source.cae"],
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.geometry(
program: str = 'turbo-turtle',
subcommand: str = 'geometry',
required: str = '--input-file ${SOURCES.abspath} --output-file ${TARGET.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle geometry subcommand CLI builder

See the geometry CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleGeometry": turbo_turtle.scons_extensions.geometry(
        program=env["turbo_turtle],
        options="--part-name ${part_name}"
    )
})
env.TurboTurtleGeometry(
    target=["target.cae"],
    source=["source1.csv", "source2.csv"],
    part_name="source1 source2"
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.geometry_xyplot(
program: str = 'turbo-turtle',
subcommand: str = 'geometry-xyplot',
required: str = '--input-file ${SOURCES.abspath} --output-file ${TARGET.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle geometry-xyplot subcommand CLI builder

See the geometry-xyplot CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleGeometryXYPlot": turbo_turtle.scons_extensions.geometry_xyplot(
        program=env["turbo_turtle],
        options="--part-name ${part_name}"
    )
})
env.TurboTurtleGeometryXYPlot(
    target=["target.png"],
    source=["source1.csv", "source2.csv"],
    part_name="source1 source2"
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.image(
program: str = 'turbo-turtle',
subcommand: str = 'image',
required: str = '--input-file ${SOURCE.abspath} --output-file ${TARGET.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle image subcommand CLI builder

See the image CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleImage": turbo_turtle.scons_extensions.image(
        program=env["turbo_turtle]
    )
})
env.TurboTurtleImage(
    target=["target.png"],
    source=["source.cae"],
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.merge(
program: str = 'turbo-turtle',
subcommand: str = 'merge',
required: str = '--input-file ${SOURCES.abspath} --output-file ${TARGET.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle merge subcommand CLI builder

See the merge CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleMerge": turbo_turtle.scons_extensions.merge(
        program=env["turbo_turtle]
    )
})
env.TurboTurtleMerge(
    target=["target.cae"],
    source=["source1.cae", "source2.cae"],
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.mesh(
program: str = 'turbo-turtle',
subcommand: str = 'mesh',
required: str = '--input-file ${SOURCE.abspath} --output-file ${TARGET.abspath} --element-type ${element_type}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle mesh subcommand CLI builder

See the mesh CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

Unless the required argument is overridden, the following task keyword arguments are required:

  • element_type

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleMesh": turbo_turtle.scons_extensions.mesh(
        program=env["turbo_turtle]
    )
})
env.TurboTurtleMesh(
    target=["target.cae"],
    source=["source.cae"],
    element_type="C3D8R"
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.partition(
program: str = 'turbo-turtle',
subcommand: str = 'partition',
required: str = '--input-file ${SOURCE.abspath} --output-file ${TARGET.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle partition subcommand CLI builder

See the partition CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtlePartition": turbo_turtle.scons_extensions.partition(
        program=env["turbo_turtle]
    )
})
env.TurboTurtlePartition(
    target=["target.cae"],
    source=["source.cae"],
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.sets(
program: str = 'turbo-turtle',
subcommand: str = 'sets',
required: str = '--input-file ${SOURCE.abspath} --output-file ${TARGET.abspath}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle sets subcommand CLI builder

See the sets CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

One of the following options must be added to the options string or the subcommand will return an error:

  • --face-set

  • --edge-set

  • --vertex-set

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleSets": turbo_turtle.scons_extensions.sets(
        program=env["turbo_turtle],
        options="${face_sets} ${edge_sets} ${vertex_sets}",
    )
})
env.TurboTurtleSets(
    target=["target.cae"],
    source=["source.cae"],
    face_sets="--face-set top '[#1 ]' --face-set bottom '[#2 ]'",
    edge_sets="",
    vertex_sets="--vertex-set origin '[#1 ]'"
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

turbo_turtle.scons_extensions.sphere(
program: str = 'turbo-turtle',
subcommand: str = 'sphere',
required: str = '--output-file ${TARGET.abspath} --inner-radius ${inner_radius} --outer-radius ${outer_radius}',
options: str = '',
abaqus_command: List[str] = ['abaqus', 'abq2024'],
cubit_command: List[str] = ['cubit'],
backend: str = 'abaqus',
) Builder[source]

Return a Turbo-Turtle sphere subcommand CLI builder

See the sphere CLI documentation for detailed subcommand usage and options. Builds subcommand specific options for the turbo_turtle.scons_extensions.cli_builder() function.

At least one target must be specified. The first target determines the working directory for the builder’s action. The action changes the working directory to the first target’s parent directory prior to execution.

The emitter will assume all emitted targets build in the current build directory. If the target(s) must be built in a build subdirectory, e.g. in a parameterized target build, then the first target must be provided with the build subdirectory, e.g. parameter_set1/my_target.ext. When in doubt, provide a STDOUT redirect file as a target, e.g. target.stdout.

Unless the required argument is overridden, the following task keyword arguments are required:

  • inner_radius

  • outer_radius

action string construction#
${cd_action_prefix} ${program} ${subcommand} ${required} ${options} --abaqus-command ${abaqus_command} --cubit-command ${cubit_command} --backend ${backend} ${redirect_action_postfix}
SConstruct#
import waves
import turbo_turtle
env = Environment()
env["turbo_turtle"] = waves.scons_extensions.add_program(env, ["turbo-turtle"])
env.Append(BUILDERS={
    "TurboTurtleSphere": turbo_turtle.scons_extensions.sphere(
        program=env["turbo_turtle]
    )
})
env.TurboTurtleSphere(
    target=["target.cae"],
    source=["SConstruct"],
    inner_radius=1.,
    outer_radius=2.
)
Parameters:
  • program (str) – The Turbo-Turtle command line executable absolute or relative path

  • subcommand (str) – A Turbo-Turtle subcommand

  • required (str) – A space delimited string of subcommand required arguments

  • options (str) – A space delimited string of subcommand optional arguments

  • abaqus_command (list) – The Abaqus command line executable absolute or relative path options

  • cubit_command (list) – The Cubit command line executable absolute or relative path options

  • backend (str) – The backend software

_main#

turbo_turtle._main._print_abaqus_path_location() None[source]#

Print the absolute path to the Turbo Turtle Abaqus Python package directory

Exits with a non-zero exit code if the settings variable _abaqus_python_parent_abspath does not exist.

turbo_turtle._main.add_abaqus_and_cubit(parsers: List[ArgumentParser]) None[source]#

Add the Abaqus and Cubit command arguments to each parser in the parsers list

Parameters:

parsers (list) – List of parsers to run add_argument for the command options

turbo_turtle._main.append_cubit_description(
text: str,
append: str = 'Defaults to Abaqus, but can optionally run Cubit (Gmsh implementation is a work-in-progress). Cubit and Gmsh backends replace hyphens with underscores in part name(s) for ACIS compatibility. Cubit backend ignores model/assembly name arguments.',
) str[source]#

Append common long description with optional Cubit text

Parameters:
  • text (str) – original text

  • append (str) – new text

Returns:

appended text

Return type:

str

turbo_turtle._main.append_cubit_help(text: str, append: str = 'with Abaqus, Cubit, or Gmsh (work-in-progress)') str[source]#

Append common short help with optional Cubit text

Parameters:
  • text (str) – original text

  • append (str) – new text

Returns:

appended text

Return type:

str

turbo_turtle._main.get_parser() ArgumentParser[source]#

Get parser object for command line options

Returns:

parser

Return type:

ArgumentParser

_abaqus_wrappers#

turbo_turtle._abaqus_wrappers.cylinder(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.cylinder_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.export(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.export_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.geometry(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.geometry_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.image(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.image_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.merge(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.merge_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.mesh(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.mesh_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.partition(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.partition_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.sets(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.sets_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

turbo_turtle._abaqus_wrappers.sphere(args, command)[source]#

Python 3 wrapper around the Abaqus Python turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.sphere_parser() CLI

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – abaqus executable path

_cubit_wrappers#

Thin unpacking of the command line argparse namespace into full function interfaces

turbo_turtle._cubit_wrappers.cylinder(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.cylinder()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path, unused. Kept for API compatibility with turbo_turtle._abaqus_wrappers()

turbo_turtle._cubit_wrappers.export(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.export()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path

turbo_turtle._cubit_wrappers.geometry(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.geometry()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path, unused. Kept for API compatibility with turbo_turtle._abaqus_wrappers()

turbo_turtle._cubit_wrappers.image(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.image()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path.

turbo_turtle._cubit_wrappers.merge(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.merge()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path

turbo_turtle._cubit_wrappers.mesh(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.mesh()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path, unused. Kept for API compatibility with turbo_turtle._abaqus_wrappers()

turbo_turtle._cubit_wrappers.partition(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.partition()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path

turbo_turtle._cubit_wrappers.sets(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.sets()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path

turbo_turtle._cubit_wrappers.sphere(args, command)[source]#

Python 3 wrapper around Cubit calling turbo_turtle._cubit_python.sphere()

Unpack the argument namespace into the full function interface

Parameters:
  • args (argparse.Namespace) – namespace of parsed arguments

  • command (str) – cubit executable path, unused. Kept for API compatibility with turbo_turtle._abaqus_wrappers()

_cubit_python#

Python 3 module that imports cubit

Which requires that Cubit’s bin directory is found on PYTHONPATH, either directly by the end user or from a successful turbo_turtle._utilities.find_cubit_bin() call and internal sys.path modification. This module does not perform sys.path manipulation, so the importing/calling module/script must verify that Cubit will import correctly first.

turbo_turtle._cubit_python._create_new_block(volumes)[source]#

Create a new block for all volumes in list

Sheet bodies are added to block as surfaces. Volumes are added as volumes.

Parameters:

volumes (list) – list of Cubit volume objects

Returns:

new block ID

Return type:

int

turbo_turtle._cubit_python._create_volume_from_surfaces(surfaces, keep=True)[source]#

Create a volume from the provided surfaces. Surfaces must create a closed volume.

Parameters:
  • surfaces (list) – List of Cubit surface objects

  • keep (bool) – Keep the original surface objects/sheet bodies

Returns:

Cubit volume object

Return type:

cubit.Volume

turbo_turtle._cubit_python._create_volume_name_block(name)[source]#

Create a new block with all volumes prefixed by name

Parameters:

name (str) – Name for new block and prefix for volume search

Returns:

New block ID

Return type:

int

turbo_turtle._cubit_python._draw_surface(lines, splines)[source]#

Given ordered lists of line/spline coordinates, create a Cubit surface object

Parameters:
  • lines (list) – list of [2, 2] shaped arrays of (x, y) coordinates defining a line segment

  • splines (list) – list of [N, 2] shaped arrays of (x, y) coordinates defining a spline

Returns:

Cubit surface defined by the lines and splines input

Return type:

cubit.Surface

turbo_turtle._cubit_python._export_abaqus(output_file, part_name)[source]#

Create a block named after the part, add all volumes/surfaace with name prefix, export an Abaqus orphan mesh file

Parameters:
  • output_file (pathlib.Path) – Abaqus file to write

  • part_name (str) – part/volume name to create as blocks from all volumes with a matching prefix

turbo_turtle._cubit_python._export_abaqus_list(part_name, element_type, destination)[source]#

Export one Abaqus orphan mesh per part in the destination directory

Parameters:
  • part_name (list) – list of part/volume names to create as blocks from all volumes with a matching prefix

  • element_type (list) – List of element type strings

  • destination (pathlib.Path) – Parent directory for orphan mesh files

turbo_turtle._cubit_python._export_genesis(output_file, part_name, element_type, output_type='genesis')[source]#

Export all volumes with part name prefix to the output file

Always creates new blocks named after the part/volume prefix.

Parameters:
  • output_file (pathlib.Path) – Genesis file to write

  • part_name (list) – list of part/volume names to create as blocks from all volumes with a matching prefix

  • element_type (list) – list of element type strings

  • output_type (str) – String identifying genesis output type: genesis (large format), genesis-normal, genesis-hdf5

turbo_turtle._cubit_python._feature_seeds(feature: str, name_number: Tuple[str, str]) None[source]#

Create mesh seeds on features by name

If the number is an integer, seed by interval. If the number is a float, seed by size

Parameters:
  • feature – Cubit feature name

  • name_number – Feature seed tuples (name, number)

turbo_turtle._cubit_python._get_volumes_from_name(names)[source]#

Return all volume objects with a prefix from the names list

Parameters:

names (list) – Name(s) prefix to search for with cubit.get_all_ids_from_name

Returns:

list of Cubit volumes with name prefix

Return type:

list of cubit.Volume objects

turbo_turtle._cubit_python._mesh(element_type, part_name, global_seed, edge_seeds)[source]#

Mesh Cubit volumes and sheet bodies by part/volume name

Parameters:
  • element_type (str) – Cubit scheme “trimesh” or “tetmesh”. Else ignored.

  • part_name (str) – part/volume name prefix

  • global_seed (float) – The global mesh seed size

  • edge_seeds – Edge seed tuples (name, number)

turbo_turtle._cubit_python._mesh_multiple_volumes(volumes, global_seed, element_type=None)[source]#

Mesh cubit.Volume objects as volumes or sheet bodies

Parameters:

volumes (list) – list of Cubit volume objects to mesh

turbo_turtle._cubit_python._mesh_sheet_body(volume, global_seed, element_type=None)[source]#

Mesh a volume that is a sheet body

Assumes cubit.is_sheet_body(volume.id()) is True.

Parameters:
  • volume (cubit.Volume) – Cubit volume to mesh as a sheet body

  • global_seed (float) – Seed size, e.g. cubit.cmd(surface {} size {global_seed}

  • element_type (str) – Cubit meshing scheme. Accepts ‘trimesh’ or is ignored.

turbo_turtle._cubit_python._mesh_volume(volume, global_seed, element_type=None)[source]#

Mesh a volume

Parameters:
  • volume (cubit.Volume) – Cubit volume to mesh

  • global_seed (float) – Seed size, e.g. cubit.cmd(volume {} size {global_seed}

  • element_type (str) – Cubit meshing scheme. Accepts ‘tetmesh’ or is ignored.

turbo_turtle._cubit_python._partition(
center=[0.0, 0.0, 0.0],
xvector=[1.0, 0.0, 0.0],
zvector=[0.0, 0.0, 1.0],
part_name=['Part-1'],
big_number=1000000.0,
)[source]#

Partition Cubit files with pyramidal body intersections defined by a cube’s center and vertices and with local coordinate planes.

Parameters:
  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • part_name (list) – part/volume name prefixes

  • big_number (float) – Number larger than the outer radius of the part to partition.

turbo_turtle._cubit_python._rename_and_sweep(
surface,
part_name,
center=<Mock name='mock.array()' id='140412790018928'>,
planar=False,
revolution_angle=360.0,
)[source]#

Recover body or volume from body surface, sweep part if required, and rename body/volume by part name

Hyphens are replaced by underscores to make the ACIS engine happy.

Parameters:
  • surface (cubit.Surface) – Cubit surface object to rename and conditionally sweep

  • part_name (str) – name of the part being created

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • revolution_angle (float) – angle of solid revolution for 3D geometries. Ignore when planar is True.

Returns:

Cubit volume object

Return type:

cubit.Volume

turbo_turtle._cubit_python._set_from_mask(feature: str, name_mask: Tuple[str, str]) None[source]#

Create named features, with associated node and sidesets, by feature ID

Parameters:
  • feature – Cubit feature name

  • name_mask – Feature set tuples (name, ID string)

turbo_turtle._cubit_python._set_genesis_output_type(output_type)[source]#

Set Cubit exodus/genesis output type

Parameters:

output_type (str) – String identifying genesis output type: genesis (large format), genesis-normal, genesis-hdf5

turbo_turtle._cubit_python._sets(
face_sets: List | None = None,
edge_sets: List | None = None,
vertex_sets: List | None = None,
) None[source]#

Create named features, with associated node and sidesets, by feature ID

Parameters:
  • face_sets – Face set tuples (name, mask)

  • edge_sets – Edge set tuples (name, mask)

  • vertex_sets – Vertex set tuples (name, mask)

turbo_turtle._cubit_python._sphere(inner_radius, outer_radius, quadrant='both', revolution_angle=360.0, center=(0.0, 0.0), part_name='Part-1')[source]#
Parameters:
  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

  • revolution_angle (float) – angle of rotation 0.-360.0 degrees. Provide 0 for a 2D axisymmetric model.

  • center (tuple) – tuple of floats (X, Y) location for the center of the sphere

  • part_name (str) – name of the part to be created in the Abaqus model

turbo_turtle._cubit_python._surface_centroids(surfaces)[source]#

Return a list of 3D surface centroids from the provided list of surface objects

Parameters:

surfaces (list) – list of Cubit surface objects

Returns:

list of surface centroids

Return type:

list of numpy.arrays

turbo_turtle._cubit_python._surface_numbers(surfaces)[source]#

Return a list of surface IDs from the provided list of surface objects

Parameters:

surfaces (list) – list of Cubit surface objects

Returns:

list of surface IDs

Return type:

list of int

turbo_turtle._cubit_python._surfaces_by_vector(surfaces, principal_vector, center=<Mock name='mock.zeros()' id='140412790155376'>)[source]#

Return a flat list of Cubit surface objects that meet the requirement of a positive dot product between a given vector and the vector between two points: a user provided center point and a surface object centroid.

Parameters:
  • surfaces (list) – list of Cubit surface objects

  • principal_vector (numpy.array) – Local principal axis vector defined in global coordinates

  • center (numpy.array) – center location of the geometry

Returns:

numpy.array of Cubit surface objects

Return type:

numpy.array

turbo_turtle._cubit_python._surfaces_for_volumes(volumes)[source]#

Return a flat list of surface objects for a list of volumes

Parameters:

volumes (list) – list of Cubit volume objects

Returns:

list of Cubit surface objects

Return type:

list

turbo_turtle._cubit_python.create_arc_from_coordinates(center, point1, point2)[source]#

Create a circular arc cubit.Curve object from center and points on the curve

Parameters:
  • center (tuple) – tuple of floats (X, Y, Z) location for the center of the circle arc

  • point1 (tuple) – tuple of floats (X, Y, Z) location for the first point on the arc

  • point2 (tuple) – tuple of floats (X, Y, Z) location for the second point on the arc

Returns:

cubit curve object

Return type:

curbit.Curve

turbo_turtle._cubit_python.create_curve_from_coordinates(point1, point2)[source]#

Create a curve from 2 three-dimensional coordinates

Parameters:
  • point1 (tuple) – First set of coordinates (x1, y1, z1)

  • point2 (tuple) – Second set of coordinates (x2, y2, z2)

Returns:

Cubit curve object defining a line segment

Return type:

cubit.Curve

turbo_turtle._cubit_python.create_pyramid_partitions(center, xvector, zvector, size, names)[source]#

Partition all volumes with a prefix in the names list with the size pyramids defined by a cube

Parameters:
  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • size (float) – Half-length of the cube diagonals (length of the pyramid tip to corner)

  • names (list) – Volume name prefix(es) to search for with cubit.get_all_ids_from_name

Returns:

list of Cubit volumes

Return type:

list of cubit.Volume objects

turbo_turtle._cubit_python.create_pyramid_volumes(center, xvector, zvector, size)[source]#

Return the six (6) four-sided pyramid volumes defined by a cube’s center point and six outer faces

Parameters:
  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • size (float) – Half-length of the cube diagonals (length of the pyramid tip to corner)

Returns:

list of Cubit volumes

Return type:

list of cubit.Volume objects

turbo_turtle._cubit_python.create_spline_from_coordinates(coordinates)[source]#

Create a spline from a list of coordinates

Parameters:

coordinates (numpy.array) – [N, 3] array of coordinates (x, y, z)

Returns:

Cubit curve object defining a spline

Return type:

cubit.Curve

turbo_turtle._cubit_python.create_surface_from_coordinates(coordinates)[source]#

Create a surface from an [N, 3] array of coordinates

Each row of the array represents a coordinate in 3D space. Must have at least 3 rows or a RuntimeError is raised. Coordinates are connected in pairs to create curves. First and last coordinate connected for final curve. Curves must defind a closed perimeter to generate a surface.

Parameters:

coordinates (numpy.array) – [N, 3] array of 3D coordinates where N > 2.

Returns:

Cubit surface object

Return type:

cubit.surface

turbo_turtle._cubit_python.cubit_command_or_exception(command)[source]#

Thin wrapper around cubit.cmd to raise an exception when returning False

Cubit returns True/False on cubit.cmd("") calls, but does not raise an exception. This method will raise a RuntimeError when the command returns False.

Parameters:

command (str) – Cubit APREPRO command to execute

turbo_turtle._cubit_python.cylinder(inner_radius, outer_radius, height, output_file, part_name='Part-1', revolution_angle=360.0, y_offset=0.0)[source]#

Accept dimensions of a right circular cylinder and generate an axisymmetric revolved geometry

Centroid of cylinder is located on the global coordinate origin by default.

Parameters:
  • inner_radius (float) – Radius of the hollow center

  • outer_radius (float) – Outer radius of the cylinder

  • height (float) – Height of the cylinder

  • output_file (str) – Cubit *.cub database to save the part(s)

  • part_name (list) – name(s) of the part(s) being created

  • revolution_angle (float) – angle of solid revolution for 3D geometries

  • y_offset (float) – vertical offset along the global Y-axis

turbo_turtle._cubit_python.export(
input_file,
part_name=['Part-1'],
element_type=[None],
destination='/home/runner/work/turbo-turtle/turbo-turtle',
output_type='abaqus',
)[source]#

Open a Cubit *.cub file and export part_name prefixed volumes as part_name.inp

Parameters:
  • input_file (str) – Cubit *.cub file to open that already contains meshed parts/volumes

  • part_name (str) – list of part/volume name prefix to export

  • element_type (list) – list of element types, one per part name or one global replacement for every part name

  • destination (str) – write output orphan mesh files to this output directory

turbo_turtle._cubit_python.geometry(
input_file,
output_file,
planar=False,
part_name=[None],
unit_conversion=1.0,
euclidean_distance=4.0,
delimiter=',',
header_lines=0,
revolution_angle=360.0,
y_offset=0.0,
rtol=None,
atol=None,
)[source]#

Create 2D planar, 2D axisymmetric, or 3D revolved geometry from an array of XY coordinates.

Note that 2D axisymmetric sketches and sketches for 3D bodies of revolution about the global Y-axis must lie entirely on the positive-X side of the global Y-axis.

This function can create multiple sheet bodies or volumes in the same Cubit *.cub file. If no part (body/volume) names are provided, the body/volume will be named after the input file base name.

Parameters:
  • input_file (str) – input text file(s) with coordinates to draw

  • output_file (str) – Cubit *.cub database to save the part(s)

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • part_name (list) – name(s) of the part(s) being created

  • unit_conversion (float) – multiplication factor applies to all coordinates

  • euclidean_distance (float) – if the distance between two coordinates is greater than this, draw a straight line. Distance should be provided in units after the unit conversion

  • delimiter (str) – character to use as a delimiter when reading the input file

  • header_lines (int) – number of lines in the header to skip when reading the input file

  • revolution_angle (float) – angle of solid revolution for 3D geometries. Ignore when planar is True.

  • y_offset (float) – vertical offset along the global Y-axis. Offset should be provided in units after the unit conversion.

  • rtol (float) – relative tolerance for vertical/horizontal line checks

  • atol (float) – absolute tolerance for vertical/horizontal line checks

Returns:

writes {output_file}.cub

turbo_turtle._cubit_python.image(input_file, output_file, cubit_command, x_angle=0.0, y_angle=0.0, z_angle=0.0, image_size=[1920, 1080])[source]#

Open a Cubit *.cub file and save an image

Uses the Cubit APREPRO hardcopy command, which accepts jpg, gif, bmp, pnm, tiff, and eps file extensions. This command only works in batch mode from Cubit APREPRO journal files, so an input_file.jou is created for execution.

Parameters:
  • input_file (str) – Cubit *.cub file to open that already contains parts/volumes to be meshed

  • output_file (str) – Screenshot file to write

  • x_angle (float) – Rotation about ‘world’ X-axis in degrees

  • y_angle (float) – Rotation about ‘world’ Y-axis in degrees

  • z_angle (float) – Rotation about ‘world’ Z-axis in degrees

  • image_size (tuple) – Image size in pixels (width, height)

turbo_turtle._cubit_python.imprint_and_merge(names)[source]#

Imprint and merge all volume objects with a prefix from the names list

Parameters:

names (list) – Name(s) prefix to search for with cubit.get_all_ids_from_name

turbo_turtle._cubit_python.merge(input_file, output_file)[source]#

Merge Cubit *.cub files with forced unique block IDs and save to output file

Parameters:
  • input_file (list) – List of Cubit *.cub file(s) to merge

  • output_file (str) – Cubit *.cub file to write

turbo_turtle._cubit_python.mesh(
input_file: str,
element_type: str,
output_file: str | None = None,
part_name: str | None = 'Part-1',
global_seed: float | None = 1.0,
edge_seeds: List | None = None,
) None[source]#

Mesh Cubit volumes and sheet bodies by part/volume name

Parameters:
  • input_file – Cubit *.cub file to open that already contains parts/volumes to be meshed

  • element_type – Cubit scheme “trimesh” or “tetmesh”. Else ignored.

  • output_file – Cubit *.cub file to write

  • part_name – part/volume name prefix

  • global_seed – The global mesh seed size

  • edge_seeds – Edge seed tuples (name, number)

turbo_turtle._cubit_python.partition(
input_file,
output_file=None,
center=[0.0, 0.0, 0.0],
xvector=[1.0, 0.0, 0.0],
zvector=[0.0, 0.0, 1.0],
part_name=['Part-1'],
big_number=1000000.0,
)[source]#

Partition Cubit files with pyramidal body intersections defined by a cube’s center and vertices and with local coordinate planes.

Parameters:
  • input_file (str) – Cubit *.cub file to open that already contains parts/volumes to be meshed

  • output_file (str) – Cubit *.cub file to write

  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • part_name (list) – part/volume name prefixes

  • big_number (float) – Number larger than the outer radius of the part to partition.

turbo_turtle._cubit_python.sets(
input_file: str,
output_file: str | None = None,
part_name: str | None = 'Part-1',
face_sets: List | None = None,
edge_sets: List | None = None,
vertex_sets: List | None = None,
) None[source]#

Create Cubit sidesets and nodesets from feature numbers

Parameters:
  • input_file – Cubit *.cub file to open that already contains parts/volumes to be meshed

  • output_file – Cubit *.cub file to write

  • part_name – part/volume name prefix

  • face_sets – Face set tuples (name, mask)

  • edge_sets – Edge set tuples (name, mask)

  • vertex_sets – Vertex set tuples (name, mask)

turbo_turtle._cubit_python.sphere(
inner_radius,
outer_radius,
output_file,
input_file=None,
quadrant='both',
revolution_angle=360.0,
y_offset=0.0,
part_name='Part-1',
)[source]#
Parameters:
  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • output_file (str) – output file name. Will be stripped of the extension and .cub will be used.

  • input_file (str) – input file name. Will be stripped of the extension and .cub will be used.

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

  • revolution_angle (float) – angle of rotation 0.-360.0 degrees. Provide 0 for a 2D axisymmetric model.

  • y_offset (float) – vertical offset along the global Y-axis

  • part_name (str) – name of the part to be created in the Abaqus model

turbo_turtle._cubit_python.webcut_local_coordinate_primary_planes(center, xvector, zvector, names)[source]#

Webcut all volumes with a prefix in the names list on the local coordinate system primary planes

Parameters:
  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • names (list) – Volume name prefix(es) to search for with cubit.get_all_ids_from_name

Returns:

list of Cubit volumes with name prefix(es)

Return type:

list of cubit.Volume objects

_gmsh_python#

Python 3 module that imports python-gmsh

turbo_turtle._gmsh_python._create_arc_from_coordinates(center, point1, point2) int[source]#

Create a circle arc Gmsh object from center and points on the curve

Parameters:
  • center (tuple) – tuple of floats (X, Y, Z) location for the center of the circle arc

  • point1 (tuple) – tuple of floats (X, Y, Z) location for the first point on the arc

  • point2 (tuple) – tuple of floats (X, Y, Z) location for the second point on the arc

Returns:

Gmsh curve tag

turbo_turtle._gmsh_python._create_line_from_coordinates(point1, point2) int[source]#

Create a curve from 2 three-dimensional coordinates

Parameters:
  • point1 (tuple) – First set of coordinates (x1, y1, z1)

  • point2 (tuple) – Second set of coordinates (x2, y2, z2)

Returns:

Gmsh 1D entity tag

turbo_turtle._gmsh_python._create_spline_from_coordinates(coordinates) int[source]#

Create a spline from a list of coordinates

Parameters:

coordinates (numpy.array) – [N, 3] array of coordinates (x, y, z)

Returns:

Gmsh 1D entity tag

turbo_turtle._gmsh_python._draw_surface(lines_and_splines) int[source]#

Given ordered lists of line/spline coordinates, create a Gmsh 2D surface object

Parameters:

lines_and_splines (list) – list of [N, 2] shaped arrays of (x, y) coordinates defining a line (N=2) or spline (N>2)

Returns:

Gmsh 2D entity tag

turbo_turtle._gmsh_python._rename_and_sweep(
surface: int,
part_name: str,
center=<Mock name='mock.array()' id='140412790018928'>,
planar=False,
revolution_angle=360.0,
) Tuple[int, int][source]#

Recover surface, sweep part if required, and rename surface/volume by part name

Hyphens are replaced by underscores to make the ACIS engine happy.

Parameters:
  • surface (int) – Gmsh surface tag to rename and conditionally sweep

  • part_name (str) – name(s) of the part(s) being created

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • revolution_angle (float) – angle of solid revolution for 3D geometries. Ignore when planar is True.

Returns:

Gmsh dimTag (dimension, tag)

turbo_turtle._gmsh_python._sphere(
inner_radius,
outer_radius,
quadrant='both',
revolution_angle=360.0,
center=(0.0, 0.0),
part_name='Part-1',
) None[source]#
Parameters:
  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

  • revolution_angle (float) – angle of rotation 0.-360.0 degrees. Provide 0 for a 2D axisymmetric model.

  • center (tuple) – tuple of floats (X, Y) location for the center of the sphere

  • part_name (str) – name of the part to be created in the Abaqus model

turbo_turtle._gmsh_python.cylinder(
inner_radius,
outer_radius,
height,
output_file,
model_name='Model-1',
part_name='Part-1',
revolution_angle=360.0,
y_offset=0.0,
) None[source]#

Accept dimensions of a right circular cylinder and generate an axisymmetric revolved geometry

Centroid of cylinder is located on the global coordinate origin by default.

Parameters:
  • inner_radius (float) – Radius of the hollow center

  • outer_radius (float) – Outer radius of the cylinder

  • height (float) – Height of the cylinder

  • output_file (str) – Gmsh *.step file to save the part(s)

  • model_name (str) – name of the Gmsh model in which to create the part

  • part_name (list) – name(s) of the part(s) being created

  • revolution_angle (float) – angle of solid revolution for 3D geometries

  • y_offset (float) – vertical offset along the global Y-axis

turbo_turtle._gmsh_python.geometry(
input_file,
output_file,
planar=False,
model_name='Model-1',
part_name=[None],
unit_conversion=1.0,
euclidean_distance=4.0,
delimiter=',',
header_lines=0,
revolution_angle=360.0,
y_offset=0.0,
rtol=None,
atol=None,
) None[source]#

Create 2D planar, 2D axisymmetric, or 3D revolved geometry from an array of XY coordinates.

Note that 2D axisymmetric sketches and sketches for 3D bodies of revolution about the global Y-axis must lie entirely on the positive-X side of the global Y-axis.

This function can create multiple surfaces or volumes in the same Gmsh *.step file. If no part (body/volume) names are provided, the body/volume will be named after the input file base name.

Parameters:
  • input_file (str) – input text file(s) with coordinates to draw

  • output_file (str) – Gmsh *.step database to save the part(s)

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • model_name (str) – name of the Gmsh model in which to create the part

  • part_name (list) – name(s) of the part(s) being created

  • unit_conversion (float) – multiplication factor applies to all coordinates

  • euclidean_distance (float) – if the distance between two coordinates is greater than this, draw a straight line. Distance should be provided in units after the unit conversion

  • delimiter (str) – character to use as a delimiter when reading the input file

  • header_lines (int) – number of lines in the header to skip when reading the input file

  • revolution_angle (float) – angle of solid revolution for 3D geometries. Ignore when planar is True.

  • y_offset (float) – vertical offset along the global Y-axis. Offset should be provided in units after the unit conversion.

  • rtol (float) – relative tolerance for vertical/horizontal line checks

  • atol (float) – absolute tolerance for vertical/horizontal line checks

Returns:

writes {output_file}.step

turbo_turtle._gmsh_python.image(input_file, output_file, x_angle=0.0, y_angle=0.0, z_angle=0.0, image_size=[1920, 1080]) None[source]#

Open a Gmsh geometry or mesh file and save an image

Uses the Gmsh write command, which accepts gif, jpg, tex, pdf, png, pgf, ps, ppm, svg, tikz, and yuv file extensions.

Parameters:
  • input_file (str) – Gmsh input file to open

  • output_file (str) – Screenshot file to write

  • x_angle (float) – Rotation about ‘world’ X-axis in degrees

  • y_angle (float) – Rotation about ‘world’ Y-axis in degrees

  • z_angle (float) – Rotation about ‘world’ Z-axis in degrees

  • image_size (tuple) – Image size in pixels (width, height)

turbo_turtle._gmsh_python.mesh(
input_file: str,
element_type: str,
output_file: str | None = None,
model_name: str | None = 'Model-1',
part_name: str | None = 'Part-1',
global_seed: float | None = 1.0,
edge_seeds: List | None = None,
) None[source]#

Mesh Gmsh physical entities by part name

Parameters:
  • input_file – Gmsh *.step file to open that already contains physical entities to be meshed

  • element_type – Gmsh scheme.

  • output_file – Gmsh mesh file to write

  • model_name – name of the Gmsh model in which to create the part

  • part_name – physical entity name prefix

  • global_seed – The global mesh seed size

  • edge_seeds – Edge seed tuples (name, number)

turbo_turtle._gmsh_python.sphere(
inner_radius,
outer_radius,
output_file,
input_file=None,
quadrant='both',
revolution_angle=360.0,
y_offset=0.0,
model_name='Model-1',
part_name='Part-1',
) None[source]#
Parameters:
  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • output_file (str) – output file name. Will be stripped of the extension and .step will be used.

  • input_file (str) – input file name. Will be stripped of the extension and .step will be used.

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

  • revolution_angle (float) – angle of rotation 0.-360.0 degrees. Provide 0 for a 2D axisymmetric model.

  • y_offset (float) – vertical offset along the global Y-axis

  • model_name (str) – name of the Gmsh model in which to create the part

  • part_name (str) – name of the part to be created in the Abaqus model

_utilities#

class turbo_turtle._utilities.NamedTemporaryFileCopy(input_file, *args, **kwargs)[source]#

Create a temporary file copy

Thin wrapper around tempfile.NamedTemporaryFile(*args, delete=False, **kwargs) to provide Windows handling

Provides Windows compatible temporary file handling. delete=False is required until Python 3.12 delete_on_close=False option can be made a minimum runtime dependence.

Parameters:

input_file (str) – The input file to copy into a temporary file

turbo_turtle._utilities.character_delimited_list(sequence: Iterable, character: str = ' ') str[source]#

Map a list of non-strings to a character delimited string

Parameters:
  • sequence – Sequence to turn into a character delimited string

  • character – Character(s) to use when joining sequence elements

Returns:

string delimited by specified character

turbo_turtle._utilities.construct_append_options(option: str, array: Iterable[Tuple]) str[source]#

Construct a command string to match the argparse append action

Build the repeated option string for argparse appending options that accept more than one value

python script.py --option 1 2 --option 3 4
>>> option = "--option"
>>> array = [[1, 2], [3, 4]]
>>> construct_append_options(option, array)
"--option 1 2 --option 3 4"
Parameters:
  • option – Text for the option, e.g. --option

  • array – 2D iterable of tuple arguments

turbo_turtle._utilities.cubit_os_bin() str[source]#

Return the OS specific Cubit bin directory name

Making Cubit importable requires putting the Cubit bin directory on PYTHONPATH. On MacOS, the directory is “MacOS”. On other systems it is “bin”.

Returns:

bin directory name, e.g. “bin” or “MacOS”

turbo_turtle._utilities.find_command(options: Iterable[str]) str[source]#

Return first found command in list of options.

Parameters:

options – alternate command options

Returns:

command absolute path

Raises:

FileNotFoundError if no command is found

turbo_turtle._utilities.find_cubit_bin(options: Iterable[str], bin_directory: str | None = None) Path[source]#

Provided a few options for the Cubit executable, search for the bin directory.

Recommend first checking to see if cubit will import.

If the Cubit command or bin directory is not found, raise a FileNotFoundError.

Parameters:
Returns:

Cubit bin directory absolute path

turbo_turtle._utilities.import_cubit()[source]#

Intermediate Cubit import function

Allows better CLI error reporting and Cubit package mocking during unit tests

turbo_turtle._utilities.import_gmsh()[source]#

Intermediate gmsh import function

Allows better CLI error reporting and gmsh package mocking during unit tests

turbo_turtle._utilities.run_command(command: str) None[source]#

Split command on whitespace, execute shell command, raise RuntimeError with any error message

Parameters:

command – String to run on the shell

turbo_turtle._utilities.search_commands(options: Iterable[str]) str | None[source]#

Return the first found command in the list of options. Return None if none are found.

Parameters:

options – executable path(s) to test

Returns:

command absolute path

turbo_turtle._utilities.set_wrappers_and_command(args: Namespace) Tuple[source]#

Read an argument namespace and set the wrappers and command appropriately

Parameters:

args – namespace of parsed arguments from turbo_turtle._main.get_parser()

Returns:

_wrappers, command. Wrapper module, executable command string.

Python 3 tests#

These modules are intended purely for use in Python 3. They do not need to be Abaqus Python compatible, but they may have corresponding Abaqus Python tests.

Python 3 unit test files may be executed with the pytest command directly, where the Abaqus Python test exclusions is handled by the default pytest options in pyproject.toml. For example from the project root directory

$ pytest

The test execution is also available as an SCons alias: pytest, which is collected under the aliases: unittest and regression. These aliases may provide additional pytest command line options which are not or can not be set in pyproject.toml.

test_main#

turbo_turtle.tests.test_main.test_print_abaqus_path(capsys)[source]#

Test the print-abaqus-path subcommand behavior

test_cubit_python#

test_fetch#

turbo_turtle.tests.test_fetch.platform_check()[source]#

Check platform and set platform specific variables

Returns:

tuple (root_fs, testing_windows)

Return type:

(str, bool)

test_utilities#

turbo_turtle.tests.test_utilities.test_find_command(options, found, outcome)[source]#

Test turbo_turtle._utilities.find_command()

turbo_turtle.tests.test_utilities.test_run_command()[source]#

Test turbo_turtle._utilities.run_command()

turbo_turtle.tests.test_utilities.test_search_commands()[source]#

Test turbo_turtle._utilities.search_command()

test_geometry_xyplot.py#

test_parsers.py#

turbo_turtle.tests.test_parsers.test_subcommand_parser(subcommand, required_argv, exclude_keys)[source]#

Test the default value assignments in the subcommand parsers

Parameters:
  • subcommand (str) – the subcommand parser to test

  • required_argv (list) – the argv list of strings for parser positional (required) arguments that have no default(s)

  • exclude_keys (list) – keys that aren’t used or set by the parser, but are included in the defaults dictionary. These are excluded from the key: value argparse.Namespace tests.

test_scons_extensions.py#

Test Turbo-Turtle SCons builders and support functions

turbo_turtle.tests.test_scons_extensions.check_nodes(nodes, post_action, node_count, action_count, expected_string, expected_env_kwargs)[source]#

Verify the expected action string against a builder’s target nodes

Parameters:
  • nodes (SCons.Node.NodeList) – Target node list returned by a builder

  • post_action (list) – list of post action strings passed to builder

  • node_count (int) – expected length of nodes

  • action_count (int) – expected length of action list for each node

  • expected_string (str) – the builder’s action string.

  • expected_env_kwargs (dict) – the builder’s expected environment keyword arguments

Note

The method of interrogating a node’s action list results in a newline separated string instead of a list of actions. The expected_string should contain all elements of the expected action list as a single, newline separated string. The action_count should be set to 1 until this method is updated to search for the finalized action list.

test_system.py#

The system tests are not included in the default pytest options. They are marked with a systemtest marker and may be executed with pytest -m systemtest. They are also collected under the SCons alias systemtest which contains additional pytest command line options to control test failure output more convenient to the system test execution.

turbo_turtle.tests.test_system.setup_sphere_commands(
model,
inner_radius,
outer_radius,
angle,
y_offset,
quadrant,
element_type,
element_replacement,
backend,
output_type,
) List[Template][source]#

Return the sphere/partition/mesh commands for system testing

Returns:

list of string or string template commands

turbo_turtle.tests.test_system.test_project_shell_commands(abaqus_command, cubit_command, commands: list) None[source]#

Run the system tests.

Executes with a temporary directory that is cleaned up after each test execution.

Accepts custom pytest CLI options to specify abaqus and cubit commands

pytest --abaqus-command /my/system/abaqus --cubit-command /my/system/cubit
Parameters:
  • abaqus_command – string absolute path to Abaqus executable

  • cubit_command – string absolute path to Cubit executable

  • command – the full list of command string(s) for the system test

turbo_turtle.tests.test_system.test_require_third_party(abaqus_command, cubit_command, commands: list) None[source]#

Run system tests that require third-party software

Executes with a temporary directory that is cleaned up after each test execution.

Accepts custom pytest CLI options to specify abaqus and cubit commands

pytest --abaqus-command /my/system/abaqus --cubit-command /my/system/cubit
Parameters:
  • abaqus_command – string absolute path to Abaqus executable

  • cubit_command – string absolute path to Cubit executable

  • command – the full list of command string(s) for the system test

test_wrappers.py#

turbo_turtle.tests.test_wrappers.trim_namespace(original, pop_keys)[source]#

Create a modified dictionary deepcopy by removing the provided keys

Returns:

Modified dictionary deepcopy with pop keys removed

Return type:

dict

test_vertices#

Warning

These are tests of a mixed Python 2/3 compatible module. When updating, be sure to update the Abaqus Python tests to match.

turbo_turtle.tests.test_vertices.test_cylinder(inner_radius, outer_radius, height, y_offset, expected)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.cylinder()

turbo_turtle.tests.test_vertices.test_cylinder_lines(inner_radius, outer_radius, height, y_offset, expected)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.cylinder_lines()

turbo_turtle.tests.test_vertices.test_lines_and_splines(coordinates, euclidean_distance, expected_lines, expected_splines)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.lines_and_splines()

turbo_turtle.tests.test_vertices.test_rectalinear_coordinates(radius_list, angle_list, expected)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.rectalinear_coordinates()

test_mixed_utilities#

Warning

These are tests of a mixed Python 2/3 compatible module. When updating, be sure to update the Abaqus Python tests to match.

turbo_turtle.tests.test_mixed_utilities.test_return_genfromtxt(file_name, delimiter, header_lines, expected_dimensions, expected_columns, expected, outcome)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.return_genfromtxt()

Tests both the expection raising version and the system exit version turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.return_genfromtxt_or_exit()

Parameters:
  • file_name (str) – dummy data file name

  • delimiter (str) – String for file name delimiter character

  • header_lines (int) – Integer number of header lines to ignore

  • expected_dimensions (int) – The expected dimensionality of the data. When mismatched, should trigger an exception/error.

  • expected_columns (int) – The expected number of columns of the data. When mismatched, should trigger an exception/error.

  • expected (numpy.array) – expected return data of the function under test

  • outcome – either contextlib.nullcontext or pytest.raises() depending on expected success or exception, respectively

turbo_turtle.tests.test_mixed_utilities.test_sys_exit()[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.sys_exit() sys.exit wrapper.

We can’t test the Abaqus Python override print to sys.__stderr__ because the print statement is not valid Python 3 code.

turbo_turtle.tests.test_mixed_utilities.test_validate_element_type(length_part_name, original_element_type, expected, outcome)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.validate_element_type()

Tests both the expection raising version and the system exit version turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.validate_element_type_or_exit()

Parameters:
  • length_part_name (int) – length of the part_name list

  • original_element_type (list) – List of element types passed to function under test

  • expected (list) – Expected list of element types returned by function under test

  • outcome – either contextlib.nullcontext or pytest.raises() depending on expected success or exception, respectively

turbo_turtle.tests.test_mixed_utilities.test_validate_part_name(input_file, original_part_name, expected, outcome)[source]#

Test turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.validate_part_name()

Tests both the expection raising version and the system exit version turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.validate_part_name_or_exit()

Parameters:
  • input_file (str) – dummy input file name

  • original_part_name (list) – List of part names passed to function under test

  • expected (list) – Expected list of part names returned by function under test

  • outcome – either contextlib.nullcontext or pytest.raises() depending on expected success or exception, respectively

Python 2/3#

These modules are intended for re-use in both Python 3 and Abaqus Python. Care should be taken to maintain backward compatibility with the Python 2.7 site-packages provided by Abaqus. For re-use in the Abaqus Python scripts, they must be co-located in the Abaqus Python module. Modules may not perform internal package imports to minimize the risk of polluting the Abaqus Python namespace with Python 3 modules, and vice versa.

These modules may have duplicate Python 3 tests turbo_turtle/tests/test*.py and Abaqus Python tests turbo_turtle/_abaqus_python/turbo_turtle_abaqus/test*.py

parsers#

Python 2/3 compatible parsers for use in both Abaqus Python scripts and Turbo-Turtle Python 3 modules

Content must be compatible with Python 2 and 3. Content should be limited to those things necessary to construct the CLI parser(s). Other content, such as project/package settings type variables, can be included to minimize the required sys.path modifications required in the Abaqus Python package/scripts. For now, that means this file does double duty as the Abaqus Python package settings file and the parsers file.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.construct_prog(basename)[source]#

Construct the Abaqus Python usage string

Parameters:

basename (str) – Abaqus Python script basename

Returns:

program usage string

Return type:

str

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.cylinder_parser(
basename='cylinder.py',
add_help=True,
description='Accept dimensions of a right circular cylinder and generate an axisymmetric revolved geometry.',
cubit=False,
)[source]#

Return the cylinder subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

  • cubit (bool) – Include the Cubit specific options and help language when True

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.export_parser(basename='export.py', add_help=True, description='Export a part mesh as an orphan mesh', cubit=False)[source]#

Return the export subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.geometry_parser(
basename='geometry.py',
add_help=True,
description='Create a 2D planar, 2D axisymmetric, or 3D body of revolution (about the global Y-Axis) by sketching lines and splines in the XY plane. Line and spline definitions are formed by parsing an input file with [N, 2] array of XY coordinates.',
cubit=False,
)[source]#

Return the geometry subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

  • cubit (bool) – Include the Cubit specific options and help language when True

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.image_parser(
basename='image.py',
add_help=True,
description='Save a part or assembly view image for a given Abaqus input file',
cubit=False,
)[source]#

Return the image subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.merge_parser(
basename='merge.py',
add_help=True,
description='Supply multiple model database files, model names, and part names to merge the parts into a new model. Every model databse file is searched for every model/part name combination. If a part name is found in more than one model, return an error.',
cubit=False,
)[source]#

Return the merge subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.mesh_parser(
basename='mesh_module.py',
add_help=True,
description='Mesh a part from a global seed and optional edge seeds. The edge seeds must be positive numbers. If the seed is an integer, the edge will be seeded by number. If it is a float, the edge will be seeded by size.',
cubit=False,
)[source]#

Return the mesh subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.partition_parser(
basename='partition.py',
add_help=True,
description='Partition hollow spheres into a turtle shell given a small number of locating, clocking, and partition plane angle parameters.',
cubit=False,
)[source]#

Return the partition subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

  • cubit (bool) – Include the Cubit specific options and help language when True

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.positive_float(argument)[source]#

Type function for argparse - positive floats including zero

Abaqus Python 2 and Python 3 compatible argparse type method: https://docs.python.org/3.9/library/argparse.html#type.

Parameters:

argument (str) – string argument from argparse

Returns:

argument

Return type:

float

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.positive_int(argument)[source]#

Type function for argparse - positive integers including zero

Abaqus Python 2 and Python 3 compatible argparse type method: https://docs.python.org/3.9/library/argparse.html#type.

Parameters:

argument (str) – string argument from argparse

Returns:

argument

Return type:

int

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.sets_parser(
basename='sets.py',
add_help=True,
description="Create geometric sets from mask strings. Primarly intended for use in scripted workflows with stable geometry creation order and features because masks are fragile with respect to geometric changes. The recommended workflow is to perform manual set creation on a nominal geometry model, record the set masks/IDs reported by the third-party software, and write the CLI options into a scripted workflow file. Abaqus reports CAE operations in the ``abaqus.rpy`` replay file, e.g. ``grep -A 1 'mask=' abaqus.rpy``. Cubit IDs can be found in the model tree.",
cubit=False,
)[source]#

Return the sets subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

Returns:

argparse parser

Return type:

argparse.ArgumentParser

turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers.sphere_parser(
basename='sphere.py',
add_help=True,
description='Create a hollow, spherical geometry from a sketch in the X-Y plane with upper (+X+Y), lower (+X-Y), or both quadrants.',
cubit=False,
)[source]#

Return the sphere subcommand parser

Parameters:
  • basename (str) – Explicit script basename for the usage.

  • add_help (bool) – add_help argument value for the argparse.ArgumentParser class interface

  • description (str) – The description argument value for the argparse.ArgumentParser class interface

  • cubit (bool) – Include the Cubit specific options and help language when True

Returns:

argparse parser

Return type:

argparse.ArgumentParser

vertices#

Python 2/3 compatible coordinate handling for use in both Abaqus Python scripts and Turbo-Turtle Python 3 modules

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices._bool_via_or(bools_list_1, bools_list_2)[source]#

Compare two lists of bools using an or statement

Parameters:
  • bools_list_1 (list) – first set of bools

  • bools_list_2 (list) – second set of bools

Returns:

bools resulting from or statment

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices._break_coordinates(coordinates, euclidean_distance, rtol=None, atol=None)[source]#

Accept a [N, 2] numpy array and break into a list of [M, 2] arrays

This function follows this methodology to turn a [N, 2] numpy array into a list of [M, 2] arrays denoting individual lines or splines.

  1. If neighboring points are farther apart than the euclidean distance, break the original array between them.

  2. If neighboring points have the same X or Y coordinate (horizontally or vertically aligned), break the original array between them. Uses numpy.isclose with the default tolerance for float comparison.

Parameters:
  • coordinates (numpy.array) – [N, 2] array of XY coordinates.

  • euclidean_distance (float) – If the distance between two points is greater than this, draw a straight line.

  • rtol (float) – relative tolerance used by numpy.isclose. If None, use the numpy default.

  • atol (float) – absolute tolerance used by numpy.isclose. If None, use the numpy default.

Returns:

Series of line and spline definitions

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices._compare_euclidean_distance(coordinates, euclidean_distance)[source]#

Compare the distance between coordinates in a 2D numpy array of XY data to a provided euclidean distance

The distance comparison is performed as numpy_array_distance > euclidean_distance. The distance between coordinates in the numpy array is computed such that the “current point” is compared to the previous point in the list. As such, a single False is always prepended to the beginning of the output euclidean_distance_bools list, because there is no such distance between the first point and one that comes before it.

Parameters:
  • coordinates (numpy.array) – [N, 2] array of XY coordinates.

  • euclidean_distance (float) – distance value to compare against

Returns:

bools for the distance comparison

Return type:

list of length N

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices._compare_xy_values(coordinates, rtol=None, atol=None)[source]#

Check neighboring XY values in an [N, 2] array of coordinates for vertical or horizontal relationships

This function loops through lists of coordinates checking to see if a “current point” and the previous point in the numpy array are vertical or hozitonal from one another. As such, a single False is always prepended to the beginning of the output vertical_horizontal_bools list, because there is no such vertical/horizontal relationship between the first point and one that comes before it.

Parameters:
  • coordinates (numpy.array) – [N, 2] array of XY coordinates.

  • rtol (float) – relative tolerance used by numpy.isclose. If None, use the numpy default.

  • atol (float) – absolute tolerance used by numpy.isclose. If None, use the numpy default.

Returns:

bools for vertical/horizontal relationship comparison

Return type:

list of length N

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices._line_pairs(all_splines)[source]#

Accept a list of [N, 2] arrays and return a list of paired coordinates to connect as lines

Given a list of [N, 2] numpy arrays, create tuple pairs of coordinates between the end and beginning of subsequent arrays. Also return a pair from the last array’s last coordinate to the first array’s first coordinate.

Parameters:

all_splines (list) – a list of 2D numpy arrays

Returns:

line pairs

Return type:

list of [2, 2] numpy arrays

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.any_parallel(first, options, rtol=None, atol=None)[source]#

If the first vector is parellel to any of the options, return True

Parameters:
  • first (numpy.array) – First vector

  • options (list) – List of vectors to compare against the first vector

Returns:

boolean answering “is the first vector parallel to any of the option vectors?”

Return type:

bool

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.cylinder(inner_radius, outer_radius, height, y_offset=0.0)[source]#

Return a turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.lines_and_splines() compatible vertex array

Parameters:
  • inner_radius (float) – Radius of the hollow center

  • outer_radius (float) – Outer radius of the cylinder

  • height (float) – Height of the cylinder

Returns:

vertex coordinate array

Return type:

numpy.array

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.cylinder_lines(inner_radius, outer_radius, height, y_offset=0.0)[source]#

Return the line coordinate pairs defining a cylinder

Parameters:
  • inner_radius (float) – Radius of the hollow center

  • outer_radius (float) – Outer radius of the cylinder

  • height (float) – Height of the cylinder

Returns:

list of line segment coordinate pairs

Return type:

list of (numpy.array, numpy.array) tuples

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.datum_planes(xvector, zvector)[source]#

Calculate the sphere partitioning datum plane normal vectors on a local coordinate system

The x- and z-vectors must be orthogonal. They will be normalized prior to calculating the normalized plane normal vectors.

Parameters:
  • xvector (list) – List of three (3) floats defining the local x-axis vector in global coordinate space

  • zvector (list) – List of three (3) floats defining the local z-axis vector in global coordinate space

Returns:

list of normalized local plane normal vectors [9, 3] - (3) xy/yz/zx planes, (6) +/- 45 degrees from xy/yz/zx planes

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.fortyfive_vectors(xvector, zvector)[source]#

Return the normalized (1, 1, 1) vector variants of a local coordinate system defined by the x- and z-vector

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.is_parallel(first, second, rtol=None, atol=None)[source]#

Compute cross product. If it is near zero, return True. Else False.

Parameters:
  • first (numpy.array) – First vector

  • second (numpy.array) – Second vector

Returns:

boolean answering “are these vectors parallel?”

Return type:

bool

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.lines_and_splines(coordinates, euclidean_distance, rtol=None, atol=None)[source]#

Accept a [N, 2] numpy array of XY coordinates and return line point pairs and splines

Array is broken into a list of [M, 2] arrays according to the following rules

  1. If neighboring points are farther apart than the euclidean distance, break the original array between them.

  2. If neighboring points have the same X or Y coordinate (horizontally or vertically aligned), break the original array between them. Uses numpy.isclose with the default tolerance for float comparison.

After breaking into a list of arrays, the line pair list and spline list are generated from the following rules

  1. Line point pairs are returned for the end and beginning of adjacent arrays, and for the end of the last array and the beginning of the first array.

  2. Arrays of length 2 are converted to line pair coordinates

  3. Arrays greater than length 2 are kept intact as splines.

Parameters:
  • coordinates (numpy.array) – [N, 2] array of XY coordinates.

  • euclidean_distance (float) – If the distance between two points is greater than this, draw a straight line.

  • rtol (float) – relative tolerance used by numpy.isclose. If None, use the numpy default.

  • atol (float) – absolute tolerance used by numpy.isclose. If None, use the numpy default.

Returns:

list of line pairs and list of spline arrays

Return type:

tuple

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.midpoint_vector(first, second, third=None)[source]#

Calculate the vector between two vectors (summation / 2)

Parameters:
  • first (numpy.array) – First vector

  • second (numpy.array) – Second vector

Returns:

Vector midway between first and second vector

Return type:

numpy.array

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.normalize_vector(vector)[source]#

Normalize a cartesian vector

Parameters:

vector (list) – List of three floats defining a cartesian vector

Returns:

normalized

Return type:

numpy.array

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.ordered_lines_and_splines(coordinates, euclidean_distance, rtol=None, atol=None)[source]#

Return a single, closed loop list of [M, 2] arrays with lines (length 2) and splines (length >2)

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.pyramid_surfaces(center, xvector, zvector, big_number)[source]#

Return the pyramid surfaces defined by the center and vertices of a cube

Returns arrays of [N, 2] coordinates defining 12 triangular surfaces and 6 square surfaces defining the 4 edge pyramids from the center of a cube to the cube vertices.

Returns:

list of numpy arrays, where each numpy array is an [N, 3] list of coordinates defining a surface

Return type:

list of numpy.array

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.rectalinear_coordinates(radius_list, angle_list)[source]#

Calculate 2D rectalinear XY coordinates from 2D polar coordinates

Parameters:
  • radius (list) – length N list of polar coordinate radius

  • angle (list) – length N list of polar coordinate angle measured from the positive X-axis in radians

Returns coords:

length N tuple of tuple(X, Y) rectalinear coordinates

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.scale_and_offset_coordinates(coordinates, unit_conversion=1.0, y_offset=0.0)[source]#

Scale and offset XY coordinates in a 2 column numpy array

First multiply by the unit conversion. Then offset the Y coordinates (2nd column) by adding the y offset

Parameters:
  • coordinates (numpy.array) – [N, 2] array of XY coordinates.

  • unit_conversion (float) – multiplication factor applies to all coordinates

  • y_offset (float) – vertical offset along the global Y-axis. Offset should be provided in units after the unit conversion.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.sphere(center, inner_radius, outer_radius, quadrant)[source]#

Return the inner and outer radii vertices defining a 2D sketh of a sphere for revolution

Parameters:
  • center (tuple) – tuple of floats (X, Y) location for the center of the sphere

  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

Returns:

[4, 2] inner/outer radii in (x, y) coordinates defining inner/outer circular arc segments

Return type:

numpy.array

_mixed_utilities#

Python 2/3 compatible utilities for use in both Abaqus Python scripts and Turbo-Turtle Python 3 modules

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities._element_type_regex(content, element_type)[source]#

Place element type in Abaqus element keywords. RegEx uses MULTILINE and IGNORECASE

Parameters:
  • content (str) – String of Abaqus keyword text

  • element_type (str) – New element type to place in the *element, type= text

Returns:

substituted element type keyword text

Return type:

str

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.cubit_part_names(part_name)[source]#

Replace hyphens with underscores in strings for ACIS name compliance

Parameters:

part_name (list) – list of strings for character replacement(s)

Returns:

modified list of part names

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.intersection_of_lists(requested, available)[source]#

Return sorted intersection of available and requested items or all available items if none requested

Parameters:
  • requested (list) – requested items

  • available (list) – available items

Returns:

intersection of requested and available items. All available items if None requested.

Ttype:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.print_exception_message(function)[source]#

Decorate a function to catch bare exception and instead call sys.exit with the message

Parameters:

function – function to decorate

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.remove_duplicate_items(string_list)[source]#

Remove duplicates from string_list and print a warning to STDERR of all duplicates removed

Parameters:

string_list (list) – list of strings to remove duplicates

Returns:

unique strings

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.return_genfromtxt(file_name, delimiter=',', header_lines=0, expected_dimensions=None, expected_columns=None)[source]#

Parse a text file of XY coordinates into a numpy array

If the resulting numpy array doesn’t have the specified dimensions or column count, return an error exit code

Parameters:
  • file_name (str) – input text file with coordinates to draw

  • delimiter (str) – character to use as a delimiter when reading the input file

  • header_lines (int) – number of lines in the header to skip when reading the input file

Returns:

2D array of XY coordinates with shape [N, 2]

Return type:

numpy.array

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.substitute_element_type(mesh_file, element_type)[source]#

Use regular expressions to substitute element types in an existing orphan mesh file via the *Element keyword.

Parameters:
  • mesh_file (str) – existing orphan mesh file

  • element_type (str) – element type to substitute into the *Element keyword phrase

Returns:

re-writes mesh_file if element type changes have been made

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.sys_exit(err)[source]#

Thin wrapper on sys.exit to force print to STDERR from Abaqus Python

Preserves Python 3 compatibility by performing a Python major version check prior to the Python 2 syntax call to print.

Parameters:

err (Exception) – The exception object to print and pass to sys.exit

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.validate_element_type(length_part_name, element_type)[source]#

Validate the structure of the element_type list to the following rules:

  • If the length of element_type is 1, propagate to match length_part_name

  • Raise a RuntimeError if element_type is greater than 1, but not equal to the length of part_name

Parameters:
  • length_part_name (int) – length of the part_name list

  • element_type (list) – list of element types

Returns:

element types

Return type:

list

turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities.validate_part_name(input_file, part_name)[source]#

Validate the structure of the part_name list to the following rules:

  • If part_name is [None], assign the base names of input_file to part_name

  • Else if the length of part_name is not equal to the length of input_file, raise an exception

Parameters:
  • input_file (list) – input text file(s) with coordinates to draw

  • part_name (list) – name(s) of part(s) being created

Returns:

part name(s)

Return type:

list

_mixed_settings#

Python 2/3 compatible settings for use in both Abaqus Python scripts and Turbo-Turtle Python 3 modules

Abaqus Python#

These modules are intended purely for Abaqus Python use, but may freely use the mixed Python 2/3 compatible modules and other Abaqus Python modules. For the purposes of Sphinx compatible documentation, Abaqus package imports are not located at the module level. Abaqus Python imports must be made in each function where they are used.

Internal package imports must treat the turbo_turtle_abaqus directory as the Abaqus Python compatible package root to avoid accidentally placing Python 3 packages in PYTHONPATH before Abaqus Python packages. This is managed by common boilerplate to modify sys.path. The boilerplate is irreducible and must be duplicated in each module because the modified import path is not available until after the sys.path modification.

_abaqus_utilities#

class turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.AbaqusNamedTemporaryFile(input_file, *args, **kwargs)[source]#

Open an Abaqus CAE input_file as a temporary file. Close and delete on exit of context manager.

Provides Windows compatible temporary file handling. Required until Python 3.12 delete_on_close=False option is available in Abaqus Python.

Parameters:

input_file (str) – The input file to copy before open

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities._conditionally_create_model(model_name)[source]#

Create a new model in an Abaqus database if the specified model name is not already existing

Parameters:

model_name (str) – Abaqus model name

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities._view_part(model_name, part_name, **kwargs)[source]#

Place a part in the current viewport as a GUI post-action

Depending on if part_name is a list or a string, either place the last part in the list or the string part name in the viewport.

This function requires the arguments documented below, and any other arguments will be unpacked but ignored. This behavior makes it convenient to use this function generally with the arguments of any of the GUI plug-in actions (so long as those documented below are present).

Parameters:
  • model_name (str) – name of the Abaqus model to query in the post-action

  • part_name (str/list) – name of the part to place in the viewport. If list type, use the last part name in the list. If str type, use that part name directly.

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.edge_seeds(part, name_number)[source]#

Seed edges by number (if passed integer) or size (if passed float)

Parameters:
  • part (abaqus.models[model].parts[part]) – Abaqus part object

  • feature (str) – Abaqus part geometric attribute, e.g. ‘faces’, ‘edges’

Raises:

ValueError – If any number is negative

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.gui_wrapper(inputs_function, subcommand_function, post_action_function=None)[source]#

Wrapper for a function calling abaqus.getInputs, then the wrapper calls a turbo_turtle subcommand module

inputs_function cannot have any function arguments. inputs_function must return a dictionary of key-value pairs that match the subcommand_function arguments. post_action_function must have identical arguments to subcommand_function or the ability to ignore provided arguments. Any return values from post_action_function will have no affect.

This wrapper expects the dictionary output from inputs_function to be empty when the GUI interface is exited early (escape or cancel). Otherwise, the dictionary will be unpacked as **kwargs into subcommand_function and post_action_function.

Parameters:
  • inputs_function (func) – function to get user inputs through the Abaqus CAE GUI

  • subcommand_function (func) – function with arguments matching the return values from inputs_function

  • post_action_function (func) – function to call for script actions after calling subcommand_function

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.part_dimensionality(part)[source]#

Return part dimensionality as an int

Parameters:

part (abaqus.models[model].parts[part]) – Abaqus part object

Returns:

integer number of part dimensions

Return type:

int

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.part_dimensionality_key(part)[source]#

Get the Abaqus dimensionality key for the current part

Parameters:

part (abaqus.models[model].parts[part]) – Abaqus part object

Returns:

part dimensionality

Return type:

str

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.return_abaqus_constant(search)[source]#

If search is found in the abaqusConstants module, return the abaqusConstants object.

Raise a ValueError if the search string is not found.

Parameters:

search (str) – string to search in the abaqusConstants module attributes

Return value:

abaqusConstants attribute

Return type:

abaqusConstants.<search>

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.revolution_direction(revolution_angle)[source]#

Pick revolution direction constant consistent with +Y revolve direction

Positive rotation angles should result in +Y revolve direction (abaqusConstants.ON) Negative rotation angles should result in -Y revolve direction (abaqusConstants.OFF)

Parameters:

revolution_angle (float) – angle of solid revolution for 3D geometries

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.set_from_mask(part, feature, name_mask)[source]#

Create named set(s) from the geometric feature and mask(s)

Parameters:
  • part (abaqus.models[model].parts[part]) – Abaqus part object

  • feature (str) – Abaqus part geometric attribute, e.g. ‘faces’, ‘edges’, ‘vertices’

  • name_mask (list[tuple[str, str]]) – List of set name/mask tuples to create

Raises:

RuntimeError – If Abaqus throws an empty sequence abaqus.AbaqusException on one or more masks

turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities.surface_from_mask(part, feature, name_mask)[source]#

Create named surface(s) from the geometric feature and mask(s)

Parameters:
  • part (abaqus.models[model].parts[part]) – Abaqus part object

  • feature (str) – Abaqus part geometric attribute, e.g. ‘faces’, ‘edges’

  • name_mask (list[tuple[str, str]]) – List of set name/mask tuples to create

Raises:
  • ValueError – If feature is not one of ‘faces’ or ‘edges’

  • RuntimeError – If Abaqus throws an empty sequence abaqus.AbaqusException on one or more masks

geometry#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.geometry._gui()[source]#

Function with no inputs required for driving the plugin

turbo_turtle._abaqus_python.turbo_turtle_abaqus.geometry._gui_get_inputs()[source]#

Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._geometry_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Input File(s) - glob statement or comma separated list of files (NO SPACES) with points in x-y coordinates

  • Part Name(s) - part names for the parts being created. If None, then part name is determined by the input

    files. This must either None, a single part name, or a comma separated list of part names (NO SPACES)

  • Model Name - parts will be created in a new model with this name

  • Unit Conversion - unit conversion multiplication factor

  • Euclidean Distance - connect points with a straight line if the distance between them is larger than this

  • Planar Geometry Switch - switch to indicate that the 2D model is planar not axisymmetric (True for planar)

  • Revolution Angle - revolution angle for a 3D part in degrees

  • Delimiter - delimiter character between columns in the input file(s)

  • Header Lines - number of header lines to skip in the input file(s)

  • Y-Offset - offset along the global y-axis

  • rtol - relative tolerance used by numpy.isclose. If None, use numpy defaults

  • atol - absolute tolerance used by numpy.isclose. If None, use numpy defaults

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in geometry

return:

user_inputs - a dictionary of the following key-value pair types:

  • input_file: list type, input text files with points in x-y coordinates

  • part_name: list type, part names, one for each input file, or None

  • model_name: str type, new model containing the part generated from the input file(s)

  • unit_conversion: float type, unit conversion multiplication factor

  • euclidean_distance: float type, distance between points for deciding to draw a straight line

  • planar: bool type, switch for making 2D geometry planar, instead of axisymmetric

  • revolution_angle: float type, revolution angle in degrees for 3D geometry

  • delimiter: str type, delimiter character between columns in the input file(s)

  • header_lines: int type, number of header lines to skip in the input file(s)

  • y_offset: float type, offset along the y-axis

  • rtol: float type, relative tolerance used by numpy.isclose. If None, use numpy defaults

  • atol: float type, absolute tolerance used by numpy.isclose. If None, use numpy defaults

raises RuntimeError:

if at least one input file is not specified

turbo_turtle._abaqus_python.turbo_turtle_abaqus.geometry.draw_part_from_splines(
lines,
splines,
planar=False,
model_name='Model-1',
part_name=[None],
euclidean_distance=4.0,
revolution_angle=360.0,
rtol=None,
atol=None,
)[source]#

Given a series of line/spline definitions, draw lines/splines in an Abaqus sketch and generate either a 2D part or a 3D body of revolution about the global Y-axis using the sketch. A 2D part can be either axisymmetric or planar depending on the planar and revolution_angle parameters.

If planar is False and revolution_angle is equal (numpy.isclose()) to zero, this script will attempt to create a 2D axisymmetric model.

If planar is False and revolution_angle is not zero, this script will attempt to create a 3D body of revolution about the global Y-axis.

The default behavior of assuming planar=False implies that the sketch must lie entirely on the positive-X side of the global Y-axis, which is the constraint for both 2D axisymmetric and 3D revolved bodies.

If planar is True, this script will attempt to create a 2D planar model, which can be sketched in any/all four quadrants.

Note: This function will always connect the first and last coordinates

Parameters:
  • lines (list) – list of [2, 2] shaped arrays of (x, y) coordinates defining a line segment

  • splines (list) – list of [N, 2] shaped arrays of (x, y) coordinates defining a spline

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • model_name (str) – name of the Abaqus model in which to create the part

  • part_name (str) – name of the part being created

  • euclidean_distance (float) – if the distance between two coordinates is greater than this, draw a straight line.

  • revolution_angle (float) – angle of solid revolution for 3D geometries

Returns:

creates {part_name} within an Abaqus CAE database, not yet saved to local memory

turbo_turtle._abaqus_python.turbo_turtle_abaqus.geometry.geometry(
input_file,
planar,
model_name,
part_name,
revolution_angle,
delimiter,
header_lines,
euclidean_distance,
unit_conversion,
y_offset,
rtol,
atol,
)[source]#

Create 2D planar, 2D axisymmetric, or 3D revolved geometry from an array of XY coordinates.

This function drive the geometry creation of 2D planar, 2D axisymetric, or 3D revolved bodies and operates on a new Abaqus moddel database object.

Parameters:
  • input_file (str) – input text file(s) with coordinates to draw

  • output_file (str) – Abaqus CAE database to save the part(s)

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • model_name (str) – name of the Abaqus model in which to create the part

  • part_name (list) – name(s) of the part(s) being created

  • unit_conversion (float) – multiplication factor applies to all coordinates

  • euclidean_distance (float) – if the distance between two coordinates is greater than this, draw a straight line. Distance should be provided in units after the unit conversion

  • delimiter (str) – character to use as a delimiter when reading the input file

  • header_lines (int) – number of lines in the header to skip when reading the input file

  • revolution_angle (float) – angle of solid revolution for 3D geometries

  • y_offset (float) – vertical offset along the global Y-axis. Offset should be provided in units after the unit conversion.

  • rtol (float) – relative tolerance for vertical/horizontal line checks

  • atol (float) – absolute tolerance for vertical/horizontal line checks

Raises:

RuntimeError – failure to create a sketch or part from a CSV file.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.geometry.main(
input_file,
output_file,
planar=False,
model_name='Model-1',
part_name=[None],
unit_conversion=1.0,
euclidean_distance=4.0,
delimiter=',',
header_lines=0,
revolution_angle=360.0,
y_offset=0.0,
rtol=None,
atol=None,
)[source]#

Create 2D planar, 2D axisymmetric, or 3D revolved geometry from an array of XY coordinates.

This script takes an array of XY coordinates from a text file and creates a 2D sketch or 3D body of revolution about the global Y-axis. Note that 2D axisymmetric sketches and sketches for 3D bodies of revolution about the global Y-axis must lie entirely on the positive-X side of the global Y-axis. In general, a 2D sketch can lie in all four quadrants; this is referred to as a “planar” sketch and requires that the planar boolean arugment be set to True. This script can accept multiple input files to create multiple parts in the same Abaqus model. The part_name parameter allows explicit naming of part(s) in the model. If omitted from the command line arguments, the default is to use the input file basename(s) as the part name(s).

Parameters:
  • input_file (str) – input text file(s) with coordinates to draw

  • output_file (str) – Abaqus CAE database to save the part(s)

  • planar (bool) – switch to indicate that 2D model dimensionality is planar, not axisymmetric

  • model_name (str) – name of the Abaqus model in which to create the part

  • part_name (list) – name(s) of the part(s) being created

  • unit_conversion (float) – multiplication factor applies to all coordinates

  • euclidean_distance (float) – if the distance between two coordinates is greater than this, draw a straight line. Distance should be provided in units after the unit conversion

  • delimiter (str) – character to use as a delimiter when reading the input file

  • header_lines (int) – number of lines in the header to skip when reading the input file

  • revolution_angle (float) – angle of solid revolution for 3D geometries

  • y_offset (float) – vertical offset along the global Y-axis. Offset should be provided in units after the unit conversion.

  • rtol (float) – relative tolerance for vertical/horizontal line checks

  • atol (float) – absolute tolerance for vertical/horizontal line checks

Returns:

writes {output_file}.cae

cylinder#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.cylinder._gui()[source]#

Function with no inputs required for driving the plugin

turbo_turtle._abaqus_python.turbo_turtle_abaqus.cylinder._gui_get_inputs()[source]#

Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._cylinder_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Part Name - part name for the cylinder being created.

  • Model Name - parts will be created in a new model with this name

  • Inner Radius - inner radius of the cylinder

  • Outer Radius - outer radius of the cylinder

  • Height - height of the cylinder

  • Revolution Angle - revolution angle for a 3D part in degrees

  • Y-Offset - offset along the global y-axis

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in cylinder

return:

user_inputs - a dictionary of the following key-value pair types:

  • part_name: str type, part name of the cylinder

  • model_name: str type, new model containing the part generated from the input file(s)

  • inner_radius: float type, inner radius of the cylinder

  • outer_radius: float type, outer radius of the cylinder

  • height: float type, height of the cylinder

  • revolution_angle: float type, revolution angle in degrees for 3D geometry

  • y_offset: float type, offset along the y-axis

raises RuntimeError:

if inner radius, outer radius, or height are not specified.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.cylinder.cylinder(inner_radius, outer_radius, height, y_offset, model_name, part_name, revolution_angle)[source]#

Accept dimensions of a right circular cylinder and generate an axisymmetric revolved geometry

This function drives the geometry creation of a cylinder whose axis of symmetry is located on the global coordinate origin by default, and always on the global Y-axis.

Parameters:
  • inner_radius (float) – Radius of the hollow center

  • outer_radius (float) – Outer radius of the cylinder

  • height (float) – Height of the cylinder

  • y_offset (float) – vertical offset along the global Y-axis

  • model_name (str) – name of the Abaqus model in which to create the part

  • part_name (list) – name(s) of the part(s) being created

  • revolution_angle (float) – angle of solid revolution for 3D geometries

turbo_turtle._abaqus_python.turbo_turtle_abaqus.cylinder.main(
inner_radius,
outer_radius,
height,
output_file,
model_name='Model-1',
part_name='Part-1',
revolution_angle=360.0,
y_offset=0.0,
)[source]#

Accept dimensions of a right circular cylinder and generate an axisymmetric revolved geometry

Centroid of cylinder is located on the global coordinate origin by default.

Parameters:
  • inner_radius (float) – Radius of the hollow center

  • outer_radius (float) – Outer radius of the cylinder

  • height (float) – Height of the cylinder

  • output_file (str) – Abaqus CAE database to save the part(s)

  • model_name (str) – name of the Abaqus model in which to create the part

  • part_name (list) – name(s) of the part(s) being created

  • revolution_angle (float) – angle of solid revolution for 3D geometries

  • y_offset (float) – vertical offset along the global Y-axis

sphere#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sphere._gui()[source]#

Function with no inputs required for driving the plugin

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sphere._gui_get_inputs()[source]#

Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._sphere_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Part Name - part name for the sphere being created.

  • Model Name - parts will be created in a new model with this name

  • Inner Radius - inner radius of the sphere

  • Outer Radius - outer radius of the sphere

  • Revolution Angle - revolution angle for a 3D part in degrees

  • Y-Offset - offset along the global y-axis

  • Quadrant - XY plane quadrant for drawing the sphere. Choose from ‘both’, ‘upper’, or ‘lower’

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in sphere

return:

user_inputs - a dictionary of the following key-value pair types:

  • part_name: str type, part name of the sphere

  • model_name: str type, new model containing the part generated from the input file(s)

  • inner_radius: float type, inner radius of the sphere

  • outer_radius: float type, outer radius of the sphere

  • revolution_angle: float type, revolution angle in degrees for 3D geometry

  • y_offset: float type, offset along the y-axis

  • quadrant: str type, XY plane quadrant for drawing the sphere

raises RuntimeError:

if inner radius or outer radius are not specified.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sphere._validate_sphere_quadrant(quadrant, valid_quadrants)[source]#

Validate the user-provided sphere quadrant against a provided list of valid quadrants

Parameters:
  • quadrant (str) – user provided sphere quadrant

  • valid_quadrants (list) – valid quadrant to check against

Raises:

RuntimError – if user provided quadrant is invalid

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sphere.main(
inner_radius,
outer_radius,
output_file,
input_file=None,
quadrant='both',
revolution_angle=360.0,
y_offset=0.0,
model_name='Model-1',
part_name='Part-1',
)[source]#

Wrap sphere function with file open and file write operations

Parameters:
  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • output_file (str) – output file name. Will be stripped of the extension and .cae will be used.

  • input_file (str) – input file name. Will be stripped of the extension and .cae will be used.

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

  • revolution_angle (float) – angle of rotation 0.-360.0 degrees. Provide 0 for a 2D axisymmetric model.

  • y_offset (float) – vertical offset along the global Y-axis

  • model_name (str) – name of the Abaqus model

  • part_name (str) – name of the part to be created in the Abaqus model

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sphere.sphere(
inner_radius,
outer_radius,
center=(0.0, 0.0),
quadrant='both',
revolution_angle=360.0,
model_name='Model-1',
part_name='Part-1',
)[source]#

Create a hollow, spherical geometry from a sketch in the X-Y plane with upper (+X+Y), lower (+X-Y), or both quadrants.

Warning

The lower quadrant creation is currently broken

Parameters:
  • inner_radius (float) – inner radius (size of hollow)

  • outer_radius (float) – outer radius (size of sphere)

  • center (tuple) – tuple of floats (X, Y) location for the center of the sphere

  • quadrant (str) – quadrant of XY plane for the sketch: upper (I), lower (IV), both

  • revolution_angle (float) – angle of rotation 0.-360.0 degrees. Provide 0 for a 2D axisymmetric model.

  • model_name (str) – name of the Abaqus model

  • part_name (str) – name of the part to be created in the Abaqus model

partition#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition._gui()[source]#

Function with no inputs that drives the plug-in

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition._gui_get_inputs()[source]#

Partition Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._partition_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Center - center location of the geometry

  • X-Vector - location on the x-axis local to the geometry

  • Z-Vector - location on the z-axis local to the geometry

  • Part Name(s) - part name(s) to partition as a comma separated list (NO SPACES). This can also be a glob statement

  • Copy and Paste Parameters - copy and paste the parameters printed to the Abaqus Python terminal to make re-use of previous partition parameters easier

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in partition

return:

user_inputs - a dictionary of the following key-value pair types:

  • center: list type, center location of the geometry

  • xvector: list type, location on the x-axis local to the geometry

  • zvector: list type, location on the z-axis local to the geometry

  • model_name: str type, name of the model in the current viewport

  • part_name: list type, name of the part in the current viewport, or a list of all part names in the model

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition.datum_axis(center, vector, part)[source]#

Return an Abaqus DataAxis object by center and normal axis

Parameters:
  • center (numpy.array) – center location of the axis

  • vector (numpy.array) – axis vector

  • part (abaqus.mdb.models[].parts[]) – Abaqus part object

Returns:

Abaqus datum axis object

Return type:

DatumAxis

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition.datum_plane(center, normal, part)[source]#

Return an Abaqus DataPlane object by center and normal axis

Parameters:
  • center (numpy.array) – center location of the plane

  • normal (numpy.array) – plane normal vector

  • part (abaqus.mdb.models[].parts[]) – Abaqus part object

Returns:

Abaqus Datum Plane object

Return type:

DatumPlane

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition.main(
input_file,
output_file=None,
center=[0.0, 0.0, 0.0],
xvector=[1.0, 0.0, 0.0],
zvector=[0.0, 0.0, 1.0],
model_name='Model-1',
part_name=['Part-1'],
big_number=1000000.0,
)[source]#

Wrap partition function with file open and file write operations

Parameters:
  • input_file (str) – Abaqus CAE model database to open

  • output_file (str) – Abaqus CAE model database to write. If none is provided, use the input file.

  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • model_name (str) – model to query in the Abaqus model database (only applies when used with abaqus cae -nogui)

  • part_name (list) – list of parts to query in the specified Abaqus model (only applies when used with abaqus cae -nogui)

  • big_number (float) – Number larger than the outer radius of the part to partition.

Returns:

Abaqus CAE database named {output_file}.cae

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition.partition(center, xvector, zvector, model_name, part_name, big_number=1000000.0)[source]#

Partition the model/part with the turtle shell method, also know as the soccer ball method.

If the body is modeled with fractional symmetry (e.g. quater or half symmetry), this code will attempt all partitioning and face removal actions anyways. If certain aspects of the code fail, the code will move on and give no errors.

Note: It is possible to create strange looking partitions if inputs are not defined properly. Always check your partitions visually after using this tool.

Parameters:
  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • model_name (str) – model to query in the Abaqus model database (only applies when used with abaqus cae -nogui)

  • part_name (list) – list of parts to query in the specified Abaqus model (only applies when used with abaqus cae -nogui)

  • big_number (float) – Number larger than the outer radius of the part to partition.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition.partition_2d(model_name, part_name, center, big_number, sketch_vertex_pairs)[source]#

Partition a 2D-axisymmetric part by three lines using the same vertex pairs computed for the 3D case

Parameters:
  • model_name (str) – model to query in the Abaqus model database (only applies when used with abaqus cae -nogui)

  • part_name (list) – list of parts to query in the specified Abaqus model (only applies when used with abaqus cae -nogui)

  • center (list) – center location of the geometry

  • big_number (float) – Number larger than the outer radius of the part to partition.

  • sketch_vertex_pairs (tuple) – Tuple of vertices that make up the 3D partioning scheme’s sketch (See turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.rectalinear_coordinates())

turbo_turtle._abaqus_python.turbo_turtle_abaqus.partition.partition_3d(model_name, part_name, center, xvector, yvector, zvector, sketch_vertex_pairs)[source]#

Partition a 3D-revolved part by using the turtle shell method, also known as the soccer ball method.

Parameters:
  • model_name (str) – model to query in the Abaqus model database (only applies when used with abaqus cae -nogui)

  • part_name (list) – list of parts to query in the specified Abaqus model (only applies when used with abaqus cae -nogui)

  • center (list) – center location of the geometry

  • xvector (list) – Local x-axis vector defined in global coordinates

  • yvector (list) – Local y-axis vector defined in global coordinates

  • zvector (list) – Local z-axis vector defined in global coordinates

  • sketch_vertex_pairs (tuple) – Tuple of vertices that make up the 3D partioning scheme’s sketch (See turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices.rectalinear_coordinates())

sets#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sets.main(
input_file,
face_sets=None,
edge_sets=None,
vertex_sets=None,
output_file=None,
model_name='Model-1',
part_name='Part-1',
)[source]#

Wrap sets function for input file handling

Parameters:
  • input_file (str) – Abaqus CAE file to open that already contains a model with a part to be meshed

  • face_sets (list[tuple[str, str]]) – Face set tuples (name, mask)

  • edge_sets (list[tuple[str, str]]) – Edge set tuples (name, mask)

  • vertex_sets (list[tuple[str, str]]) – Vertex set tuples (name, mask)

  • output_file (str) – Abaqus CAE file to save with the newly meshed part

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

turbo_turtle._abaqus_python.turbo_turtle_abaqus.sets.sets(face_sets=None, edge_sets=None, vertex_sets=None, model_name='Model-1', part_name='Part-1')[source]#

Create sets from masks

Parameters:
  • face_sets (list[tuple[str, str]]) – Face set tuples (name, mask)

  • edge_sets (list[tuple[str, str]]) – Edge set tuples (name, mask)

  • vertex_sets (list[tuple[str, str]]) – Vertex set tuples (name, mask)

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

Raises:

RuntimeError – Collection of all set creation RuntimeError(s)

mesh_module#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.mesh_module._gui()[source]#

Function with no inputs that drives the plug-in

turbo_turtle._abaqus_python.turbo_turtle_abaqus.mesh_module._gui_get_default_elem_type(model_name, part_name)[source]#

Set default element types for the _gui_get_inputs_function

Use a one-time dump of the Abaqus default element types for known part dimensionality

Parameters:
  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

Returns:

element type from a hard-coded mapping of Abaqus default element types

Return type:

str

turbo_turtle._abaqus_python.turbo_turtle_abaqus.mesh_module._gui_get_inputs()[source]#

Mesh Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._mesh_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Part Name - part name to mesh

  • Element Type - a valid Abaqus element type for meshing the part

  • Global Seed - global seed value in the model’s units

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in mesh

return:

user_inputs - a dictionary of the following key-value pair types:

  • element_type: str type, valid Abaqus element type

  • model_name: str type, name of the model in the current viewport

  • part_name: list type, name of the part to mesh

  • global_seed: float type, global element seed

raises RuntimeError:

if a element type or global mesh seed are not specified.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.mesh_module.main(
input_file,
element_type,
output_file=None,
model_name='Model-1',
part_name='Part-1',
global_seed=1.0,
edge_seeds=None,
)[source]#

Wrap mesh function for input file handling

Parameters:
  • input_file (str) – Abaqus CAE file to open that already contains a model with a part to be meshed

  • element_type (str) – Abaqus element type

  • output_file (str) – Abaqus CAE file to save with the newly meshed part

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

  • global_seed (float) – The global mesh seed size

  • edge_seeds (list[tuple[str, number]]) – List of edge seed (name, number) pairs

turbo_turtle._abaqus_python.turbo_turtle_abaqus.mesh_module.mesh(element_type, model_name='Model-1', part_name='Part-1', global_seed=1.0, edge_seeds=None)[source]#

Apply a global seed, optional edge seed(s), and mesh the specified part

Always creates sets

  • ELEMENTS: All elements

  • NODES: All nodes

Parameters:
  • element_type (str) – Abaqus element type

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

  • global_seed (float) – The global mesh seed size

  • edge_seeds (list[tuple[str, number]]) – List of edge seed (name, number) pairs

image#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.image._gui()[source]#

Function with no inputs required for driving the plugin

turbo_turtle._abaqus_python.turbo_turtle_abaqus.image._gui_get_inputs()[source]#

Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._image_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Output File - output image file name (with ‘.png’ or ‘.svg’ extension)

  • Model Name - model to query

  • Part Name - part to query. If blank, assembly view will be queried

  • Color Map - valid Abaqus color map. Choose from: ‘Material’, ‘Section’, ‘Composite layup’, ‘Composite ply’, ‘Part’, ‘Part instance’, ‘Element set’, ‘Averaging region’, ‘Element type’, ‘Default’, ‘Assembly’, ‘Part geometry’, ‘Load’, ‘Boundary condition’, ‘Interaction’, ‘Constraint’, ‘Property’, ‘Meshability’, ‘Instance type’, ‘Set’, ‘Surface’, ‘Internal set’, ‘Internal surface’, ‘Display group’, ‘Selection group’, ‘Skin’, ‘Stringer’, ‘Cell’, ‘Face’

  • Image Size - size in pixels. Width, Height

  • X-Angle - rotation about x-axis in degrees

  • Y-Angle - rotation about y-axis in degrees

  • Z-Angle - rotation about z-axis in degrees

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in image

return:

user_inputs - a dictionary of the following key-value pair types:

  • output_file: str type, output file name

  • part_name: str type, part to query. If None the assembly view will be queried

  • model_name: str type, model to query

  • color_map: str type, valid Abaqus color map

  • image_size: list type, image size in pixels [width, height]

  • x_angle: float type, rotation about x-axis in degrees

  • y_angle: float type, rotation about y-axis in degrees

  • z_angle: float type, rotation about z-axis in degrees

raises RuntimeError:

if output_file is not specified, if output_file extension is not valid, if color_map is not valid

turbo_turtle._abaqus_python.turbo_turtle_abaqus.image._validate_color_map(color_map, valid_color_maps)[source]#

Validate the user-provided color map against a provided list of valid color maps

Parameters:
  • color_map (str) – user provided color map

  • valid_color_maps (list) – valid color maps to check against

Raises:

RuntimError – if user provided color map is invalid

turbo_turtle._abaqus_python.turbo_turtle_abaqus.image.image(
output_file,
x_angle=0.0,
y_angle=0.0,
z_angle=0.0,
image_size=[1920, 1080],
model_name='Model-1',
part_name=None,
color_map='Material',
)[source]#

Script for saving a part or assembly view image for a given Abaqus input file.

The color map is set to color by material. Finally, viewport is set to fit the view to the viewport screen.

If part_name is specified, an image of that part will be exported. If no part_name is specified, the model’s root assembly will be queried and if empty, all parts in the model will be instanced into the root assembly. Then, an image of the root assembly will be exported. The input_file is not modified to include any generated instances.

Parameters:
  • output_file (str) – Output image file. Supports *.png and *.svg.

  • x_angle (float) – Rotation about X-axis in degrees for abaqus.session.viewports[].view.rotate Abaqus Python method

  • y_angle (float) – Rotation about Y-axis in degrees for abaqus.session.viewports[].view.rotate Abaqus Python method

  • z_angle (float) – Rotation about Z-axis in degrees for abaqus.session.viewports[].view.rotate Abaqus Python method

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

  • color_map (str) – color map key

Returns:

writes image to {output_file}

Raises:

RuntimeError – if the extension of output_file is not recognized by Abaqus

turbo_turtle._abaqus_python.turbo_turtle_abaqus.image.main(
input_file,
output_file,
x_angle=0.0,
y_angle=0.0,
z_angle=0.0,
image_size=[1920, 1080],
model_name='Model-1',
part_name=None,
color_map='Material',
)[source]#

Wrap image with file input handling

Parameters:
  • input_file (str) – Abaqus input file. Suports *.inp and *.cae.

  • output_file (str) – Output image file. Supports *.png and *.svg.

  • x_angle (float) – Rotation about X-axis in degrees for abaqus.session.viewports[].view.rotate Abaqus Python method

  • y_angle (float) – Rotation about Y-axis in degrees for abaqus.session.viewports[].view.rotate Abaqus Python method

  • z_angle (float) – Rotation about Z-axis in degrees for abaqus.session.viewports[].view.rotate Abaqus Python method

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

  • color_map (str) – color map key

Returns:

writes image to {output_file}

merge#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.merge.main(input_file, output_file, merged_model_name='Model-1', model_name=[None], part_name=[None])[source]#

Merge parts from multiple Abaqus CAE files and models into one Abaqus CAE file and model

This script loops through all input file(s) specified and merges the intersection of provided model/part name(s) and available model/part combinations. Duplicate part names are removed from the part name list. If a part name exists in more than one model, return an error.

Parameters:
  • input_file (list) – Abaqus CAE file(s) to query for model(s)/part(s)

  • output_file (str) – Abaqus CAE file for saving the merged model

  • merged_model_name (str) – Abaqus model to merge into

  • model_name (list) – model name(s) to query

  • part_name (list) – part_names(s) to search for

Returns:

writes {output_file}.cae with the merged model

export#

turbo_turtle._abaqus_python.turbo_turtle_abaqus.export._gui()[source]#

Function with no inputs that drives the plug-in

turbo_turtle._abaqus_python.turbo_turtle_abaqus.export._gui_get_inputs()[source]#

Interactive Inputs

Prompt the user for inputs with this interactive data entry function. When called, this function opens an Abaqus CAE GUI window with text boxes to enter the values given below. Note to developers - if you update this ‘GUI-INPUTS’ below, also update _mixed_settings._export_gui_help_string that gets used as the GUI label.

GUI-INPUTS#

  • Model Name - model to query

  • Part Name - list of part names to query. Comma separated, no spaces (part-1 or part-1,part-2).

  • Element Type - list of element types, one per part, or one global replacement for every part. If blank, element type in the part will not be changed. Comma separated, no spaces (c3d8r or c3d8r,c3d8).

  • Destination - destination directory for orphan mesh files

  • Assembly File - file with assembly block keywords. If provided, and no instances are found, all part names are instanced before exporting the file.

IMPORTANT - this function must return key-value pairs that will successfully unpack as **kwargs in export

return:

user_inputs - a dictionary of the following key-value pair types:

  • model_name: str type, model to query

  • part_name: list type, part names to query

  • element_type: list type, element types one for each part or one global replacement

  • destination: str type, destination directory for orphan mesh files

  • assembly: str type, assembly keword block file. If provided and no instances are found, all part names are instanced before exporting the file.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.export.export(model_name, part_name, element_type, destination, assembly)[source]#

Driver function for exporting part and assembly files

Parameters:
  • model_name (str) – model to query in the Abaqus model database

  • part_name (list) – list of parts to query in the specified Abaqus model

  • element_type (list) – list of element types, one per part name or one global replacement for every part name

  • destination (str) – write output orphan mesh files to this output directory

  • assembly (str) – Assembly file for exporting the assembly keyword block. If provided and no instances are found, instance all part names before export.

turbo_turtle._abaqus_python.turbo_turtle_abaqus.export.export_mesh_file(output_file, model_name='Model-1', part_name='Part-1')[source]#

Export an orphan mesh from a single part

Parameters:
  • output_file (str) – Abaqus CAE file to save with the newly meshed part

  • model_name (str) – model to query in the Abaqus model database

  • part_name (str) – part to query in the specified Abaqus model

Returns:

writes output_file

turbo_turtle._abaqus_python.turbo_turtle_abaqus.export.export_multiple_parts(model_name, part_name, element_type, destination)[source]#

Export orphan mesh files for multiple parts, and allow element type changes

Specify a model name and one or multiple part names for exporting orphan mesh files. This function will write one orphan mesh file per part name specified, and the orphan mesh file name will be the part name.

Parameters:
  • model_name (str) – model to query in the Abaqus model database

  • part_name (list) – list of parts to query in the specified Abaqus model

  • element_type (list) – list of element types, one per part name or one global replacement for every part name

  • destination (str) – write output orphan mesh files to this output directory

Returns:

uses turbo_turtle._export.export() to write an orphan mesh file and optionally modifies element types with :turbo_turtle._export.substitute_element_type`

turbo_turtle._abaqus_python.turbo_turtle_abaqus.export.main(
input_file,
model_name='Model-1',
part_name=['Part-1'],
element_type=[None],
destination='/home/runner/work/turbo-turtle/turbo-turtle',
assembly=None,
)[source]#

Wrap orphan mesh export function for input file handling

Parameters:
  • input_file (str) – Abaqus CAE file to open that already contains a model with a part to be meshed

  • model_name (str) – model to query in the Abaqus model database

  • part_name (list) – list of parts to query in the specified Abaqus model

  • element_type (list) – list of element types, one per part name or one global replacement for every part name

  • destination (str) – write output orphan mesh files to this output directory

  • assembly (str) – Assembly file for exporting the assembly keyword block. If provided and no instances are found, instance all part names before export.

Abaqus Python tests#

These modules are intended purely for use in Abaqus Python. They do not need to be Python 3 compatible, but they may have corresponding Python 3 tests. These tests would be signifacantly improved by understanding and adding Abaqus Python mocking. Without mocking behavior, some of the Python 3 test conditions can not be replicated in Abaqus Python.

Abaqus python unit test files may be executed as abaqus python -m unittest discover <directory>, for example from the project root directory

$ /apps/abaqus/Commands/abq2024 python -m unittest discover turbo_turtle/_abaqus_python/turbo_turtle_abaqus

The test execution is also available as an SCons alias: test_abaqus_python, which is collected under the aliases: unittest and regression.

test_abaqus_utilities#

Note

These are tests of the pure Abaqus Python utilities. The test file may make Abaqus Python specific imports.

class turbo_turtle._abaqus_python.turbo_turtle_abaqus.test_abaqus_utilities.TestAbaqusUtilities(methodName='runTest')[source]#

Python unittest’s for turbo_turtle._abaqus_python.turbo_turtle_abaqus._abaqus_utilities()

test_mixed_utilities#

Warning

These tests are duplicates of the Python 3 tests in turbo_turtle.tests.test_mixed_utilities()

class turbo_turtle._abaqus_python.turbo_turtle_abaqus.test_mixed_utilities.TestMixedUtilities(methodName='runTest')[source]#

Abaqus Python unittests for turbo_turtle._abaqus_python.turbo_turtle_abaqus._mixed_utilities()

test_parsers#

Warning

These tests are duplicates of the Python 3 tests in turbo_turtle.tests.test_parsers()

class turbo_turtle._abaqus_python.turbo_turtle_abaqus.test_parsers.TestParsers(methodName='runTest')[source]#

Abaqus Python unittests for turbo_turtle._abaqus_python.turbo_turtle_abaqus.parsers()

test_vertices#

Warning

These tests are duplicates of the Python 3 tests in turbo_turtle.tests.test_vertices()

class turbo_turtle._abaqus_python.turbo_turtle_abaqus.test_vertices.TestVertices(methodName='runTest')[source]#

Python unittest’s for turbo_turtle._abaqus_python.turbo_turtle_abaqus.vertices()