Block with Attribute value = field = concatenated values of parameters
Dear All,
Is there any way (without any Lisp code) to get the value of an attribute as a concatenated value of 2 parameters (strings of characters).
Here you will find enclosed a block file I wish to modify. It contains 2 parameters made a designtable (dropdown list). I wish I could get the value of Attribute ATT3 = PARAM1.value&"-"&PARAM2.value.
Thank you for your feedback
BR
Comments
-
Here is the file
0 -
You can simply insert parameters as fields in the attribute value, but the parameters should be numbers not text. Text will not work.
0 -
This is add two atts and put in third example.
; add 2 attributes and put the value as a field into the 3rd attribute.
; BY AlanH(defun c:test ( / obj lst x )
(setq oldatt (getvar 'attdia))
(setvar 'attdia 0)
(command "-insert" "c" (getpoint "\npick point") 1 1 0 (getstring "\nEnter Att1 ") (getstring "\nEnter Att2 ") (getstring "\nEnter Att3 ") "-")
(setq obj (vlax-ename->vla-object (entlast)))
(setq lst '())
(foreach att (vlax-invoke obj 'getattributes)
(princ "\n")
(setq lst (cons (strcat "%<\AcObjProp Object(%<\_ObjId "
(vlax-invoke-method (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))) 'GetObjectIdString att :vlax-false)
">%).Textstring>%"
) lst ))
)
(setq str nil)
(setq x (length lst))
(setq str (strcat "%<\AcExpr "
(nth (setq x (- x 1)) lst) " + "
(nth (setq x (- x 1)) lst) " + "
(nth (setq x (- x 1)) lst) ">%"
)
)
(setq x 1 y 4)
(foreach att(vlax-invoke obj 'getattributes)
(if (= x y)
(Vla-put-textstring att str)
)
(setq x (+ x 1))
)
(setvar 'attdia oldatt)
(princ)
)
(c:test)0
