Support Forum

Opening in Polyhedron [Gelöst]

Schlagworte:
  • PythonParts

Hello, I'm working on creating Polyhedrons from scratch. I searched through manual as well as API reference and I can't find a way to create openings in Polyhedron or PolyhedronFace. Am I missing something or it is API limitation?

Lösung anzeigen Lösung verbergen

Hi,

I am not sure, if this is what you are aiming to, but I created a surface-type polyhedron (so not a solid) consisting of just one face and I created an opening inside it using Allplan function "subtraction". You can find the result attached in zip file. Then I analyzed this polyhedron with this code snippet:

        for i in range(polyhedron.GetFacesCount()):
            face = polyhedron.GetFace(i)
            print(f"{'-'*51} Face {i} {'-'*51}\n")

            for face_edge in face.GetEdges():
                print(f"Oriented edge handle {face_edge.EdgeHandle}; Positive: {face_edge.Positive}")
                _, edge = polyhedron.GetEdge(face_edge)
                print(f"Geometry edge: {edge.StartIndex} -> {edge.EndIndex}")

And here is, what I got:
--------------------------------------------------- Face 0 ---------------------------------------------------

Oriented edge handle 0; Positive: True
Geometry edge: 0 -> 1
Oriented edge handle 1; Positive: True
Geometry edge: 1 -> 2
Oriented edge handle 2; Positive: True
Geometry edge: 2 -> 3
Oriented edge handle 3; Positive: True
Geometry edge: 3 -> 0
Oriented edge handle 4; Positive: True
Geometry edge: 4 -> 5
Oriented edge handle 5; Positive: True
Geometry edge: 5 -> 6
Oriented edge handle 6; Positive: True
Geometry edge: 6 -> 7
Oriented edge handle 7; Positive: True
Geometry edge: 7 -> 4

So visually it looks like on the image I attached. There are two loops in the face, but the second one (4 -> 5 -> 6 -> 7 -> 4) has a negative orientation. This is how you can create an opening on a polyhedron face. Is this what you were looking for?

Best,
Bart

Anhänge (2)

Typ: application/zip
29-mal heruntergeladen
Größe: 4,60 KiB
Typ: image/png
12-mal heruntergeladen
Größe: 4,03 KiB

Hi,

you need to create a Polyhedron for the opening and subtract it from the "body" polyhedron (see function MakeSubtraction).

Best regards
Horst

Hi,

Here you'll find more information about subtraction of solids, and here you can read more about how to build a polyhedron from scratch. And from scratch I mean point-by-point, edge-by-edge and face-by-face. I am however not sure, if that is really what you need.

Best,
Bart

Thank you for your answers, but I'm not sure if solid subtraction is right approach. Most geometry engines allow faces to has more than one edge loop. Furthermore that would mean that solid need to store information about its geometry and its cutter as well. Is it really how Allplan handles solids?

To give my problem a bit of context, I'm working on link between Grasshopper (Rhino plugin) and Allplan. My aim is to process all of geometry work inside Grasshopper and export the result to Allplan. With solution you given that would be no longer the case.

Anhänge (2)

Typ: image/png
34-mal heruntergeladen
Größe: 274,38 KiB
Typ: image/png
33-mal heruntergeladen
Größe: 120,24 KiB

Hi,

I am not sure, if this is what you are aiming to, but I created a surface-type polyhedron (so not a solid) consisting of just one face and I created an opening inside it using Allplan function "subtraction". You can find the result attached in zip file. Then I analyzed this polyhedron with this code snippet:

        for i in range(polyhedron.GetFacesCount()):
            face = polyhedron.GetFace(i)
            print(f"{'-'*51} Face {i} {'-'*51}\n")

            for face_edge in face.GetEdges():
                print(f"Oriented edge handle {face_edge.EdgeHandle}; Positive: {face_edge.Positive}")
                _, edge = polyhedron.GetEdge(face_edge)
                print(f"Geometry edge: {edge.StartIndex} -> {edge.EndIndex}")

And here is, what I got:
--------------------------------------------------- Face 0 ---------------------------------------------------

Oriented edge handle 0; Positive: True
Geometry edge: 0 -> 1
Oriented edge handle 1; Positive: True
Geometry edge: 1 -> 2
Oriented edge handle 2; Positive: True
Geometry edge: 2 -> 3
Oriented edge handle 3; Positive: True
Geometry edge: 3 -> 0
Oriented edge handle 4; Positive: True
Geometry edge: 4 -> 5
Oriented edge handle 5; Positive: True
Geometry edge: 5 -> 6
Oriented edge handle 6; Positive: True
Geometry edge: 6 -> 7
Oriented edge handle 7; Positive: True
Geometry edge: 7 -> 4

So visually it looks like on the image I attached. There are two loops in the face, but the second one (4 -> 5 -> 6 -> 7 -> 4) has a negative orientation. This is how you can create an opening on a polyhedron face. Is this what you were looking for?

Best,
Bart

Anhänge (2)

Typ: application/zip
29-mal heruntergeladen
Größe: 4,60 KiB
Typ: image/png
12-mal heruntergeladen
Größe: 4,03 KiB

@bmarciniec Yes that's exactly what I was looking for, works like a charm, thank you!

BTW: I think that what you wrote should be included in API manual

Anhänge (1)

Typ: image/png
14-mal heruntergeladen
Größe: 173,84 KiB