Back at it.. Slugging through a big pile of drawings.
This time I have run across a large swath of drawings that I need a secondary macro for. Basically my other Marcos are working fine except this group of drawings are the wrong size. So it just needs a little scaling and everything is fine. I want to fix the issues with one click.
So my objective is to scale a block from its insertion point to a known scale. Sounds easy right?
Well to start I had to create a new macro button like I did in my last example. Creating a Macro with the cadnoob.
So per that article my macro donkey balls is doing great, but its been retooled to do some other tricks; one of which is to insert a block and this is the block I need to be tinkering with. To bring you up to speed this is what donkey balls now looks like.
This Macro does the following:
- changes to layer 0
- Purges the drawing
- Binds all xrefs (still a few issues with this)
- and inserts a block
Basically this takes the drawing and gets it ready for its next big adventure and stamps it with a block that says the drawings has successfully passed this portion of the job. All fine and dandy but my block is scaled to fit a D size drawing and I hit a huge section of B sized drawings. Now you must understand that I'm incredibly lazy so having to scale these things after having all other aspects automated is like taking the stair to the top of a very tall building... I'd rather not do it... My fat ass is headed to the elevator.
So to the elevator I went. I created a new command an threw it on my palette. I started tinkering. First offwhen you scale you have to select what you want to scale... Lazy man doesn't want to do this so I employed 'p' which stands for previous I think. Next it wants you to select another object to scale. This is a handy feature if you need to scale multiple objects but in this instance its as if AutoCAD is fucking with me. Its like its saying "come on fatty ... you gotta take the stairs some times". Alas I persist in my pursuit of minimal effort. If you remember from last macro tutorial the semi colon acts as hitting enter. You could either use a semi colon here or AutoCAD actually has a command to exit the multi-selection prompt. I could have entered "single" but I'm going for minimal key strokes! Ok now it asks for the base point. This was the noob trap in this whole ordeal. I decided to try to use the snaps and realized that there should only be on insertion point for the block, but it kept giving me the point for the text associated with the block... the noob is boned... I tried all kind of crap and googled my ass off to no resolve. Eventually I devolved into typing random crap and screaming at the computer. one of these dumb luck key stoke combinations showed me a glimpse of a way out. I'm not sure how the insert snap works with in macros but it was prompting me for the scale but this was not the scale of the scale command and this is why I was thoroughly confused. In my google fest searching for an answer I found that some one used "@" in a macro. They indicated that it meant the last point indicated. So say if you wanted to create a line with no length you would put in your first coordinate of 0,0 and follow that with "@" this would give you a line of [0,0],[0,0]. On a whim I put this in and we are off. I have no clue why it behaves this way.. the only thing I can think of is maybe its perhaps offering an offset from the insert... but I'm just guessing. After that I knew the scale I wanted and bam! Lazniess achieved.
So here it is in all its glory. A macro that scales a block from its insertion point to a discrete scale in one click: