4 Replies Latest reply on Mar 3, 2016 2:38 PM by Danny Bradford

    VB.net function: How to properly orient my inserted part to an assembly

    Danny Bradford

      Greetings all,

       

      i have created a Solidworks function to insert multiple parts based on user selection of 2 lines that intersect each other. I am locating the inserted parts relative to the user selected lines.

       

      I have everything set up no problem with one issue remaining. I am using AddMate3 but I cannot predict whether to flip the distance mate. As a result sometimes my parts are in the reverse orientation of how they should be.

       

      What is the best approach to make this determination? I do not have a problem using the various APIs, just cannot find anything predictable that I can work with. I have tried many approaches but not are stable.

       

      The two lines are on an elongated face and I must be ready in case the user selects the either long line or either short line. The image below has the yellow cylinders properly oriented but sometimes they flip:

       

       

      I need to be able to run this on any of the thin faces on the brown cube. As you can see the criteria must be relative between the 2 selected lines.

       

      Your help is much appreciated.

       

      Danny Bradford