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

[Frage] Intersection points of two polyhedrons in PythonPart [Gelöst]

Schlagworte:
  • Allplan 2024
  • PythonParts

I am trying to get the intersection points of two polyhedrons in PP using GetIntersectionPoints(geoObject1, geoObject2, eps).

When using this function for two objects, Polyhedron3D gives the error "No to_python (by-value) converter found for C++ type". I did not find this function in the examples of use. Is this a bug, or should it be used differently?

Anhänge (2)

Typ: image/png
20-mal heruntergeladen
Größe: 126,42 KiB
Typ: image/png
17-mal heruntergeladen
Größe: 29,53 KiB

Lösung anzeigen Lösung verbergen

Hello Andrii,

The function GetIntersectionPoints would (if it would have worked) get you the same results, as the IntersectionCalculusEx function, but in an organized manner. The IntersectionCalculusEx calculates also "imaginary" intersection points between curves. E.g. let's assume two non-parallel line segments without an intersection point. If you would extend them to a line (Axis2D), they will eventually intersect somewhere. IntersectionCalculusEx would give you this intersection point. GetIntersectionPoints would also give you this point, but also the information, whether this point is located on both line segments, on only one or on none of them.

All-in-all, if IntersectionCalculusEx does not give you the right result, GetIntersectionPoints wouldn't also do that.

For your use-case I would rather try with the CutPolyhedronWithPlane. You are not getting the cut profile, but two polyhedrons resulting from splitting the original one. But you can analyze one of them and pick only the face, that is coplanar with your cutting plane and get its points.

Best,
Bart

Hello Andrii,

The problem here is the output of the function, which is a C++ object, for which there no function converting it to a Python object. The usage is correct, there is a converter missing in the C++ layer of the API. Thank you for pointing that out. We have to decide, whether to completely remove the function or provide the converter for it. It depends on what this function actually does. We don't want to have the functions doubled.

Why would you like to use it in the first place? Are the functions for finding intersection described in this article insufficient? Are the results unexpected? I also don't understand, what do you mean by intersection point between polyhedrons. A polyhedron represents (usually) a solid. An intersection between two solids is still a solid.

Best,
Bart

Hello Bart,

I decided to use this very function because it was the fastest way to obtain intersecting points between 2 objects. Other functions require additional operations. My goal is to obtain an ordered list of points between a solid-like polyhedron and something like a plane(in this way I used another polyhedron with width == 1) to get a profile. I found a MakeIntersection() function useful as well, though it requires to do more operations to get those points I mentioned above.

Best regards,
Andrii

Hello Andrii,

The function GetIntersectionPoints would (if it would have worked) get you the same results, as the IntersectionCalculusEx function, but in an organized manner. The IntersectionCalculusEx calculates also "imaginary" intersection points between curves. E.g. let's assume two non-parallel line segments without an intersection point. If you would extend them to a line (Axis2D), they will eventually intersect somewhere. IntersectionCalculusEx would give you this intersection point. GetIntersectionPoints would also give you this point, but also the information, whether this point is located on both line segments, on only one or on none of them.

All-in-all, if IntersectionCalculusEx does not give you the right result, GetIntersectionPoints wouldn't also do that.

For your use-case I would rather try with the CutPolyhedronWithPlane. You are not getting the cut profile, but two polyhedrons resulting from splitting the original one. But you can analyze one of them and pick only the face, that is coplanar with your cutting plane and get its points.

Best,
Bart

Zitiert von: bmarciniec
Hello Andrii,
The function GetIntersectionPoints would (if it would have worked) get you the same results, as the IntersectionCalculusEx function, but in an organized manner. The IntersectionCalculusEx calculates also "imaginary" intersection points between curves. E.g. let's assume two non-parallel line segments without an intersection point. If you would extend them to a line (Axis2D), they will eventually intersect somewhere. IntersectionCalculusEx would give you this intersection point. GetIntersectionPoints would also give you this point, but also the information, whether this point is located on both line segments, on only one or on none of them.
All-in-all, if IntersectionCalculusEx does not give you the right result, GetIntersectionPoints wouldn't also do that.
For your use-case I would rather try with the CutPolyhedronWithPlane. You are not getting the cut profile, but two polyhedrons resulting from splitting the original one. But you can analyze one of them and pick only the face, that is coplanar with your cutting plane and get its points.
Best,

Bart

Hello Bart,

Thanks!

Best regards,
Andrii