Block numbering script

Block numbering script

thisispreston
Advocate Advocate
7,940 Views
14 Replies
Message 1 of 15

Block numbering script

thisispreston
Advocate
Advocate

Hi all,

I’m in need of some help writing what I think  is a fairly simple script. I could be wrong of course, not had a lot of experience writing scripts!

 

I basically need a script that will number my blocks sequentially.

 

To elaborate a little…. I’m doing some development work for our Audio Visual guys, making blocks for different equipment types – speakers, display screens etc. I’ve given the blocks various attributes including building level, room name and so on, the usual things you would want for equipment scheduling. Along with this we also need to number these bits of equipment so I’ve added an attribute for this into each block too.

I was hoping that rather than have to manually go round numbering all these blocks all the time (which due to human nature will no doubt end up with duplicates as well!) I could write a script that would do it for me, with a variable where I can change the block name so I can run it for each equipment type.

 

So to summarise I need a script that does something like this:

 

Find - all blocks named <block name> (this is the bit I need to be able to change for the other blocks)

In attribute <EQ.NO.> (this is the same on all blocks)

Fill in with 001

Then go up sequentially through other blocks

 

It doesn’t have to follow any sort of order in terms of placement, I don’t care if 001 is the other side of the building to 002, I just want to eliminate the manual element of doing it.

 

All help is much appreciated, thanks!

 

Tom

-----------------------------------------------
"music is my religion" - Jimi Hendrix
0 Likes
Accepted solutions (2)
7,941 Views
14 Replies
Replies (14)
Message 3 of 15

thisispreston
Advocate
Advocate

Thanks for the suggestions.

 

Sadly neither of the lisps in the first two links actually work, and the third one wouldn't even download!

-----------------------------------------------
"music is my religion" - Jimi Hendrix
0 Likes
Message 4 of 15

Anonymous
Not applicable
Message 5 of 15

ВeekeeCZ
Consultant
Consultant
Accepted solution

Ok, try the third. I downloaded it for you (left is such diskette, click on it).
I tried a routine, is quite complex and contains everything you wanted to.

There is a readme file inside... 

 

Log from the routine..

 

>>BlockC: Select blocks to renumber:
Select objects: Specify opposite corner: 4 found
Select objects:
>>BlockC: Sort blocks by [X/Y/as-Select/Reverse-select] <Select>: x
>>BlockC: Counter starting number <13>: 1
>>BlockC: Counter prefix ('.'=none; '000' leading zeroes) <000>:
>>BlockC: Counter suffix ('.'=none) <>:

 

EDIT: Ohh, maybe you're unable to specify a particular attribute in case the block has more then one. @vladimir_michl

Message 6 of 15

vladimir_michl
Advisor
Advisor
Accepted solution

If you need to increment a different attribute, enter the following LISP command (or add it to your ACADDOC.LSP or ACAD.MNL):

 

(setq insertc:AttNo 2)

 

- as mentioned in the tip above.

 

Vladimir Michl, www.cadstudio.cz www.cadforum.cz

Message 7 of 15

thisispreston
Advocate
Advocate

Thanks everyone for the help, and thanks BeekeeCZ for downloading that for me, don't know why I couldn't get it to download?

Will try these new suggestions when I get into work tomorrow and let you guys know how I get on 🙂

 

Thanks again,

Tom

-----------------------------------------------
"music is my religion" - Jimi Hendrix
0 Likes
Message 8 of 15

3wood
Advisor
Advisor

You can also try attached ALTEXT.vlx.

Complete the task in 3 steps.

You need load ALTEXT first.

Step 1,

Select a target block, then select all similar blocks by using "Select similar" option in the shortcut menu when you right-click the block.

temp2.png

 

Step 2,

Use command ALTEXT to change certain attribute value to "001" or whatever is the first number.

 

Type in attribute sequence number.

temp4.JPG

 

Change certain attribute value to a start number.

temp3.JPG

 

Step 2,

Use ALTEXT again, select "p" for previous selection. Change settings as below:

altext1.JPG

 

The result is as below:

altext2.JPG

 

You can also sort the number order with a certain rule, just simply select an option from the first pop-up menu.

altext3.JPG

 

Message 9 of 15

thisispreston
Advocate
Advocate

Thank you all so much for the help, this forum is the best!

 

BeekeeCZ - that third link you sent originally, the InsertC/BlockC one works like a charm, thanks.

Now I just need to explain to the engineers how to do it so I don't have to always be doing it myself! Haha.

 

Thank you all again,

Tom

 

EDIT: Forum seems to be playing up at the moment, won't let me give kudos or 'accept as solution'? I'll come back later to make sure I give you all credit for your help and to mark that one as the solution 🙂

-----------------------------------------------
"music is my religion" - Jimi Hendrix
Message 10 of 15

ВeekeeCZ
Consultant
Consultant
Glad you found a suitable solution. But all the credit belongs to Mr. Michl and his team of developers routines. In this case, I'm just a messenger :).
Message 11 of 15

thisispreston
Advocate
Advocate

Yes, you're right I should be!

 

Thank you Mr. Michl for your brilliant scrpit/lisp routine that has now saved me countless hours of boring manual data entry! And thanks to your team as well 🙂

-----------------------------------------------
"music is my religion" - Jimi Hendrix
Message 12 of 15

vladimir_michl
Advisor
Advisor

You are welcome. You can find more utilities of this kind at http://www.cadstudio.cz/freeware

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

0 Likes
Message 13 of 15

leonard.roussel
Participant
Participant

InsertC worked like a charm earlier this week because I found a command that opens up the GUI for InsertC- a popup window where you can enter your increment and suffices etc. Does anyone remember which command that is? 

 

Thanks!

 

Doing everything from the command line gives me an error:

>>InsertC: Pick next insertion point - '111' <end>:
"U26.dwg": Can't find file in search path:
  C:\WINDOWS\system32\ (current directory)
  J:\N-Y\250000\257877-00\4 Internal Project Data\4-03 Drawings\4-03-03 AudVis\_Functionals\DD\
  C:\Users\leonard.roussel\appdata\roaming\autodesk\autocad 2016\r20.1\enu\support\
  C:\program files\autodesk\autocad 2016\support\
  C:\program files\autodesk\autocad 2016\support\en-us\
  C:\program files\autodesk\autocad 2016\fonts\
  C:\program files\autodesk\autocad 2016\help\
  C:\program files\autodesk\autocad 2016\express\
  C:\program files\autodesk\autocad 2016\support\color\
  C:\program files (x86)\autodesk\applicationplugins\autodesk appmanager.bundle\contents\resources\
  C:\program files (x86)\autodesk\applicationplugins\autodesk appmanager.bundle\contents\windows\2016\
  C:\program files (x86)\autodesk\applicationplugins\autodesk importskp.bundle\contents\resources\
  C:\programdata\autodesk\applicationplugins\autocad2016addin.bundle\contents\win64\
  C:\Program Files\Autodesk\AutoCAD 2016\drv\
  C:\Program Files\Autodesk\AutoCAD 2016\
*Invalid*
0 Likes
Message 14 of 15

vladimir_michl
Advisor
Advisor

InsertC/BlockC have no GUI dialog. You can specify all parameters through the command prompts (including the block name - it must exist in the drawing or in the search path as a DWG).

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

0 Likes
Message 15 of 15

leonard.roussel
Participant
Participant

My bad - it was Numinc! Thanks.

0 Likes