Support Forum

[Frage] [PythonParts] Face Offset [Gelöst]

Schlagworte:
  • Pythonpart
  • Polyhedron
  • FaceOffset

Hi,

I want to generate a volume with a polyhedron and faces offset.

When I tried with a simple cube, it's working with :

        cube = Geometry.Polyhedron3D.CreateCuboid(Geometry.AxisPlacement3D(),
                                    1000,
                                    1000,
                                    1000
                                    )

        face_offset = Geometry.FaceOffset(cube)
        err, geo = face_offset.Shell(100,
                                     Geometry.FaceOffset.eNormalDirection,
                                     False,
                                     False,
                                     None
                                     )

but I didn't manage to get the offset with another polyhedron (based on a extruded polygon)

What I'm doing wrong ?

Best
Christophe

Anhänge (2)

Typ: image/png
6-mal heruntergeladen
Größe: 141,82 KiB
Typ: image/png
17-mal heruntergeladen
Größe: 227,50 KiB

Lösung anzeigen Lösung verbergen

Hi,

Here the code :

        polyline = self.selection_result.sel_element.GetGeometry()

        limite = Geometry.Polygon2D()

        if polyline.Points[0] == polyline.Points[-1]: # Delete last element if it's the same point than the first one
            polyline.Points.pop()

        for point in polyline.Points:
            limite += point
        limite += limite.StartPoint

Best

Hi,

The problem comes from the fact that the polyline has an "excess" point (first and last are the same) so Allplan cannot calculate the offset...

Can we purge polygon2d ?

Best

Hi,

Here the code :

        polyline = self.selection_result.sel_element.GetGeometry()

        limite = Geometry.Polygon2D()

        if polyline.Points[0] == polyline.Points[-1]: # Delete last element if it's the same point than the first one
            polyline.Points.pop()

        for point in polyline.Points:
            limite += point
        limite += limite.StartPoint

Best