1212from sectionproperties .pre .geometry import Geometry
1313from sectionproperties .pre .library .primitive_sections import circular_section_by_area
1414from shapely import LineString , Polygon
15+ from shapely .geometry .base import GeometrySequence
1516from shapely .ops import split
1617
1718from concreteproperties .material import Concrete
@@ -185,7 +186,8 @@ def split_section(
185186 Geometries above and below the line
186187 """
187188 # round point
188- point = np .round (point , 6 )
189+ pt_rounded = np .round (np .array (point ), 6 )
190+ point = (pt_rounded [0 ], pt_rounded [1 ])
189191
190192 # generate unit vector
191193 vector = np .cos (theta ), np .sin (theta )
@@ -204,6 +206,10 @@ def split_section(
204206 polys = [self .geom ]
205207
206208 # sort geometries
209+ if isinstance (polys , GeometrySequence ):
210+ msg = "Geometry split failure."
211+ raise RuntimeError (msg )
212+
207213 top_polys , bot_polys = self .sort_polys (polys = polys , point = point , vector = vector )
208214
209215 # assign material properties and create cp geometry objects
@@ -339,7 +345,7 @@ def to_sp_geom(self) -> Geometry:
339345 Returns:
340346 ``sectionproperties`` geometry object
341347 """
342- return Geometry (geom = self .geom , material = self .material )
348+ return Geometry (geom = self .geom , material = self .material ) # pyright: ignore [reportArgumentType]
343349
344350
345351class CPGeomConcrete (CPGeom ):
@@ -372,7 +378,7 @@ def add_bar(
372378 x : float ,
373379 y : float ,
374380 n : int = 4 ,
375- ) -> CompoundGeometry :
381+ ) -> Geometry | CompoundGeometry :
376382 """Adds a reinforcing bar to a ``sectionproperties`` geometry.
377383
378384 Bars are discretised by four points by default.
@@ -388,7 +394,7 @@ def add_bar(
388394 Returns:
389395 Reinforced concrete geometry with added bar
390396 """
391- bar = circular_section_by_area (area = area , n = n , material = material ).shift_section (
397+ bar = circular_section_by_area (area = area , n = n , material = material ).shift_section ( # pyright: ignore [reportArgumentType]
392398 x_offset = x , y_offset = y
393399 )
394400
@@ -406,7 +412,7 @@ def add_bar_rectangular_array(
406412 anchor : tuple [float , float ] = (0 , 0 ),
407413 exterior_only : bool = False ,
408414 n : int = 4 ,
409- ) -> CompoundGeometry :
415+ ) -> Geometry | CompoundGeometry :
410416 """Adds a rectangular array of reinforcing bars to a ``sectionproperties`` geometry.
411417
412418 Bars are discretised by four points by default.
@@ -438,7 +444,7 @@ def add_bar_rectangular_array(
438444 add_bar = True
439445
440446 if add_bar :
441- bar = circular_section_by_area (area = area , n = n , material = material )
447+ bar = circular_section_by_area (area = area , n = n , material = material ) # pyright: ignore [reportArgumentType]
442448 x = anchor [0 ] + i_idx * x_s
443449 y = anchor [1 ] + j_idx * y_s
444450 bar = bar .shift_section (x_offset = x , y_offset = y )
@@ -456,7 +462,7 @@ def add_bar_circular_array(
456462 theta_0 : float = 0 ,
457463 ctr : tuple [float , float ] = (0 , 0 ),
458464 n : int = 4 ,
459- ) -> CompoundGeometry :
465+ ) -> Geometry | CompoundGeometry :
460466 """Adds a circular array of reinforcing bars to a ``sectionproperties`` geometry.
461467
462468 Bars are discretised by four points by default.
@@ -478,7 +484,7 @@ def add_bar_circular_array(
478484 d_theta = 2 * np .pi / n_bar
479485
480486 for idx in range (n_bar ):
481- bar = circular_section_by_area (area = area , n = n , material = material )
487+ bar = circular_section_by_area (area = area , n = n , material = material ) # pyright: ignore [reportArgumentType]
482488 theta = theta_0 + idx * d_theta
483489 x = ctr [0 ] + r_array * np .cos (theta )
484490 y = ctr [1 ] + r_array * np .sin (theta )
0 commit comments