[Otázka] How to handle corrupt geometry with the Python API [Vyřešeno]


Hello,

I want to apply the NemAll_Python_Geometry.MakeUnion method on two polyhedrons which I retrieved from a fixture. Although they seem to be valid when I test them with Polyhedron3D.IsValid(), the MakeUnion methoud throws an error (eWrongShape) and an empty Polyhedron3D.

When I place the two polyhedrons in the model and try to use the Union tool manually I also get an error ("Solids cannot be modeled"). This is fixed when I apply the "Repair 3D Elements" tool on both elements and then it is possible to Union them both manually and with the API MakeUnion method. Is there a way to repair the polyhedrons with the API? I've tried the Heal() and Normalize() methods but they don't seem to have an effect. I realy would like to handle the 'corrupt' polyhedrons inside the API, is that possible somehow?

I've attached the data to this topic (Export Loaded drawing files with resources) and I've modified the GeometrySelectInteractor.py example to show the case. Output of trace, generated with the modified GeometrySelectInteractor is also attached.

Attached data is from Allplan 2025 WIP-2.

http://www.cadblanche.eu

Přílohy (3)

Type: application/zip
Staženo 110
Size: 3,41 KiB
Type: application/zip
Staženo 109
Size: 1,69 KiB
Type: image/png
Staženo 18
Size: 53,63 KiB

Show solution Hide solution

Hello Sander,

If polyhedron faces are non-planar, Heal tries to fix it - either by moving the vertices a little to make them planar, or by triangulating the faces around the "fixed" vertices. Apparently, this is not the issue with your polyhedron.

The repairing the polyhedron with the UI function "Repair" involves 4 steps:

  • Repairing Cross Loop Faces
  • Spliting Faces At Edges
  • Splitting Non Planar Faces (Basically what heal does)
  • Repairing Face Normals
These steps are performed by internal functions, which are not yet exposed to python API. But we plan to do that in the nearest future. Hopefully in Allpllan 2025, but I cannot guarantee anything here.

Best,
Bart

Hello Sander,

If polyhedron faces are non-planar, Heal tries to fix it - either by moving the vertices a little to make them planar, or by triangulating the faces around the "fixed" vertices. Apparently, this is not the issue with your polyhedron.

The repairing the polyhedron with the UI function "Repair" involves 4 steps:

  • Repairing Cross Loop Faces
  • Spliting Faces At Edges
  • Splitting Non Planar Faces (Basically what heal does)
  • Repairing Face Normals
These steps are performed by internal functions, which are not yet exposed to python API. But we plan to do that in the nearest future. Hopefully in Allpllan 2025, but I cannot guarantee anything here.

Best,
Bart

Thanks for your reply! I will try to find a workaround and keep an eye on the release notes.

http://www.cadblanche.eu


https://campus.allplan.com/ používá cookies  -  Více informací

Souhlasím