@@ -322,6 +322,38 @@ def test_get_empty_material(modeler: Modeler):
322
322
assert len (mat_service .properties ) == 1
323
323
324
324
325
+ def test_remove_material_from_body (modeler : Modeler ):
326
+ """Test removing a material from a body."""
327
+ # Create a design and a sketch
328
+ design = modeler .create_design ("RemoveMaterialTest" )
329
+ sketch = Sketch ()
330
+ sketch .circle (Point2D ([0 , 0 ], UNITS .mm ), Quantity (10 , UNITS .mm ))
331
+
332
+ # Extrude the sketch to create a body
333
+ body = design .extrude_sketch ("CircleBody" , sketch , Quantity (10 , UNITS .mm ))
334
+
335
+ # Create and assign a material
336
+ density = Quantity (7850 , UNITS .kg / (UNITS .m ** 3 ))
337
+ material = Material (
338
+ "Steel" ,
339
+ density ,
340
+ [MaterialProperty (MaterialPropertyType .POISSON_RATIO , "Poisson" , Quantity (0.3 ))],
341
+ )
342
+ design .add_material (material )
343
+ body .assign_material (material )
344
+ assert body .material .name == "Steel"
345
+
346
+ # Remove the material from the body
347
+ body .remove_assigned_material ()
348
+
349
+ # Check that the body no longer has a material assigned
350
+ assert body .material .name == ""
351
+ assert len (body .material .properties ) == 1
352
+ assert body .material .properties [MaterialPropertyType .DENSITY ].quantity == Quantity (
353
+ 0 , UNITS .kg / (UNITS .m ** 3 )
354
+ )
355
+
356
+
325
357
def test_face_to_body_creation (modeler : Modeler ):
326
358
"""Test in charge of validating the extrusion of an existing face."""
327
359
# Create a Sketch and draw a circle (all client side)
0 commit comments