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.Component

Provides for organizing geometry assemblies.

This class synchronizes to a supporting Geometry service instance.

Parameters:
namestr

User-defined label for the design.

grpc_clientGrpcClient

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.

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.bodies rather 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#

close

Close the design.

add_material

Add a material to the design.

remove_material

Remove a material from the design.

save

Save a design to disk on the active Geometry server instance.

download

Export and download the design from the server.

export_to_scdocx

Export the design to an scdocx file.

export_to_disco

Export the design to a DISCO file.

export_to_stride

Export the design to a stride file.

export_to_parasolid_text

Export the design to a Parasolid text file.

export_to_parasolid_bin

Export the design to a Parasolid binary file.

export_to_fmd

Export the design to an FMD file.

export_to_step

Export the design to a STEP file.

export_to_iges

Export the design to an IGES file.

export_to_pmdb

Export the design to a PMDB file.

create_named_selection

Create a named selection on the active Geometry server instance.

delete_named_selection

Delete a named selection on the active Geometry server instance.

delete_component

Delete a component (itself or its children).

set_shared_topology

Set the shared topology to apply to the component.

add_beam_circular_profile

Add a new beam circular profile under the design for creating beams.

get_all_parameters

Get parameters for the design.

set_parameter

Set or update a parameter of the design.

add_midsurface_thickness

Add a mid-surface thickness to a list of bodies.

add_midsurface_offset

Add a mid-surface offset type to a list of bodies.

delete_beam_profile

Remove a beam profile on the active geometry server instance.

insert_file

Insert a file into the design.

get_raw_tessellation

Tessellate the entire design and return the geometry as triangles.

design_id

The design’s object unique id.

materials

List of materials available for the design.

named_selections

List of named selections available for the design.

beam_profiles

List of beam profile available for the design.

parameters

List of parameters available for the design.

is_active

Whether the design is currently active.

is_closed

Whether the design is closed (i.e. not active).

__repr__

Represent the Design as a string.

Import detail#

from ansys.geometry.core.designer.design import Design

Property detail#

property Design.design_id: str#

The design’s object unique id.

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.is_active: bool#

Whether the design is currently active.

property Design.is_closed: bool#

Whether the design is closed (i.e. not active).

Method detail#

Design.close() None#

Close the design.

Design.add_material(material: ansys.geometry.core.materials.material.Material) None#

Add a material to the design.

Parameters:
materialMaterial

Material to add.

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:
materialMaterial | list[Material]

Material or list of materials to remove.

Design.save(file_location: pathlib.Path | str, write_body_facets: bool = False) None#

Save a design to disk on the active Geometry server instance.

Parameters:
file_locationPath | str

Location on disk to save the file to.

write_body_facetsbool, default: False

Option to write body facets into the saved file. 26R1 and later.

Design.download(file_location: pathlib.Path | str, format: DesignFileFormat = DesignFileFormat.SCDOCX, write_body_facets: bool = False) None#

Export and download the design from the server.

Parameters:
file_locationPath | str

Location on disk to save the file to.

formatDesignFileFormat, 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.

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:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

write_body_facetsbool, default: False

Option to write body facets into the saved file. SCDOCX and DISCO only, 26R1 and later.

Returns:
Path

The 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:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

write_body_facetsbool, default: False

Option to write body facets into the saved file. SCDOCX and DISCO only, 26R1 and later.

Returns:
Path

The path to the saved file.

Design.export_to_stride(location: pathlib.Path | str | None = None) pathlib.Path#

Export the design to a stride file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

Design.export_to_parasolid_text(location: pathlib.Path | str | None = None) pathlib.Path#

Export the design to a Parasolid text file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

Design.export_to_parasolid_bin(location: pathlib.Path | str | None = None) pathlib.Path#

Export the design to a Parasolid binary file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

Design.export_to_fmd(location: pathlib.Path | str | None = None) pathlib.Path#

Export the design to an FMD file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

Design.export_to_step(location: pathlib.Path | str | None = None) pathlib.Path#

Export the design to a STEP file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

Design.export_to_iges(location: pathlib.Path | str = None) pathlib.Path#

Export the design to an IGES file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

Design.export_to_pmdb(location: pathlib.Path | str | None = None) pathlib.Path#

Export the design to a PMDB file.

Parameters:
locationPath | str, optional

Location on disk to save the file to. If None, the file will be saved in the current working directory.

Returns:
Path

The path to the saved file.

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) ansys.geometry.core.designer.selection.NamedSelection#

Create a named selection on the active Geometry server instance.

Parameters:
namestr

User-defined name for the named selection.

bodieslist[Body], default: None

All bodies to include in the named selection.

faceslist[Face], default: None

All faces to include in the named selection.

edgeslist[Edge], default: None

All edges to include in the named selection.

beamslist[Beam], default: None

All beams to include in the named selection.

design_pointslist[DesignPoint], default: None

All design points to include in the named selection.

componentslist[Component], default: None

All components to include in the named selection.

verticeslist[Vertex], default: None

All vertices to include in the named selection.

Returns:
NamedSelection

Newly created named selection that maintains references to all target entities.

Raises:
ValueError

If 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_selectionNamedSelection | str

Name of the named selection or instance.

Design.delete_component(component: ansys.geometry.core.designer.component.Component | str) None#

Delete a component (itself or its children).

Parameters:
idUnion[Component, str]

Name of the component or instance to delete.

Raises:
ValueError

The design itself cannot be deleted.

Notes

If the component is not this component (or its children), it is not deleted.

Design.set_shared_topology(share_type: ansys.geometry.core.designer.component.SharedTopologyType) None#

Set the shared topology to apply to the component.

Parameters:
share_typeSharedTopologyType

Shared topology type to assign.

Raises:
ValueError

Shared 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:
namestr

User-defined label for the new beam circular profile.

radiusQuantity | Distance

Radius of the beam circular profile.

centerndarray | RealSequence | Point3D

Center of the beam circular profile.

direction_xndarray | RealSequence | UnitVector3D | Vector3D

X-plane direction.

direction_yndarray | RealSequence | UnitVector3D | Vector3D

Y-plane direction.

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:
dimensionParameter

Parameter to set.

Returns:
ParameterUpdateStatus

Status 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:
thicknessQuantity

Thickness to be assigned.

bodieslist[Body]

All bodies to include in the mid-surface thickness assignment.

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_typeMidSurfaceOffsetType

Surface offset to be assigned.

bodieslist[Body]

All bodies to include in the mid-surface offset assignment.

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_profileBeamProfile | str

A beam profile name or instance that should be deleted.

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_locationPath | str

Location on disk where the file is located.

import_optionsImportOptions, optional

The options to pass into upload file. If none are provided, default options are used.

import_options_definitionsImportOptionsDefinitions, optional

Additional options to pass into insert file. If none are provided, default options are used.

Returns:
Component

The 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_optionsTessellationOptions, 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.

Returns:
dict

A 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.

Design.__repr__() str#

Represent the Design as a string.