Hi there!
I've got 1800 attributes that need to be numbered from 1 to 1800 from left to right.
I got a Lisp that can do that but the only thing is when I select it with selection window, he wil sort all atributes on their unique handle code. So I have the first 40 attributes going from left to right with groups of numbers at the wrong place like 1-10, 31-40, 21-30, 11-20 instead of 1-40.
This is because when you copy an attribute he wil place a new unique handle coded attribute and the copy contains the previous handle code.
But if I select them one by one from left to right and run my lisp it just works fine cause it seems it doesnt look at the handle code to place the numbers in that order.
So is there a way that I can select multiple attributes, like I'm selecting them one by one from left to right, so I can bypass this attribute handle code?
That'll save me some clicking time 🙂
Kind regards,
Peter
Solved! Go to Solution.
Solved by 3wood. Go to Solution.
Here it is:
;==============================================================================
; NAME
;
; attnum.lsp - numbers attributes in ascending order
;
; USAGE
; (load "attnum.lsp")
; attnum
;
; SYNOPSIS
;
; Numbers automatically from a number of choosen elements the first
; attribute in ascending order. The startvalue can be given. When an
; object is selected which has no attributes, the attribute will not
; be numbered but the counter will be incremented with 1. Thereby is
; it possible to count the appendages without an attribute.
;
; BUGS
;
; No errorchecking is done.
;
; HISTORY
; version date by
; 1.0 19-02-2001 JFM initial version
;
;
;===============================================================================
(defun c:attnum ()
(if (not tpp)
(setq tpp "...")
)
(princ "Geef PP-code<")
(princ tpp)
(princ ">:")
(setq pp (getstring T))
(if (= pp "")
(setq pp tpp)
)
(if (not tappnr)
(setq tappnr 1)
)
(princ "Startvalue: <")
(princ tappnr)
(princ ">:")
(setq appnr (getint))
(if (not appnr)
(setq appnr tappnr)
)
(princ "Select objects in order:")
(setq objects (ssget))
(setq teller 0
aantal (sslength objects)
)
(while (< teller aantal)
(setq element (ssname objects teller))
(setq nextent (entnext element))
(setq attrib (entget nextent))
(setq oud (assoc 1 attrib))
(setq vlgnr (itoa appnr))
(if (< appnr 10)
(setq vlgnr (strcat "0" vlgnr))
)
(setq tagcode (strcat pp vlgnr))
(setq nieuw (cons 1 tagcode))
(setq attrib (subst nieuw oud attrib))
(entmod attrib)
(entupd nextent)
(setq appnr (+ appnr 1))
(setq teller (+ teller 1))
)
(setq tappnr appnr)
(setq tpp pp)
)
;|«Visual LISP© Format Options»
(80 3 1 2 nil "end of " 60 9 0 0 0 T T nil T)
;*** DO NOT add text below the comment! ***|;
Please try attached ALTEXT.vlx which has an option allowing sorting selection in "Left-Right/Up-Down" order.
Step 1, (If the attributes are in the same value, eg. 0001, skip this step) Change all attributes to 0001, setting as below:
Step 2, Run ALTEXT again, select "P", change the relateve attribute (in your case I assume is attribute No. 1) in order, settings as below:
I also attached here updated example drawing for your information.
thnx for the reply!
I tried Altext before and just send an email for the registration code.
But somehow whatever I try it keeps counting from right to left and if I pick random attributes it does exactly the same as the lisp I got, it just puts it in order of the handle code.
So I'll check if there is any difference when I activated the full version of Altext...
Edit:
I just checked the same thing with clicking them one by one from left to right and again if I do that it puts them in the right order from 0001 to 0005...
I dont know could it be a thing in autocad 2014, I cant check that cause we only have LT with lower versions of acad...
Kind regards!
Altext works fine now!
I was blind and forgot to put the sort selection to left-right/up-down...
Thanks to 3wood for the program!