
Registered forum members do not see this ad.
Hello,
i have a lisp routine incatt.lsp dat increase a attribute. It does only numbers like:
1, 2, 3 etc etc.
Is it possible to change the lisp that it changes/increment(attributes) numbers like: 4.32, 4.33, 4.34 etc So with numbers with a . or , or - and with steps .01?
Thanks

Can you help me?
Thanks
Pmxcad
But of course i'll help. listen pmxcad, the way the code is written, the existing value of the attribute doesn't come into play at any way. so whats the deal with "," and "-" ? Will those be the supplied value at prompt? or the resulting incremented value for the attribute entity. if the former, we cant use getreal nor getint for it would not accept those symbols.
if the latter, i suppose we can reverse the sequence by asking to select an attribute first then use the pattern of the existing string to determine the proper prompt (getint/getreal)
Bottom line: How would you prompt for value? or is it numbers after "," and "-" symbols?
Show us an example dude.
Last edited by pBe; 6th Oct 2012 at 04:34 am.




Just change a couple of lines in code and add increment step this can be just press enter for 1
Code:(getreal (Strcat "\nSpecify Starting Number and (setq inc (getreal "\nSpecify increment ")) (setq *num* (+ inc *num*))
A man who never made mistakes never made anything

Hello PBE,
the numbers could be: 1.25, 1.26, 1.27 or 1-25, 1-26, 1-27 etc etc
see example.
PmxCAD
Quick mod [untested]
HTHCode:(defun c:incatt ( / tag pre ss1 ) (vl-load-com) (defun determine (str) (list (setq pre (vl-string-right-trim "0123456789" str)) (atoi (substr str (1+(strlen pre)))))) (setq tag "E_TEXT1") (if (setq *num* (cond ( (getint (strcat "\nSpecify Starting Number" (if *num* (strcat " <" (itoa *num*) "> : ") ": ")))) ( *num* ))) (while (setq ss1 (ssget "_+.:E:S:L" '((0 . "INSERT") (66 . 1)))) (if (vl-some (function (lambda ( x ) (if (eq tag (vla-get-tagstring x)) (not (vla-put-textstring x (strcat (car (setq p (determine (vla-get-textstring x)))) (strcat (if (and (< 0 (cadr p) 9) (not (eq (car p) ""))) "0" "") (itoa (+ (cadr p) *num*)))))) ) ) ) (vlax-invoke (vlax-ename->vla-object (ssname ss1 0)) 'getattributes) ) (princ (strcat tag " Attribute not found.")) ) ) ) (princ) )

Thanks for the replay, but sorry PBE, its not working correct.
When i give a starting number like 1.25, Autocad returns "Requires an integer value".
And when give a number like "1" it gives all the blocks selected, the number "1" and it doesnt count.
PmxCAD
Registered forum members do not see this ad.
That is what i wanted to know from the get-go. Tell me. is the existing string on the attribute relevant to the input value?
The modified code increments the "existing value". thats the way i saw it from you attached example.
Are you telling me that there are times that you would input "1-25" or "1,25"?
Are you sure about this? it should work on your "test.dwg"
It's getting pretty late here pmxcad. we'll "increment" tomorrow![]()
Last edited by pBe; 6th Oct 2012 at 05:44 pm.
Bookmarks