2525from pathlib import Path
2626from typing import Union
2727
28- from ansys .api .dbu .v0 .dbumodels_pb2 import EntityIdentifier , PartExportFormat
28+ from ansys .api .dbu .v0 .dbumodels_pb2 import (
29+ EntityIdentifier ,
30+ PartExportFormat ,
31+ )
2932from ansys .api .dbu .v0 .designs_pb2 import InsertRequest , NewRequest , SaveAsRequest
3033from ansys .api .dbu .v0 .designs_pb2_grpc import DesignsStub
34+ from ansys .api .dbu .v0 .drivingdimensions_pb2 import GetAllRequest , UpdateRequest
35+ from ansys .api .dbu .v0 .drivingdimensions_pb2_grpc import DrivingDimensionsStub
3136from ansys .api .geometry .v0 .commands_pb2 import (
3237 AssignMidSurfaceOffsetTypeRequest ,
3338 AssignMidSurfaceThicknessRequest ,
7479from ansys .geometry .core .misc .checks import ensure_design_is_active , min_backend_version
7580from ansys .geometry .core .misc .measurements import DEFAULT_UNITS , Distance
7681from ansys .geometry .core .modeler import Modeler
82+ from ansys .geometry .core .parameters import driving_dimensions
7783from ansys .geometry .core .typing import RealSequence
7884
7985
@@ -112,6 +118,7 @@ class Design(Component):
112118 _materials : list [Material ]
113119 _named_selections : dict [str , NamedSelection ]
114120 _beam_profiles : dict [str , BeamProfile ]
121+ _driving_dimensions : list [driving_dimensions .DrivingDimension ]
115122
116123 @protect_grpc
117124 @check_input_types
@@ -125,6 +132,7 @@ def __init__(self, name: str, modeler: Modeler, read_existing_design: bool = Fal
125132 self ._materials_stub = MaterialsStub (self ._grpc_client .channel )
126133 self ._named_selections_stub = NamedSelectionsStub (self ._grpc_client .channel )
127134 self ._parts_stub = PartsStub (self ._grpc_client .channel )
135+ self ._paremeters_stub = DrivingDimensionsStub (self ._grpc_client .channel )
128136
129137 # Initialize needed instance variables
130138 self ._materials = []
@@ -133,6 +141,7 @@ def __init__(self, name: str, modeler: Modeler, read_existing_design: bool = Fal
133141 self ._design_id = ""
134142 self ._is_active = False
135143 self ._modeler = modeler
144+ self ._driving_dimensions = []
136145
137146 # Check whether we want to process an existing design or create a new one.
138147 if read_existing_design :
@@ -165,6 +174,11 @@ def beam_profiles(self) -> list[BeamProfile]:
165174 """List of beam profile available for the design."""
166175 return list (self ._beam_profiles .values ())
167176
177+ @property
178+ def driving_dimensions (self ) -> list [driving_dimensions .DrivingDimension ]:
179+ """List of driving dimensions available for the design."""
180+ return self .get_all_driving_dimensions ()
181+
168182 @property
169183 def is_active (self ) -> bool :
170184 """Whether the design is currently active."""
@@ -656,6 +670,47 @@ def add_beam_circular_profile(
656670
657671 return self ._beam_profiles [profile .name ]
658672
673+ @protect_grpc
674+ @min_backend_version (25 , 1 , 0 )
675+ def get_all_driving_dimensions (self ):
676+ """Get driving dimensions for the design.
677+
678+ Returns
679+ -------
680+ List[DrivingDimension]
681+ List of driving dimensions for the design.
682+ """
683+ response = self ._paremeters_stub .GetAll (GetAllRequest ())
684+ print (response )
685+ return [
686+ driving_dimensions .DrivingDimension ._from_proto (dimension )
687+ for dimension in response .driving_dimensions
688+ ]
689+
690+ @protect_grpc
691+ @check_input_types
692+ @min_backend_version (25 , 1 , 0 )
693+ def set_driving_dimensions (
694+ self , driving_dimension : driving_dimensions .DrivingDimension
695+ ) -> bool :
696+ """Set driving dimensions for a body.
697+
698+ Parameters
699+ ----------
700+ body : Body
701+ Body to set driving dimensions.
702+ dimensions : List[DrivingDimension]
703+ List of driving dimensions to set.
704+
705+ Returns
706+ -------
707+ bool
708+ True if driving dimensions were set successfully.
709+ """
710+ request = UpdateRequest (driving_dimension = driving_dimension ._to_proto ())
711+ response = self ._driving_dimensions_stub .Update (request )
712+ return response .success
713+
659714 @protect_grpc
660715 @check_input_types
661716 @ensure_design_is_active
0 commit comments