×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Distance Mate Macro (re-visited)

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:
  • 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
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

 

RE: Distance Mate Macro (re-visited)

Thanks, Ken!  I have noticed that the Flip is a bit unreliable in cases where the mate that is added overdefines the assembly, but I hadn't noticed a problem with the alignment.  However, it's quite possible that I haven't been paying that close of attention either.  smile  I'll make a point to be more observant and see if it's happening on my end too.

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)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources