Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

MakeIntersection of two polyhedrons


- On Allplan GUI a intersection of two face results in a line.

- On VisualScripting the intersection of two Polyhedrons returns None

- On PythonParts I only found https://pythonparts.allplan.com/2023/api_reference/InterfaceStubs/NemAll_Python_Geometry/_functions/?h=makeintersection#NemAll_Python_Geometry.MakeIntersection which is a intersection of two breps.

- For MakeUnion and MakeSubtraction there are methods for polyhedrons as well.

- How do I make a intersection of two faces by Python.

cheers bernd

PS. nice to see examples on github as well :-)
https://github.com/NemetschekAllplan/PythonPartsExamples

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

just saw there ist MakeIntersection(el1, el2), mhh but somehow different than MakeUnion()

There is explizit a method MakeUnion(polyhed1, polyhed2)

why my intersection if passed two polyhedrons returns nothing but works at the gui ...

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

ok it says use Intersect() ...

here is the code ...

        print(gleisface)
        print(aschwelle)
        interline = AllplanGeo.Intersect(gleisface, aschwelle)
        print(interline)

results in None ...

Polyhedron3D(
   Type(2)
   IsNegative(0)
   PartsCount(1)
   EdgeCount(13)
   FaceCount(4)
   VertexCount(10)
   Vertices(
      (19694.5553174808, 6370.6683580632, 815.4064002404)
      (19694.5553174808, 6370.6683580632, -2184.5935997596)
      (8425.7476656193, 4288.0811674718, -2080)
      (8425.7476656193, 4288.0811674718, 920)
      (-1535.3457317762, 5345.2390714696, -3400)
      (-1535.3457317762, 5345.2390714696, -400)
      (-10645.4305114882, 3427.9876250909, -1990)
      (-10645.4305114882, 3427.9876250909, 1010)
      (-15418.4012844974, 3010.7946241908, -2700)
      (-15418.4012844974, 3010.7946241908, 300)))
Polyhedron3D(
   Type(2)
   IsNegative(0)
   PartsCount(1)
   EdgeCount(4)
   FaceCount(1)
   VertexCount(4)
   Vertices(
      (-14804.7950214616, 4068.2411156815, -2000)
      (-14630.6442017294, 2075.8376695926, -2000)
      (-14331.7836848161, 2101.9602925525, -2000)
      (-14505.9345045483, 4094.3637386413, -2000)))
(False, Polyhedron3D(
   Type(2)
   IsNegative(0)
   PartsCount(0)
   EdgeCount(0)
   FaceCount(0)
   VertexCount(0)
   Vertices()))

modify element property:
0

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a

Hi,

Ok, so tried to reconstruct your problem and created 2 polyhedrons (polyhedron_1 and polyhedron_2) with a face geometry. The first one is a rectangle in XY plane, the other one also a rectangle but rotated in space, so that both intersect. The goal is to become the Line3D being the intersection.

Here's what you have to do:
1. Convert both polyhedrons to breps

_, brep_1 = AllplanGeo.CreateBRep3D(polyhedron_1)
_, brep_2 = AllplanGeo.CreateBRep3D(polyhedron_2)

2. Apply Intersect on them:
_, result_brep = AllplanGeo.Intersect(brep_1, brep_2)
You'll get a brep. Mine has only one edge, yours might be different of course:
>>> result_brep
BRep3D(
   RefPoint(0, 0, 0)
   PartsCount(1)
   EdgeCount(1)
   FaceCount(0)
   VertexCount(2)
   Vertices(...))

3. Get all the edges of the resulting brep as parametric curves.
_, edge_curves = result_brep.GetEdgeParametricCurves()
You'll end up with a list of curves you are looking for. In my case the list contains exactly one Line3D, because the two breps I have intersected were planar:
>>> resulting_brep
[Line3D(...)]

Does this address your problem?

Best,
Bart

wow cool, exactly what I wanted to know. Seams the parasolid is much better than the internal CAD engine :-)

A bit cumbersome but much more important, it is possible and it works in Allplan Python.

cheers bernd

PS: your post realy help a lot

BIM, BAM, BOOM
BIM-Modelle Tragwerksplaner --> http://www.bimstatik.ch/
My Allplan PythonParts --> https://github.com/BIMStatik/AllplanPythonParts
LinkedIN --> https://ch.linkedin.com/in/bernd-hahnebach-269b855a