How to create an Origin (Coordinate System) at the middle of an Edge in SpaceClaim?

Nikos Kallitsis
Nikos Kallitsis Member, Employee Posts: 38
10 Comments 5 Likes First Anniversary Ansys Employee
✭✭✭✭

I would like to create an Origin at the midpoint of each Edge included in a Group. How can I do that with SpaceClaim Scripting?

Best Answer

  • Nikos Kallitsis
    Nikos Kallitsis Member, Employee Posts: 38
    10 Comments 5 Likes First Anniversary Ansys Employee
    ✭✭✭✭
    Answer ✓

    You can use the following Script:

    GroupSelection = Selection.CreateByGroups("GroupName")
    
    for edge in GroupSelection.Items:
        originPoint = Point.Create(edge.EvalMid().Point.X, edge.EvalMid().Point.Y, edge.EvalMid().Point.Z)
        x_Direction = Direction.DirX
        y_Direction = Direction.DirY
        origin = DatumOriginCreator.Create(originPoint, x_Direction, y_Direction, None)
    

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 356
    25 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    FYI you could also use the curve evaluation (Edge.EvalMid()) to get the curve direction and set that as one of the CS directions instead of always at the global.