Hello,
While trying to learn OCCT and the OCP binding, I tried converting the MakeBottle example to pure OCP.
However I got stuck on how to convert a Shape to a Wire:
aTrsf.SetMirror(xAxis)
aBRepTrsf = BRepBuilderAPI_Transform (aWire, aTrsf)
aMirroredShape = aBRepTrsf.Shape()
aMirroredWire = TopoDS_Wire(aMirroredShape) # Doesn't work!
I tried inspecting the cadquery sources, and saw that it is using a “pycapsule” class Wire_s
to do the casting. But I don’t understand where this symbol comes from. There is no such function in TopoDS
nor TopoDS_Wire
. If I import cadquery I can do the casting through cq.Shape.cast(amirroredShape)
, but I’m curious how this works?
Thanks in advance!
--
cadquery home: https://github.com/CadQuery/cadquery
post issues at https://github.com/CadQuery/cadquery/issues
run it at home at : https://github.com/CadQuery/CQ-editor
---
You received this message because you are subscribed to the Google Groups "CadQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cadquery+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cadquery/CA%2B%2BfsGHZADmxdTMO9mQkbmRUN6xrSAvTjXZqMpNU2m_FjT83ww%40mail.gmail.com.
Thanks Jeremy. I found the answer, and I’ll leave the answer here for posterity.
I was erroneously looking for Wire_s()
in OCP.TopoDS
, while it is in OCP.TopoDS.TopoDS
.
So a pure OCP casting from a OCP.TopoDS.TopoDS_Shape
to a OCP.TopoDS.TopoDS_Wire
(when the shape represents a wire) looks like the following:
from OCP.TopoDS import TopoDS
aBRepTrsf = BRepBuilderAPI_Transform (aWire, aTrsf);
aMirroredWire = TopoDS.Wire_s(aBRepTrsf.Shape())
Regards,