Create a polygon in Spaceclaim / Discovery

Options
Gabriel Messager
Gabriel Messager Member, Employee Posts: 49
5 Likes Name Dropper First Anniversary Ansys Employee
edited June 2023 in 3D Design

Comments

  • Gabriel Messager
    Gabriel Messager Member, Employee Posts: 49
    5 Likes Name Dropper First Anniversary Ansys Employee
    Options
    ClearAll()
    # Define the parameters
    innerRadius = MM(1)
    numSides = 6
    extrusionHeight = MM(3)
    # Create the frame for the polygon
    frame = Frame.World
    # Create the polygon face
    poly = Polygon.Create(frame, innerRadius, numSides)
    segments = CurveSegment.Create(poly)
    design_curve = DesignCurve.Create(GetRootPart(),segments)
    result = Fill.Execute(Selection.Create(design_curve))
    surface = Selection.Create(result.CreatedFaces[0])
    options = ExtrudeFaceOptions()
    options.ExtrudeType = ExtrudeType.Add
    ExtrudeFaces.Execute(surface, extrusionHeight,options)
    design_curve.Delete()
    Selection.Empty().SetActive()