-
-
Notifications
You must be signed in to change notification settings - Fork 390
Open
Description
I am reimplementing the logic in the upstream STL writer in pythonocc-core in order to obtain a surface mesh without having to resort to File I/O, and it seems that calling BRep_Tool.Triangulation
should update the TopLoc_Location
it is passed, but, at least according to its DumpJSON
method, this is not happening. Here's the core of my traversal loop:
exp = TopExp_Explorer(shape, TopAbs_FACE)
while exp.More():
face = exp.Current()
if face.Orientation() == TopAbs_REVERSED:
print("FIXME Reversed face")
loc = TopLoc_Location()
tri = BRep_Tool.Triangulation(face, loc)
if tri:
trsf = loc.Transformation()
for i in range(tri.NbNodes()):
p = tri.Node(1+i)
p.Transform(trsf)
nodes.append([p.X(), p.Y(), p.Z()])
A full self-contained example is also available.
In the full example, I am trying to mesh a box. STL export (ostensibly using the OCCT C++ code above) works fine, but with my reimplementation, I get a mesh that looks like this:

I.e. all faces of the box seem to coincide in one plane, seemingly consistent with lack of transformation information.
Metadata
Metadata
Assignees
Labels
No labels