See title ...
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
See title ...
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,
The easy part: to determine whether a 3D point is on a 3D line use DeterminePosition, like:
result = AllplanGeometry.Comparison.DeterminePosition(line, point, 1e-11)
The difficult part: for determining, whether a 3D line is on a face of a polyhedron, I would suggest following steps:
1. Create a 3D polygon out of the face's points.
a. In ALLPLAN 2025 you can get the vertices of any polyhedron's face using PolyhedronUtil.GetFacePoints.
b. In older versions you need to first get all the face's oriented edges, then the edges, then the vertices indices and then the points. Trickier, but possible.
2. Check, whether your 3D line is on the plane defined by the polygon you created. Use IsCoplanar, e.g. like:
AllplanGeo.IsCoplanar(your_polygon.GetPlane(), your_line)
The reason we need to transform and convert to 2D is because the DeterminePosition method can only process 2D polygon and a 2D line.
I know, this might be challenging to implement, yet possible.
Best,
Bart
Hi,
The easy part: to determine whether a 3D point is on a 3D line use DeterminePosition, like:
result = AllplanGeometry.Comparison.DeterminePosition(line, point, 1e-11)
The difficult part: for determining, whether a 3D line is on a face of a polyhedron, I would suggest following steps:
1. Create a 3D polygon out of the face's points.
a. In ALLPLAN 2025 you can get the vertices of any polyhedron's face using PolyhedronUtil.GetFacePoints.
b. In older versions you need to first get all the face's oriented edges, then the edges, then the vertices indices and then the points. Trickier, but possible.
2. Check, whether your 3D line is on the plane defined by the polygon you created. Use IsCoplanar, e.g. like:
AllplanGeo.IsCoplanar(your_polygon.GetPlane(), your_line)
The reason we need to transform and convert to 2D is because the DeterminePosition method can only process 2D polygon and a 2D line.
I know, this might be challenging to implement, yet possible.
Best,
Bart
The fast answer in the regard of methods DetermindPosition helped a lot. For some reason I just did not found it myself. I was exactly what I was looking for.
In the regard of line on face ... Wow long algorithmus ... At the moment I can use the point on line code. But I might need to come back to this. I do not know if I will be that brave to give it a try :-)
Thanks very much for the help,
cheers bernd
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
BTW: there are a buch of useful methods here https://pythonparts.allplan.com/2025/api_reference/InterfaceStubs/NemAll_Python_Geometry/Comparison/#NemAll_Python_Geometry.Comparison.DeterminePosition
for example this one I will need soon too ... "Determine the relative position of a point to a Polyhedron"
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