gumyr / build123d

A python CAD programming library
Apache License 2.0
386 stars 72 forks source link

`Face.center_location` doesn't work for `Geom_BSplineSurface` #599

Closed gumyr closed 3 months ago

gumyr commented 3 months ago
s1 = Spline((-1, 0, 0), (0, 0, 0.5), (0.5, 0, 0.3), (1, 0, 0))
s2 = Spline((-1, 1, 0), (0, 1, 0.5), (0.5, 1, 0.3), (1, 1, 0))
sur = Face.make_surface_from_curves(s1.edge(), s2.edge())
print(sur._geom_adaptor())
cen = sur.center_location
<OCP.Geom.Geom_BSplineSurface object at 0x72cb035f6cf0>
Traceback (most recent call last):
  File "/home/roger-maitland/Documents/build123d/experiments/center_location.py", line 18, in <module>
    cen = sur.center_location
  File "/home/roger-maitland/Documents/build123d/src/build123d/topology.py", line 5297, in center_location
    x_dir = Vector(self._geom_adaptor().Position().XDirection())
AttributeError: 'OCP.Geom.Geom_BSplineSurface' object has no attribute 'Position'

This does work for other types of non-planar surfaces.