How to create a coordinate system that specifies the direction of a specific axis?

wanghao
wanghao Member Posts: 27
10 Comments Name Dropper
**

Hi

My need is create a coordinate system which perpendicular to the chair back(the two faces selected on the picture).

The most usual way to create the coordinate system what I want by ACT script like below.
Then I got a cooridinate system which is perpendicular to some plane face.

#region Context Menu Action
coordinate_systems_18 = Model.CoordinateSystems
coordinate_system_106 = coordinate_systems_18.AddCoordinateSystem()
#endregion

#region Details View Action
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Ids = [756]
coordinate_system_106.OriginLocation = selection
#endregion

#region Details View Action
coordinate_system_106.PrimaryAxisDefineBy = CoordinateSystemAlignmentType.Associative
#endregion

#region Details View Action
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Ids = [756]
coordinate_system_106.PrimaryAxisLocation = selection
#endregion

But there are some problems that the two faces are curved surface, not a plane. So I cannot get the coordinate system by the script above.

Is there any good idea for create a coordinate system which is perpendicular to the curved surface?

Comments

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee, GitHub-issue-creator Posts: 327
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited June 2024
    with open(r'D:\Temp\SolidMechanics.py') as f:
        cmds = f.read()
    exec(cmds)
    
    my_cs = Model.CoordinateSystems.AddCoordinateSystem()
    RotCS(my_cs,[[0,0,1],[1,0,0],[0,1,0]])
    
  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee, GitHub-issue-creator Posts: 327
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    @Jimmy He Did you publish your coordinate system toolkit?