[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Calculate Offsets for Centering
Tip# 3539 By Ed Galicki On 22-Nov-2010
4
Rated By 1 users
Categories : Distance
Software type : AutoCAD 2011
Rename File To : No Files to download.
Find the distance to offset an object in order to center it on another object.

Tipster Ed Galicki shares a command macro that he uses in AutoCAD Mechanical Desktop (AMD) that helps him calculate centering distances for stacked plates.

"I got tired of calculating how much to move something over to center one item on another. I usually use this tip in Mechanical Desktop when I put a plate (or something similar) on a second one. This gives the distance to constrain the edge away from the edge of the second part, without requiring annoying calculating.
 
I am a grouchy old codger and still use a tablet. This is a line of AutoLISP on my tablet:
 
(/ (-(GETDIST "BIG")(GETDIST "SMALL")) 2.0)
 
Notes from Cadalyst Tip Patrol: Although Ed uses this bit of code in AMD, it will work in AutoCAD and all of its verticals. Create a new command in the CUI (command user interface) using this bit of code. Then add that command to a toolbar, palette, ribbon, or even the quick-access toolbar. Draw your two shapes and start the command. Pick two points on the largest object in order to define its width. Then pick two points on the second, or smaller object, to define its width. The code subtracts the second distance from the first, then divides by two. The distance shown is how far you need to offset the second object to center it on the larger object.
 

 

Average Rating:
4


User comments


Log In