How to create points in a component in SpaceClaim?

Ansys Staff
Ansys Staff Member, Employee Posts: 24
Photogenic Name Dropper First Comment Ansys Employee
✭✭✭✭
edited June 2023 in 3D Design

When I create points in SpaceClaim with the following command :

point = Point.Create(X[i],Y[i],Z[i])

result = DesignCurve.Create(GetRootPart(),CurveSegment.Create(PointCurve.Create(point)),False).SetColor(None, Color.FromArgb(transparency, redColor,greenColor,blueColor))

This created points in curves folder under root part. How can I create these points directly within a specific component?

For example :

  1. Create component named “bob”

  2. Create points under “bob”

Tagged:

Answers

  • Valérie Gelbgras
    Valérie Gelbgras Member, Employee Posts: 157
    First Answer Solution Developer Community of Practice Member 5 Likes Ansys Employee
    ✭✭✭✭
    Answer ✓

    you can try to move the point in the component after creation

        rootPart = GetRootPart()
        component = rootPart.Components[0] # A component already exists
        point = Point.Create(1, 1, 1)
        pointCurve = PointCurve.Create(point)
        trimmedCurve = CurveSegment.Create(pointCurve)
        designCurve = DesignCurve.Create(rootPart, trimmedCurve, True)
        ComponentHelper.MoveBodiesToComponent(Selection.Create(designCurve), Selection.Create(component))
    

    or

    ClearAll()
    component = ComponentHelper.CreateAtRoot("ComponentBob")
    ComponentHelper.SetActive(Selection.Create(component))
    activePart = GetActivePart()
    point = Point.Create(1, 1, 1)
    pointCurve = PointCurve.Create(point)
    trimmedCurve = CurveSegment.Create(pointCurve)
    designCurve = DesignCurve.Create(activePart, trimmedCurve, True)
    
  • Valérie Gelbgras
    Valérie Gelbgras Member, Employee Posts: 157
    First Answer Solution Developer Community of Practice Member 5 Likes Ansys Employee
    ✭✭✭✭
    Answer ✓

    You can set the component active then create the point. The point will be in the component.

    ClearAll()
    component = ComponentHelper.CreateAtRoot("ComponentBob")
    ComponentHelper.SetActive(Selection.Create(component))
    point = Point.Create(1, 1, 1)
    result = SketchPoint.Create(point)
    

    or

    ClearAll()
    component = ComponentHelper.CreateAtRoot("ComponentBob")
    ComponentHelper.SetActive(Selection.Create(component))
    activePart = GetActivePart()
    point = Point.Create(1, 1, 1)
    pointCurve = PointCurve.Create(point)
    trimmedCurve = CurveSegment.Create(pointCurve)
    designCurve = DesignCurve.Create(activePart, trimmedCurve, True)