Shape.copy() changes breaks Assembly.solve()
gumyr opened this issue · comments
Roger Maitland commented
import cq_warehouse.extensions
breaks the following:
import cadquery as cq
asm = (
cq.Assembly()
.add(cq.Solid.makeBox(1, 1, 1), name='b1', color=cq.Color('yellow'))
.add(cq.Solid.makeBox(1, 1, 1), name='b2', color=cq.Color('red'))
.constrain('b1@faces@<Z', 'b2@faces@<Z', 'Plane')
)
asm.solve()
show_object(asm)
with the following error:
>>> cq.Face.makePlane(3,4).copy()._geomAdaptor()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/peter/cadquery/cadquery/occ_impl/shapes.py", line 2206, in _geomAdaptor
return BRep_Tool.Surface_s(self.wrapped)
TypeError: Surface_s(): incompatible function arguments. The following argument types are supported:
1. (F: OCP.TopoDS.TopoDS_Face, L: OCP.TopLoc.TopLoc_Location) -> OCP.Geom.Geom_Surface
2. (F: OCP.TopoDS.TopoDS_Face) -> OCP.Geom.Geom_Surface
Invoked with: <OCP.TopoDS.TopoDS_Shape object at 0x7f1dc0ad2730>
>>>
Roger Maitland commented
Adding a downcast fixes the problem:
memo = {id(self.wrapped): downcast(BRepBuilderAPI_Copy(self.wrapped).Shape())}