66from sectionproperties .pre .library .steel_sections import *
77from sectionproperties .pre .library .nastran_sections import *
88from sectionproperties .analysis .section import Section
9- from sectionproperties .pre .pre import Material
9+ from sectionproperties .pre .pre import DEFAULT_MATERIAL , Material
1010from sectionproperties .pre .rhino import load_3dm , load_brep_encoding
1111from shapely .geometry import (
1212 Polygon ,
4444overlay_geom .create_mesh ([50 ])
4545overlay_sec = Section (overlay_geom )
4646
47+ steel = Material ("steel" , 200e3 , 0.3 , 7.85e-6 , 400 , "grey" )
48+
4749
4850def test_material_persistence ():
4951 # Test ensures that the material attribute gets transformed
5052 # through all of the Geometry transformation methods, each which
5153 # returns a new Geometry object.
5254 # The material assignment should persist through all of the
5355 # transformations
54- steel = Material ("steel" , 200e3 , 0.3 , 7.85e-6 , 400 , "grey" )
5556 big_sq .material = steel
5657 new_geom = (
5758 big_sq .align_to (small_sq , on = "left" , inner = False )
@@ -72,6 +73,21 @@ def test_for_incidental_holes():
7273 assert len (nested_geom .holes ) == 0
7374
7475
76+ def test__sub__ ():
77+ small_hole .material = steel
78+ top_left = small_hole .align_to (big_sq , on = "left" ).align_to (big_sq , on = "top" ).shift_section (20 , - 20 )
79+ top_right = top_left .shift_section (x_offset = 200 )
80+
81+ compound = big_sq - top_left
82+ compound = compound + top_left
83+ compound = compound - top_right
84+ compound = compound + top_right
85+
86+ assert len (compound .control_points ) == 3
87+ # Incomplete test to validate that the iterative __sub__ produces
88+ # three distinct regions with proper material assignments
89+
90+
7591def test_geometry_from_points ():
7692 # Geometry.from_points() tests a shape with exactly one exterior
7793 # and an arbitrary number of interiors being built from the legacy
0 commit comments