Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autonumber different rectangles

3 REPLIES 3
Reply
Message 1 of 4
dpappus1
470 Views, 3 Replies

Autonumber different rectangles

I am looking for a way to automatically detect rectangles of certain size in an autocad file and add a numbering attribute to it which later could be exported in the form of a csv report. 

 

In the attached dwg file you will find a set of rectangles which are arranged in the form of an array with 6 columns and 4 rows although they have not been constructed using array function in Autocad. The program should automatically number them as follows:

 

19 20 21 22 23 24 

13 14 15 16 17 18

07 08 09 10 11 12

01 02 03 04 05 06

 

Is this something doable in Autocad?

3 REPLIES 3
Message 2 of 4
Kent1Cooper
in reply to: dpappus1

Take a look at this thread about Blocks, and this related one [which has a link to the former] about Text.  I don't think it would be difficult to modify either of those to sort Polylines into a similar list, sorting from the Bottom row first and from the Left in each row.  An initial selection of Polylines could be stepped through to keep only those of a certain size, or within a certain size range, or whatever your criteria would be, before applying the sorting operation.  It could then use the resulting sorted list of Polyline entity names to place sequential Text elements.  [The exporting to .csv I leave to others.]  Does that seem worth pursuing?

Kent Cooper, AIA
Message 3 of 4
3wood
in reply to: dpappus1

You can try attached ALTEXT.vlx.

There are 2 methods to do it.

Method 1

1. Create a text object in the middle of each rectangle.

2. Use ALTEXT to select texts.

3. Select "Left-Right / Up-Down" option in "Sort selection" part.

4. Mirror the result.

altext01.png ->

 

 altext02.png ->

 

altext03.png

 

Method 2

1. Create a text object in the middle of each rectangle.

2. Use ALTEXT to select texts.

3. Create a polyline / polylines to present the number sequence. (You can create 1 part, array it then JOIN all parts as one polyline)

4. Select "Along paths" option in "Sort selection" part.

5. Select the polyline(s) in Step 3.

altext21.png ->

 

altext22.png

 

If you need leading zero in the result, just put a leading zero in original texts, eg. "01" 

Message 4 of 4
devitg
in reply to: dpappus1

You say detect rectangles of certain size at your dwg there are all equal size rectangle . Could you upload a dwg with a REAL case ?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost