AnsweredAssumed Answered function: How to properly orient my inserted part to an assembly

Question asked by Danny Bradford on Feb 25, 2016
Latest reply on Mar 3, 2016 by 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