Design#
- class ansys.geometry.core.designer.design.Design(name: str, modeler: ansys.geometry.core.modeler.Modeler, read_existing_design: bool = False)#
Bases:
ansys.geometry.core.designer.component.ComponentProvides for organizing geometry assemblies.
This class synchronizes to a supporting Geometry service instance.
- Parameters:
- name
str User-defined label for the design.
- grpc_client
GrpcClient Active supporting Geometry service instance for design modeling.
- read_existing_designbool, default:
False Whether an existing design on the service should be read. This parameter is only valid when connecting to an existing service session. Otherwise, avoid using this optional parameter.
- name
Warning
To ensure design objects are up to date, it is recommended to access design information (e.g. bodies, components, etc.) via the design instance properties and methods, rather than storing this information separately. For example, to get the bodies in a design, it is recommended to use
design.bodiesrather than storing the bodies in a separate variable (e.g.bodies = design.bodies) and using that variable for future reference. This is because the design may be updated after the initial retrieval of the bodies, which would make the separate variable out of date.
Overview#
Set the length scale. This can only be done if the design is empty. |
|
Close the design. |
|
Add a material to the design. |
|
Remove a material from the design. |
|
Export and download the design from the server. |
|
Export the design to an scdocx file. |
|
Export the design to a DISCO file. |
|
Export the design to a stride file. |
|
Export the design to a Parasolid text file. |
|
Export the design to a Parasolid binary file. |
|
Export the design to an FMD file. |
|
Export the design to a STEP file. |
|
Export the design to an IGES file. |
|
Export the design to a PMDB file. |
|
Export the design tessellation to a USD file. |
|
Export the design directly to a self-contained HTML viewer. |
|
Create a named selection on the active Geometry server instance. |
|
Delete a named selection on the active Geometry server instance. |
|
Delete a component (itself or its children). |
|
Set the shared topology to apply to the component. |
|
Add a new beam circular profile under the design for creating beams. |
|
Get parameters for the design. |
|
Set or update a parameter of the design. |
|
Add a mid-surface thickness to a list of bodies. |
|
Add a mid-surface offset type to a list of bodies. |
|
Remove a beam profile on the active geometry server instance. |
|
Insert a file into the design. |
|
Tessellate the entire design and return the geometry as triangles. |
The design’s object unique id. |
|
List of materials available for the design. |
|
List of named selections available for the design. |
|
List of beam profile available for the design. |
|
List of parameters available for the design. |
|
Whether the design is currently active. |
|
Whether the design is closed (i.e. not active). |
|
Length scale of the design. |
Represent the |
Import detail#
from ansys.geometry.core.designer.design import Design
Property detail#
- property Design.materials: list[ansys.geometry.core.materials.material.Material]#
List of materials available for the design.
- property Design.named_selections: list[ansys.geometry.core.designer.selection.NamedSelection]#
List of named selections available for the design.
- property Design.beam_profiles: list[ansys.geometry.core.designer.beam.BeamProfile]#
List of beam profile available for the design.
- property Design.parameters: list[ansys.geometry.core.parameters.parameter.Parameter]#
List of parameters available for the design.
- property Design.length_scale: LengthScale#
Length scale of the design.
Method detail#
- Design.set_length_scale(length_scale: LengthScale) bool#
Set the length scale. This can only be done if the design is empty.
- Parameters:
- length_scale
LengthScale The length scale to set for the design.
- length_scale
- Returns:
- bool
True if the length scale was successfully set, False otherwise.
Notes
This method is only available starting on Ansys release 27R1.
- Design.add_material(material: ansys.geometry.core.materials.material.Material) None#
Add a material to the design.
- Parameters:
- material
Material Material to add.
- material
- Design.remove_material(material: ansys.geometry.core.materials.material.Material | list[ansys.geometry.core.materials.material.Material]) None#
Remove a material from the design.
- Parameters:
- material
Material|list[Material] Material or list of materials to remove.
- material
- Design.download(file_location: pathlib.Path | str, format: DesignFileFormat = DesignFileFormat.SCDOCX, write_body_facets: bool = False, fmd_options: ansys.geometry.core.misc.options.FMDExportOptions | None = None, pmdb_options: ansys.geometry.core.misc.options.PMDBExportOptions | None = None) None#
Export and download the design from the server.
- Parameters:
- file_location
Path|str Location on disk to save the file to.
- format
DesignFileFormat, default:DesignFileFormat.SCDOCX Format for the file to save to.
- write_body_facetsbool, default:
False Option to write body facets into the saved file. SCDOCX and DISCO only, 26R1 and later.
- fmd_options
FMDExportOptions|None, default:None Options for FMD export. Only applicable when format is FMD.
- pmdb_options
PMDBExportOptions|None, default:None Options for PMDB export. Only applicable when format is PMDB.
- file_location
Warning
FMD and PMDB export options are only available in Ansys 27.1 and later products. If options are provided but the backend version does not support them, the options will be ignored.
- Design.export_to_scdocx(location: pathlib.Path | str | None = None, write_body_facets: bool = False) pathlib.Path#
Export the design to an scdocx file.
- Parameters:
- Returns:
PathThe path to the saved file.
- Design.export_to_disco(location: pathlib.Path | str | None = None, write_body_facets: bool = False) pathlib.Path#
Export the design to a DISCO file.
- Parameters:
- Returns:
PathThe path to the saved file.
- Design.export_to_stride(location: pathlib.Path | str | None = None) pathlib.Path#
Export the design to a stride file.
- Design.export_to_parasolid_text(location: pathlib.Path | str | None = None) pathlib.Path#
Export the design to a Parasolid text file.
- Design.export_to_parasolid_bin(location: pathlib.Path | str | None = None) pathlib.Path#
Export the design to a Parasolid binary file.
- Design.export_to_fmd(location: pathlib.Path | str | None = None, options: ansys.geometry.core.misc.options.FMDExportOptions | None = None) pathlib.Path#
Export the design to an FMD file.
- Parameters:
- Returns:
PathThe path to the saved file.
Warning
FMD export options are only available in Ansys 27.1 and later products. If options are provided but the backend version does not support them, a warning will be issued and the options will be ignored.
- Design.export_to_step(location: pathlib.Path | str | None = None) pathlib.Path#
Export the design to a STEP file.
- Design.export_to_iges(location: pathlib.Path | str = None) pathlib.Path#
Export the design to an IGES file.
- Design.export_to_pmdb(location: pathlib.Path | str | None = None, options: ansys.geometry.core.misc.options.PMDBExportOptions | None = None) pathlib.Path#
Export the design to a PMDB file.
- Design.export_to_usd(location: pathlib.Path | str | None = None, tess_options: ansys.geometry.core.misc.options.TessellationOptions | None = None, file_format: str = 'usda') pathlib.Path#
Export the design tessellation to a USD file.
Tessellates all bodies in the design and writes them to a Universal Scene Description (USD) file. The export preserves the full component/body hierarchy, mesh geometry, and per-body color as a
UsdPreviewSurfacematerial.- Parameters:
- location
Path|str|None, default:None Output directory. If
None, the file is saved in the current working directory using the design name as the filename.- tess_options
TessellationOptions|None, default:None Tessellation quality options. If
None, the server default is used.- file_format
str, default:"usda" USD file format. One of:
"usda"— USD ASCII (human-readable)"usdc"— USD binary crate (compact)"usdz"— USD zip archive (self-contained)"usd"— auto-detect (usd-core chooses binary or ASCII)
- location
- Returns:
PathPath to the saved USD file.
- Raises:
ImportErrorIf
usd-coreis not installed. Install with:pip install ansys-geometry-core[usd].GeometryRuntimeErrorIf
file_formatis not one of the valid values.
Examples
Export to binary USD in a specific directory:
>>> path = design.export_to_usd("output/", file_format="usdc")
- Design.export_to_html(location: pathlib.Path | str | None = None, tess_options: ansys.geometry.core.misc.options.TessellationOptions | None = None, show_mesh_lines: bool = True, line_color: str = '#ffffff', line_opacity: float = 0.9) pathlib.Path#
Export the design directly to a self-contained HTML viewer.
Tessellates all bodies in the design, builds an in-memory USD stage, and converts it to a Three.js HTML viewer in a single step — no intermediate USD file is written to disk.
- Parameters:
- location
Path|str|None, default:None Output directory. If
None, the file is saved in the current working directory using the design name as the filename.- tess_options
TessellationOptions|None, default:None Tessellation quality options. If
None, the server default is used.- show_mesh_linesbool, default:
True When
True, injects a wireframe overlay over each mesh in the viewer.- line_color
str, default:"#ffffff" CSS hex color for the mesh-edge overlay.
- line_opacity
float, default:0.9 Opacity of the mesh-edge overlay (
0.0–1.0).
- location
- Returns:
PathPath to the saved HTML file.
- Raises:
ImportErrorIf
usd-coreoransys-tools-visualization-interface[usd]is not installed. Install both with:pip install ansys-geometry-core[usd].
Examples
Export to a specific directory without the wireframe overlay:
>>> html_path = design.export_to_html("output/", show_mesh_lines=False)
- Design.create_named_selection(name: str, bodies: list[ansys.geometry.core.designer.body.Body] | None = None, faces: list[ansys.geometry.core.designer.face.Face] | None = None, edges: list[ansys.geometry.core.designer.edge.Edge] | None = None, beams: list[ansys.geometry.core.designer.beam.Beam] | None = None, design_points: list[ansys.geometry.core.designer.designpoint.DesignPoint] | None = None, components: list[ansys.geometry.core.designer.component.Component] | None = None, vertices: list[ansys.geometry.core.designer.vertex.Vertex] | None = None, design_curves: list[ansys.geometry.core.designer.designcurve.DesignCurve] | None = None, datum_planes: list[ansys.geometry.core.designer.datumplane.DatumPlane] | None = None, coordinate_systems: list[ansys.geometry.core.designer.coordinate_system.CoordinateSystem] | None = None, datum_points: list[ansys.geometry.core.designer.datumpoint.DatumPoint] | None = None) ansys.geometry.core.designer.selection.NamedSelection#
Create a named selection on the active Geometry server instance.
- Parameters:
- name
str User-defined name for the named selection.
- bodies
list[Body], default:None All bodies to include in the named selection.
- faces
list[Face], default:None All faces to include in the named selection.
- edges
list[Edge], default:None All edges to include in the named selection.
- beams
list[Beam], default:None All beams to include in the named selection.
- design_points
list[DesignPoint], default:None All design points to include in the named selection.
- components
list[Component], default:None All components to include in the named selection.
- vertices
list[Vertex], default:None All vertices to include in the named selection.
- design_curves
list[DesignCurve], default:None All design curves to include in the named selection.
- datum_planes
list[DatumPlane], default:None All datum planes to include in the named selection.
- coordinate_systems
list[CoordinateSystem], default:None All coordinate systems to include in the named selection.
- datum_points
list[DatumPoint], default:None All datum points to include in the named selection.
- name
- Returns:
NamedSelectionNewly created named selection that maintains references to all target entities.
- Raises:
ValueErrorIf no entities are provided for the named selection. At least one of the optional parameters must be provided.
- Design.delete_named_selection(named_selection: ansys.geometry.core.designer.selection.NamedSelection | str) None#
Delete a named selection on the active Geometry server instance.
- Parameters:
- named_selection
NamedSelection|str Name of the named selection or instance.
- named_selection
- Design.delete_component(component: ansys.geometry.core.designer.component.Component | str) None#
Delete a component (itself or its children).
- Parameters:
- id
Union[Component,str] Name of the component or instance to delete.
- id
- Raises:
ValueErrorThe design itself cannot be deleted.
Notes
If the component is not this component (or its children), it is not deleted.
Set the shared topology to apply to the component.
- Parameters:
- share_type
SharedTopologyType Shared topology type to assign.
- share_type
- Raises:
ValueErrorShared topology does not apply to a design.
- Design.add_beam_circular_profile(name: str, radius: pint.Quantity | ansys.geometry.core.misc.measurements.Distance, center: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.point.Point3D = ZERO_POINT3D, direction_x: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.vector.UnitVector3D | ansys.geometry.core.math.vector.Vector3D = UNITVECTOR3D_X, direction_y: numpy.ndarray | ansys.geometry.core.typing.RealSequence | ansys.geometry.core.math.vector.UnitVector3D | ansys.geometry.core.math.vector.Vector3D = UNITVECTOR3D_Y) ansys.geometry.core.designer.beam.BeamCircularProfile#
Add a new beam circular profile under the design for creating beams.
- Parameters:
- name
str User-defined label for the new beam circular profile.
- radius
Quantity|Distance Radius of the beam circular profile.
- center
ndarray|RealSequence|Point3D Center of the beam circular profile.
- direction_x
ndarray|RealSequence|UnitVector3D|Vector3D X-plane direction.
- direction_y
ndarray|RealSequence|UnitVector3D|Vector3D Y-plane direction.
- name
- Design.get_all_parameters() list[ansys.geometry.core.parameters.parameter.Parameter]#
Get parameters for the design.
- Returns:
list[Parameter]List of parameters for the design.
Warning
This method is only available starting on Ansys release 25R1.
- Design.set_parameter(dimension: ansys.geometry.core.parameters.parameter.Parameter) ansys.geometry.core.parameters.parameter.ParameterUpdateStatus#
Set or update a parameter of the design.
- Parameters:
- dimension
Parameter Parameter to set.
- dimension
- Returns:
ParameterUpdateStatusStatus of the update operation.
Warning
This method is only available starting on Ansys release 25R1.
- Design.add_midsurface_thickness(thickness: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, bodies: list[ansys.geometry.core.designer.body.Body]) None#
Add a mid-surface thickness to a list of bodies.
- Parameters:
Notes
Only surface bodies will be eligible for mid-surface thickness assignment.
- Design.add_midsurface_offset(offset_type: ansys.geometry.core.designer.body.MidSurfaceOffsetType, bodies: list[ansys.geometry.core.designer.body.Body]) None#
Add a mid-surface offset type to a list of bodies.
- Parameters:
- offset_type
MidSurfaceOffsetType Surface offset to be assigned.
- bodies
list[Body] All bodies to include in the mid-surface offset assignment.
- offset_type
Notes
Only surface bodies will be eligible for mid-surface offset assignment.
- Design.delete_beam_profile(beam_profile: ansys.geometry.core.designer.beam.BeamProfile | str) None#
Remove a beam profile on the active geometry server instance.
- Parameters:
- beam_profile
BeamProfile|str A beam profile name or instance that should be deleted.
- beam_profile
- Design.insert_file(file_location: pathlib.Path | str, import_options: ansys.geometry.core.misc.options.ImportOptions = ImportOptions(), import_options_definitions: ansys.geometry.core.misc.options.ImportOptionsDefinitions = ImportOptionsDefinitions()) ansys.geometry.core.designer.component.Component#
Insert a file into the design.
- Parameters:
- file_location
Path|str Location on disk where the file is located.
- import_options
ImportOptions,optional The options to pass into upload file. If none are provided, default options are used.
- import_options_definitions
ImportOptionsDefinitions,optional Additional options to pass into insert file. If none are provided, default options are used.
- file_location
- Returns:
ComponentThe newly inserted component.
Warning
This method is only available starting on Ansys release 24R2.
- Design.get_raw_tessellation(tess_options: ansys.geometry.core.misc.options.TessellationOptions | None = None, reset_cache: bool = False, include_faces: bool = True, include_edges: bool = False) dict#
Tessellate the entire design and return the geometry as triangles.
- Parameters:
- tess_options
TessellationOptions,optional Options for the tessellation. If None, default options are used.
- reset_cachebool, default:
False Whether to reset the cache before performing the tessellation.
- include_facesbool, default:
True Whether to include faces in the tessellation.
- include_edgesbool, default:
False Whether to include edges in the tessellation.
- tess_options
- Returns:
dictA dictionary with body IDs as keys and another dictionary as values. The inner dictionary has face and edge IDs as keys and the corresponding face/vertice arrays as values.