Foro de Soporte Allplan

[Pregunta] [PythonParts] Face Offset [Guardado]

Etiquetas:
  • 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

Adjuntos (2)

Type: image/png
Descargado 12 veces
Size: 141,82 KiB
Type: image/png
Descargado 19 veces
Size: 227,50 KiB

Show solution Hide solution

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