1- from __future__ import annotations
2-
3- from typing import Any , List , Optional
1+ from typing import List , Optional
42
53import compas .geometry
64import compas .datastructures
@@ -103,7 +101,7 @@ def shape(self) -> TopoDS_Shape:
103101 return self ._shape
104102
105103 @shape .setter
106- def shape (self , shape : Any [ TopoDS_Shape ] ) -> None :
104+ def shape (self , shape : TopoDS_Shape ) -> None :
107105 self ._shape = shape
108106
109107 @property
@@ -187,7 +185,7 @@ def from_corners(cls,
187185 p1 : compas .geometry .Point ,
188186 p2 : compas .geometry .Point ,
189187 p3 : compas .geometry .Point ,
190- p4 : Optional [compas .geometry .Point ] = None ) -> BRep :
188+ p4 : Optional [compas .geometry .Point ] = None ) -> ' BRep' :
191189 """Construct a BRep from 3 or 4 corner points."""
192190 if not p4 :
193191 brep = BRep ()
@@ -198,7 +196,7 @@ def from_corners(cls,
198196 return brep
199197
200198 @classmethod
201- def from_polygons (cls , polygons : List [compas .geometry .Polygon ]) -> BRep :
199+ def from_polygons (cls , polygons : List [compas .geometry .Polygon ]) -> ' BRep' :
202200 """Construct a BRep from a set of polygons."""
203201 shell = TopoDS_Shell ()
204202 builder = BRep_Builder ()
@@ -215,11 +213,11 @@ def from_polygons(cls, polygons: List[compas.geometry.Polygon]) -> BRep:
215213 return brep
216214
217215 @classmethod
218- def from_curves (cls , curves ) -> BRep :
216+ def from_curves (cls , curves ) -> ' BRep' :
219217 raise NotImplementedError
220218
221219 @classmethod
222- def from_box (cls , box : compas .geometry .Box ) -> BRep :
220+ def from_box (cls , box : compas .geometry .Box ) -> ' BRep' :
223221 """Construct a BRep from a COMPAS box."""
224222 xaxis = box .frame .xaxis .scaled (- 0.5 * box .xsize )
225223 yaxis = box .frame .yaxis .scaled (- 0.5 * box .ysize )
@@ -231,14 +229,14 @@ def from_box(cls, box: compas.geometry.Box) -> BRep:
231229 return brep
232230
233231 @classmethod
234- def from_sphere (cls , sphere : compas .geometry .Sphere ) -> BRep :
232+ def from_sphere (cls , sphere : compas .geometry .Sphere ) -> ' BRep' :
235233 """Construct a BRep from a COMPAS sphere."""
236234 brep = BRep ()
237235 brep .shape = BRepPrimAPI_MakeSphere (gp_Pnt (* sphere .point ), sphere .radius ).Shape ()
238236 return brep
239237
240238 @classmethod
241- def from_cylinder (cls , cylinder : compas .geometry .Cylinder ) -> BRep :
239+ def from_cylinder (cls , cylinder : compas .geometry .Cylinder ) -> ' BRep' :
242240 """Construct a BRep from a COMPAS cylinder."""
243241 plane = cylinder .circle .plane
244242 height = cylinder .height
@@ -251,17 +249,17 @@ def from_cylinder(cls, cylinder: compas.geometry.Cylinder) -> BRep:
251249 return brep
252250
253251 @classmethod
254- def from_cone (cls , cone : compas .geometry .Cone ) -> BRep :
252+ def from_cone (cls , cone : compas .geometry .Cone ) -> ' BRep' :
255253 """Construct a BRep from a COMPAS cone."""
256254 raise NotImplementedError
257255
258256 @classmethod
259- def from_torus (cls , torus : compas .geometry .Torus ) -> BRep :
257+ def from_torus (cls , torus : compas .geometry .Torus ) -> ' BRep' :
260258 """Construct a BRep from a COMPAS torus."""
261259 raise NotImplementedError
262260
263261 @classmethod
264- def from_boolean_difference (cls , A : BRep , B : BRep ) -> BRep :
262+ def from_boolean_difference (cls , A : ' BRep' , B : ' BRep' ) -> ' BRep' :
265263 """Construct a BRep from the boolean difference of two other BReps."""
266264 cut = BRepAlgoAPI_Cut (A .shape , B .shape )
267265 if not cut .IsDone ():
@@ -271,7 +269,7 @@ def from_boolean_difference(cls, A: BRep, B: BRep) -> BRep:
271269 return brep
272270
273271 @classmethod
274- def from_boolean_intersection (cls , A : BRep , B : BRep ) -> BRep :
272+ def from_boolean_intersection (cls , A : ' BRep' , B : ' BRep' ) -> ' BRep' :
275273 """Construct a BRep from the boolean intersection of two other BReps."""
276274 common = BRepAlgoAPI_Common (A .shape , B .shape )
277275 if not common .IsDone ():
@@ -281,7 +279,7 @@ def from_boolean_intersection(cls, A: BRep, B: BRep) -> BRep:
281279 return brep
282280
283281 @classmethod
284- def from_boolean_union (cls , A , B ) -> BRep :
282+ def from_boolean_union (cls , A , B ) -> ' BRep' :
285283 """Construct a BRep from the boolean union of two other BReps."""
286284 fuse = BRepAlgoAPI_Fuse (A .shape , B .shape )
287285 if not fuse .IsDone ():
@@ -291,7 +289,7 @@ def from_boolean_union(cls, A, B) -> BRep:
291289 return brep
292290
293291 @classmethod
294- def from_mesh (cls , mesh : compas .datastructures .Mesh ) -> BRep :
292+ def from_mesh (cls , mesh : compas .datastructures .Mesh ) -> ' BRep' :
295293 """Construct a BRep from a COMPAS mesh."""
296294 shell = TopoDS_Shell ()
297295 builder = BRep_Builder ()
0 commit comments