Hi All
I have this ductwork block, with 3 attributes within it... I also use this lsp routine to quickly change the height of the attribute text (if required)...
now when I use this lisp routine on this particular ductwork block (visibility state - Flat oval ductwork... only one of the 3 attributes changes height... when I would like all 3 to change... can anyone explain why only one is changing... I've attached the block dwg and also attached the lisp routine...
The lisp routine works perfectly on all the other blocks I use - its just this one it doesn't work on.
Many Thanks in advance ๐
(defun c:AttHeight ( / s a i)
(if (and (setq s (ssget '((0 . "INSERT") (66 . 1))))
(setq a (getreal "\nSpecify height: "))
)
(repeat (setq i (sslength s))
(setpropertyvalue (entnext (ssname s (setq i (1- i)))) "Height" a)))
(princ)
)
Solved! Go to Solution.
Solved by ะeekeeCZ. Go to Solution.
Solved by Sea-Haven. Go to Solution.
Please post your code rather than attach it.
You call a function called setpropertyvalue, but you haven't shown us the code. Does this properly get the attribute collection? We don't know. Post all the code.
Don't ask me how the lisp routines works, I'm not that clued up on it... it just works perfectly on all the other blocks i use with multiple attributes....
It's somebody else's (possibly lee mac) lisp routine.
but here's is the whole code of the lisp routine
(defun c:AttHeight ( / s a i)
(if (and (setq s (ssget '((0 . "INSERT") (66 . 1))))
(setq a (getreal "\nSpecify height: "))
)
(repeat (setq i (sslength s))
(setpropertyvalue (entnext (ssname s (setq i (1- i)))) "Height" a)))
(princ)
)
*Post your code in a code window.
the only atrribute within the duct block... is the AP changes sizes... the other 2.. FD and VCD stay the same....
I've matched properties with AP to get them the same.. I've also tried re-creating the attributes... but nothing seems to work.
Sorry, I forgot that setpropertyvalue is a standard lisp function. I don't use lisp very often any more. This may be a problem with the fact that once you modify a dynamic block, it creates an anonymous version of the standard block. Does this lisp routine work on other dynamic blocks?
Thanks Ed...
Yeah this lisp works all fine perfectly on all other dynamic blocks with single and multiple attributes...
its just this block is being a little nuisance... ๐
I'm not up to date with lisp (zero knowledge), but I've tried it on a couple of my own blocks, and I even created a block with two attributes in to check it and all times it just changed the first attribute, so it's not looping through the attributes in the block.
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Another method, 3 changed.
(defun c:AttHeight ( / ht obj atts)
(setq ht (getreal "\nSpecify height: "))
(setq obj (vlax-ename->vla-object (car (entsel "Pick block "))))
(setq atts (vlax-invoke obj 'Getattributes))
(repeat (setq x (length atts))
(vlax-put (nth (setq x (1- x)) atts) 'height ht)
)
(princ)
)
Thank you all for taking the time to reply, really appreciate it! ๐
The original version adjusted to go thru all the attributes.
(defun c:AttHeight ( / s a i e) (if (and (setq s (ssget '((0 . "INSERT") (66 . 1)))) (setq a (getreal "\nSpecify height: ")) ) (repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i)))) (while (and (setq e (entnext e)) (= "Attribute" (getpropertyvalue e "LocalizedName"))) (setpropertyvalue e "Height" a)))) (princ) )
Can swap
(setq ht (getreal "\nSpecify height: "))
(setq obj (vlax-ename->vla-object (car (entsel "Pick block "))))
(setq obj (vlax-ename->vla-object (car (entsel "Pick block "))))
(setq ht (getreal "\nSpecify height: "))
Can't find what you're looking for? Ask the community or share your knowledge.