AnsweredAssumed Answered

Can't array a solid body using the API

Question asked by Harold Black on Jul 30, 2019
Latest reply on Jul 30, 2019 by Harold Black

I'm trying to array a solid body (weldment) around a circular face. I recorded my actions and modified the code to work with repeated runs. My problem is the selection for Direction1. My attempts are shown below.

 

1)   FAILS:   bool = swModel.Extension.SelectByID2("Face" & swFace.GetFaceId, "FACE", 0#, 0#, 0#, True, 256, Nothing, 0)

      swFace is the selection I made; the circular face about which I want to array around.

 

2)   FAILS:   bool = swModel.Extension.SelectByRay((abs(skPoint2.X) - abs(skPoint1.X)) / 2, abs((skPoint2.Y) - abs(skPoint1.Y)) / 2,abs((skPoint2.Z) - abs(skPoint1.Z)) / 2, 0#, 0#, 1#, 2, swSelFACES, False, 0, swSelectOption_e.swSelectOptionDefault)

      I then tried to use SelectByRay by using a ray starting at a point directly on the center of the axis of the circular face. skPoint1 and skPoint2 lie on each end edge of the circular face respectively. skPoint2 will always be greater than skPoint1.

 

3) WORKS:   bool = swModel.Extension.SelectByID2("Axis1", "AXIS", 0, 0, 0, True, 1, Nothing, 0)

     I decided to try selecting the axis of the circular face.

 

I would like to use the first method. If that's not possible then the 2nd method would have to suffice. I want to avoid using the 3rd method since the model may not have an axis. I'm not sure why method 1 and method 2 does not work. Any answers to this would be greatly appreciated.

 

The attached image show a cylindrical body along the length of the cylindrical face. I can't really supply the model as it's being created by user input and selections from a macro. I can't supply the macro either since it is company property.

Outcomes