@@ -100,32 +100,19 @@ def display_image(image_name):
100
100
101
101
ExtAPI .Application .ActiveUnitSystem = MechanicalUnitSystem .StandardMKS
102
102
103
- # Store all main tree nodes as variables
104
-
105
- GEOM = ExtAPI .DataModel .Project .Model .Geometry
106
- MSH = ExtAPI .DataModel .Project .Model .Mesh
107
- NS_GRP = ExtAPI .DataModel .Project .Model .NamedSelections
108
- CONN_GRP = ExtAPI .DataModel .Project .Model .Connections
109
- MY_TOTAL_VOL = GEOM .Volume .Value
110
- MY_TOTAL_MA = GEOM .Mass .Value
111
-
112
103
# Get structural analysis and link to topology optimization
113
104
114
105
TOPO_OPT = ExtAPI .DataModel .Project .Model .AddTopologyOptimizationAnalysis ()
115
106
TOPO_OPT .TransferDataFrom (STRUCT )
116
107
108
+ OPT_REG = DataModel .GetObjectsByType (DataModelObjectCategory .OptimizationRegion )[0 ]
109
+ OPT_REG .BoundaryCondition = BoundaryConditionType .AllLoadsAndSupports
110
+ OPT_REG .OptimizationType = OptimizationType .TopologyDensity
111
+
117
112
# sphinx_gallery_start_ignore
118
113
assert str (TOPO_OPT .ObjectState ) == "NotSolved"
119
114
# sphinx_gallery_end_ignore
120
115
121
- # Set ``None`` for optimization region boundary condition exclusion region
122
- # Optimization region
123
-
124
- OPT_REG = TOPO_OPT .Children [1 ]
125
- # OPT_REG.BoundaryCondition=BoundaryConditionType.None
126
- # Using ``getattr`` because Python.Net does not support the ``None`` enum
127
- OPT_REG .BoundaryCondition = BoundaryConditionType .AllLoadsAndSupports
128
-
129
116
# Insert volume response constraint object for topology optimization
130
117
# Delete mass response constraint
131
118
@@ -135,22 +122,13 @@ def display_image(image_name):
135
122
# Add volume response constraint
136
123
137
124
VOL_CONSTRN = TOPO_OPT .AddVolumeConstraint ()
138
- # VOL_CONSTRN.DefineBy=ResponseConstraintDefineBy.Constant
139
- # VOL_CONSTRN.PercentageToRetain=50
140
125
141
126
# Insert member size manufacturing constraint
142
127
143
128
MEM_SIZE_MFG_CONSTRN = TOPO_OPT .AddMemberSizeManufacturingConstraint ()
144
129
MEM_SIZE_MFG_CONSTRN .Minimum = ManuMemberSizeControlledType .Manual
145
130
MEM_SIZE_MFG_CONSTRN .MinSize = Quantity ("2.4 [m]" )
146
131
147
- # # Store coordinate system ID for use in symmetry manufacturing constraint
148
- # Coordinate_Systems = DataModel.Project.Model.CoordinateSystems
149
- # coord_sys7 = Coordinate_Systems.Children[7]
150
-
151
- # # Insert symmetry manufacturing constraint
152
- # SYMM_MFG_CONSTRN = TOPO_OPT.AddSymmetryManufacturingConstraint()
153
- # SYMM_MFG_CONSTRN.CoordinateSystem = coord_sys7
154
132
155
133
TOPO_OPT .Activate ()
156
134
ExtAPI .Graphics .Camera .SetFit ()
0 commit comments