arunz Posted September 16, 2014 Posted September 16, 2014 Dear all, Is there a way to have multiple blocks with the same attribute auto-number (1,2,3,4...) based on the order selected? in Autocad 2014 LT Quote
steven-g Posted September 16, 2014 Posted September 16, 2014 It is possible to run a macro to increment an attribute number as you select blocks one by one, but the blocks need to have been inserted already and you would need to set the starting number first before you run the macro. If you could give more details and maybe post the block in question then someone could give a more detailed answer. You could also get a block to be inserted that increments an attribute number, it all depends on what exactly you are trying to do. Quote
arunz Posted January 21, 2015 Author Posted January 21, 2015 here i attached drawing i want to create a auto numbering in att. block can you explain me the macro Auto Number.dwg Quote
steven-g Posted January 21, 2015 Posted January 21, 2015 Attached is a copy of your drawing with a row of altered blocks, these are numbered out of order, if you use the following macro it will allow you to pick on the attributes and it will renumber the blocks, the macro uses two user defined variables called "count" and "inc", it also makes use of an attribute in the block with a tag of "one". the "*" at the start of the macro will make the macro repeat until you hit esc. Each time you run this you will need to initialise the start values first. *^C^C^Csetenv;"count";$M=$(+,$(getenv,count),$(getenv,inc));-attedit;y;*;one;;\;v;r;$(getenv,count);; but before you run that macro you will need to run this one that initialises the values for the two variables "count" and "inc" ^C^C^Csetenv;"count";1;setenv;"inc";1; You can use something similar in order to insert a series of blocks with incremental number values. Auto Number.dwg Quote
SLW210 Posted January 21, 2015 Posted January 21, 2015 I moved your thread to the AutoCAD LT Forum. Quote
Sumana Posted February 24, 2020 Posted February 24, 2020 Hello, I am new in Autocad. I have Autocad LT2020 version. I have series of circles which I need to number. I was looking for auto-numbering in LT version. I tried to use the macro above but I couldn't run it properly. Could anyone please help me out with it? While I am running the above macro, first it is asking me to select attribute. I am not sure what this attribute means. But I tried to select one of the circle, then it was looking for another corner and I couldn't understand what to select. Thank you, Sumana Quote
steven-g Posted February 24, 2020 Posted February 24, 2020 This thread is about renumbering existing attributes, that's not what you want is it? It would be best to start a new post but include a dwg to show what you are wanting to do. Quote
Sumana Posted February 24, 2020 Posted February 24, 2020 Hello Steven, The attached file is the file which has numbering within the circle. I need to create something like this one. I can create the circles but couldn't number them with LT2020 version. Thank you, Sumana Practice_Autonum1.dwg Quote
steven-g Posted February 24, 2020 Posted February 24, 2020 The macro you need for this is *^C^C._insert;2m_Brimstone_Survey;\1000;;;$M=$(getenv,count);setenv;count;$(+,$(getenv,count),1); But you first need to run the setenv command and set 'count' = 1 (you need to do this each time you want to reuse the macro) Just be aware that in the drawing you posted the circle block was scaled up by 1000, so that is why there is also the number 1000 in the macro. If you want to run this in a different drawing then you will need to copy the block into that drawing first. Quote
BIGAL Posted February 24, 2020 Posted February 24, 2020 Hi Steven in Autocad can find last number, in LT how to do a simple count blocks so returns count and can do setenv "count". Quote
steven-g Posted February 25, 2020 Posted February 25, 2020 Yeah LT cannot 'programmaticaly' find items in a drawing. It is down to the user to remember to do certain tasks like reset variables, or create numerous macro's. Quote
Sumana Posted February 25, 2020 Posted February 25, 2020 Hello Steven, I may sound very stupid but I have few question, 1) What does it mean the drawing is Scaled up by 1000? 2) What measure I need to take if I try to use this macro for other drawing? 3) ^C^C^Csetenv;"count";1; is it the macro I need to run before the one you send to me? Then, do I need to store it in a different macro and run it before I run the macro for auto-numbering? 4) *^C^C._insert;2m_Brimstone_Survey;\1000;;;$M=$(getenv,count);setenv;count;$(+,$(getenv,count),1); 2m_Brimstone_Survey : this I believe is the file name. I need to change this name for other drawing. Am I right? This much for now. Sorry for my stupid questions. I am a new user of AutoCad. Thank you, Sumana Quote
steven-g Posted February 25, 2020 Posted February 25, 2020 1) Not the drawing, it is the block that is scaled up, if you select one of the blocks in your drawing and look in the properties palette then you can see it has a scale factor of 1000, if you try and insert this block in your drawing it will be tiny. 2) Copy the block "2m_Brimstone_Survey" into the new drawing. There has to be at least the block definition in the drawing for this macro to work 3) Yes, it cannot be combined into one long macro it has to bee 2 separate macro's 4) That is the name of the block in the drawing you posted, you can change the name of the block, but you would then to change the name used in the macro. Quote
BIGAL Posted February 26, 2020 Posted February 26, 2020 (edited) Hi Steven again "Useri1" is a integer variable available in the dwg 5 integers 5 reals 5 strings. $(getvar,useri1) like wise setvar,dimscale ? goes up to 32000 Has advantage its saved in the dwg. Disadvantage it can not renumber if you delete one. Edited February 26, 2020 by BIGAL Quote
steven-g Posted February 26, 2020 Posted February 26, 2020 LT only has the 5 integers and the 5 reals, no string variables for some reason, but we do have setenv and getenv for strings. I prefer those because they can be more descriptive even for use with numbers it makes macro's a lot easier to read than trying to remember what each variable is holding. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.