hey im using autocad 2013 and i have 2000 blocks called Drain_bore
and they have BORE_NUMBER attribute for example:
720/1/
719/1/
687/1/
while the first 3 digits represent area code and the next digit represent item code
i need a lisp that would automaticlly number all the blocks in my drawing without changing the existing attribute for example:
720/1/1
720/1/2
720/1/3
719/1/1
719/1/2
687/1/1
687/1/2
so basiclly just adding a number in incrementals of +1 after the actual value
please help
usually the blocks are always connected (working with water infrastructures)
so i would prefer if i choose the first block and it will automaticlly continue from there like this:
(zero is a manhole and ------- is a connecting line)
0----------------------------0-------------------------0
720/1/1 720/1/2 720/1/3
most of the times i will have something like this
0 540/1/1 0 530/1/1 0 721/1/3
| | |
| | |
| | |
0-------------------------0--------------------------------0 0------------------------------0------------------0
| 720/1/1 720/1/2 720/1/3 721/1/1 721/1/2 721/1/4
|
|
|
0 540/1/2
Can you post a sample drawing or part of that drawing to check ?
gave an example of street 413
xxxx/yy/zz
xxxx-street code (e.g. 413)
yy- accessory code (0 means manhole)
zz-id number so we can individualize them in data extraction
possible?
Please ignore if you already tried this.
A quick thing in mind is ...have you considered ATTOUT and ATTIN commands from Express tools ?
ATTOUT will give you an output as attached and edit the Manhole name using excel and use ATTIN to bring back the changes in the drawing.
yes i know but the numbering must go in series like first manhole and then the second manhole connected to it on same street
and in excel its pretty random..
Yes if you ATTOUT, have to sort the manhole names in excel or have to select in order from AutoCAD.
Also try this lisp routine.
(vl-load-com) (defun C:ADDIN ( / base_MH eNAME base_name eNAME EOBJ st_code item_code num tn Sl_Ln) (setq base_MH (entsel "\nSelect the Base Manhole:")) (setq base_name nil) (setq eNAME (car base_MH)) (setq EOBJ (vlax-ename->vla-object eNAME)) (if (= (vla-get-hasattributes EOBJ) :vlax-true) (progn (foreach N (vlax-safearray->list (variant-value (vla-getattributes EOBJ))) (if (= (vla-get-tagstring N) "BORE_NUMBER") (setq base_name (vla-get-textstring N)) ) );for each );progn (progn (alert "No attributes found for this block\n") (exit) );progn );if (if base_name (progn (setq st_code (substr base_name 1 3));street code (setq item_code (substr base_name 5 1));item code (setq num 1);increment (princ "\nSelect the continous Manholes") (setq Slctn (SSGET )) (setq Sl_Ln (sslength Slctn)) (setq tn 0) (repeat Sl_Ln (setq Obj (ssname Slctn tn)) (setq EOBJ (vlax-ename->vla-object Obj)) (if (= (vla-get-hasattributes EOBJ) :vlax-true) (progn (foreach N (vlax-safearray->list (variant-value (vla-getattributes EOBJ) ) ) (if (= (vla-get-tagstring N) "BORE_NUMBER") (vla-put-textstring N (strcat st_code "/" item_code "/" (itoa num))) ) );for each );progn );if (setq tn ( + tn 1)) (setq num ( + num 1)) );repeat );progn );if );defun
You have to select the First Manhole text and the subsequnet manhole text in order.