Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Location not updated by BRep_Tool.Triangulation? #1444

Copy link
Copy link
@inducer

Description

@inducer
Issue body actions

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:

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.