I had a macro to insert blocks incrementing an attribute each time. It falls over in Lt 14 because a dialogue box opens for the attribute value. Is there a system variable to suppress this.
Thanks for any help with this if you can get it to work I shall post the macro.
Solved! Go to Solution.
It would help if you'd posted your actual macro, but...how about ATTDIA?
Lynn Allen's Blog
http://lynn.blogs.com/lynn_allens_blog/2007/08/an-autocad-hi-1.html
ATTREQ: When ATTREQ is set to 0, you will not be prompted for an attribute value as you are inserting the associated block or MLEADER. You would then need to double-click on the block (or MLEADER) to set the value. More than likely you'll want ATTREQ set to 1 to save additional steps. More than one reader emailed me with this issue.
ATTDIA: When set to 1, you will receive the attribute dialog box prompting you for a value as seen below. When set to 0 you will be prompted at the command line. This is really your personal preference.
I did say that once I had got the macro working I would post a copy. I got the Idea from somewhere on the net, but cannot credit them as I have lost the note, and had to fiddle with it to get it to work. It is particularly useful for Pile Numbers and Setting Out Points on Structural / Civil drawings. It places a block with a single attribute and increments the value of the attribute by 1 each time continuing until right click or escape.
Set up a new command button and Copy this into the macro line
"*^C^C^Psetvar;ATTDIA;0;_INSERT^M;\;;$M=$(+,$(getvar,USERI1),1);setvar;USERI1;$M=$(+,$(getvar,USERI1),1);" without the quotes.
To use it, first use the INSERT command to place an instance of the block, INSERT remebers the name of the last block inserted.
Next use SETVAR to set USERI1 (note the I between R and 1|) to the value to one less than will be required. If you want 1 then 2 then 3 set it to 0.
Then click the new command button and locate the blocks. Right click to end the macro.
I did find that the number of enters or semicolons between the \ for input and $M varies between different versions of AutoCAD.
Nick
Too complicated, simplify it and avoid the 'remember to do these things first' trap:
*^C^C_undo;_mark;_setenv;StartWithNumber;\_-insert;MYBLOCK;\;;0;$M=$(getenv,StartWithNumber);setenv;StartWithNumber;$(+,1,$(getenv,StartWithNumber));
* is added, like yours, to keep it running until you cancel it.
No need to turn off ATTDIA here for me.
UNDO to let you undo the last number, not the entire series of numbers you just dropped in.
Use an Environment Variable (that you can name to remind the user what the prompt is looking for) that will truly remember your last entry the next time you restart it, or have to pick it up again much later. Feel free to change the name of the Variable, I chose STARTWITHNUMBER since that's what I want to call it.
Actually call the darn block you want to use in the macro (instead of inserting it first then hoping it never gets replaced). MYBLOCK here can be the name of your block. If you actually path your blocks locations in LT you won't have to 'bring it in first' either, LT knows where to get it all the time.
Hit <enter> or use a right-click <enter> to accept the number before placing it: or type a new number if you want to change it.
Cancel with an ESC whenever you are done or need to stop. Restart the amcro to pick up where you left off.
Enjoy.
Dean
I am sure you are right and setenv is a new command to me and I shall try it out when nI have the time. My command works for me and I don't need to change the command for different blocks.
Setting ATTDIA to 0, is a requirement for AutoCAD Lt and AutoCAD 2014 as Autodesk reversed the default value from 0 to 1 so by default a dialogue box opens. To be fair a dialogue box makes sense normally.
Nick