Distance Mate Macro (re-visited)
Distance Mate Macro (re-visited)
(OP)
Continuation of thread559-202450: Distance Mate Macro...
Handleman,
I finally had a (for lack of a better word) opportunity to delve into the InsertDistanceMate macro you wrote. One thing I've come across is that with AddMate3...even tho you specify AlignmentCLOSEST, the command does not obey that. I saw all of the additional code you used to try and get the part back to it's original position, but it still didn't prove to be 100% bulletproof for me (in predicting the initial position, everything else worked great). The Alignment and Flip seem to have a mind of their own, and it was very difficult to predict what they would do when creating test mates over-and-over and watching the behavior.
So I was tinkering with the code, and discovered this:
Obviously, the major drawback with this command is that it is obsolete. But for now it still seems to work well. Below is the topic from the API Help.
Enjoy,
Ken
Handleman,
I finally had a (for lack of a better word) opportunity to delve into the InsertDistanceMate macro you wrote. One thing I've come across is that with AddMate3...even tho you specify AlignmentCLOSEST, the command does not obey that. I saw all of the additional code you used to try and get the part back to it's original position, but it still didn't prove to be 100% bulletproof for me (in predicting the initial position, everything else worked great). The Alignment and Flip seem to have a mind of their own, and it was very difficult to predict what they would do when creating test mates over-and-over and watching the behavior.
So I was tinkering with the code, and discovered this:
- AddMate2 is just as unreliable/unpredictable (requiring the major trial and error, as you had went thru)
- AddMate on the other hand does not move the part around at all. It actually does apply the Aligned/Anti-Aligned that is the CLOSEST. And you already had the legwork done to find the inital distance and Flip orientation, so using this code rather than AddMate3 has so far been working really well for me.
CODE
swAssy.AddMate swMateDISTANCE, swMateAlignCLOSEST, False, CurDist, 0
Enjoy,
Ken






RE: Distance Mate Macro (re-visited)
While we're on the subject of mating macros, one tweak I've added (and it only takes a single line of code!) to the ones I'm using is that at the very end of the macro it re-selects the first of the two selections that the user selected for mating. That makes it easy to ctrl-select another entity in the times when you want to mate a bunch of things to a single entity.
-handleman, CSWP (The new, easy test)