Support Forum

[Frage] I would like to change the Radius of the Cylinder. [Gelöst]


Dear,All

I would like to change the Radius of the Cylinder.
However, it seems that only properties in Properties can be changed in the Python API. Is there a way to change the Radius?
Or, can I create a new cylinder by reading the Radius value?

[ModelElement3D (
   CommonProperties(
      Color                       (4)
      Layer                       (3734)
      Stroke                      (1)
      Pen                         (1)
      ColorByLayer                (0)
      PenByLayer                  (0)
      StrokeByLayer               (0)
      HelpConstruction            (0))
   TextureDefinition(
      SurfacePath                 ())
   TextureMappingProperties(
      MappingType                 (4)
      MappingAngle                (0)
      XScale                      (1)
      YScale                      (1)
      XOffset                     (0)
      YOffset                     (0)
      PhongAngle                  (0)
      ReferenceFace               (0)
      ReferenceEdge               (0)
      UV Coordinates count        (0))
   BRep3D(
      RefPoint(0, 0, 0)
      PartsCount(1)
      EdgeCount(3)
      FaceCount(3)
      VertexCount(2)
      Vertices(
         (277710.9884902195, 306568.5859456454, 0)
         (277710.9884902195, 306568.5859456454, 5000)))
)
]

Anhänge (1)

Typ: image/png
20-mal heruntergeladen
Größe: 79,33 KiB

Lösung anzeigen Lösung verbergen

Hi,

you must first check, whether your BRep is a cylinder. Use IsCone for that, as a cylinder is a special type of cone. This function gets you the placement, radius and height, so everything you need to create a new cylinder geometry to overwrite the old one. Here's an example of increasing the radius by 200 mm:

        is_cone, placement, bottom_radius, top_radius, height = old_cylinder.IsCone()
        if is_cone and bottom_radius == top_radius:
            new_cylinder = AllplanGeo.BRep3D.CreateCylinder(placement,bottom_radius + 200,height)

Best,
Bart

Hi,

you must first check, whether your BRep is a cylinder. Use IsCone for that, as a cylinder is a special type of cone. This function gets you the placement, radius and height, so everything you need to create a new cylinder geometry to overwrite the old one. Here's an example of increasing the radius by 200 mm:

        is_cone, placement, bottom_radius, top_radius, height = old_cylinder.IsCone()
        if is_cone and bottom_radius == top_radius:
            new_cylinder = AllplanGeo.BRep3D.CreateCylinder(placement,bottom_radius + 200,height)

Best,
Bart

With your help, it's solved.
thank you