need help to how to set attribute value of specified bloc in specified layout?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
how to set attribute value of specified bloc in specified layout
block name= SSREVISION
attribute tag name of block1= 1_NO
new attribute value= 1
layout=name is layout 1 but is position 1 in layout list in autocad
note the block are joint in this message
i try but autocad write this message Command: REVUP
; error: bad argument type: VLA-OBJECT nil
i dont understand all i try and i search... can someone could help?
i tried this:
;; Set Attribute Value - Lee Mac
;; Sets the value of the first attribute with the given tag found within the block, if present.
;; blk - [vla] VLA Block Reference Object
;; tag - [str] Attribute TagString
;; val - [str] Attribute Value
;; Returns: [str] Attribute value if successful, else nil.
(defun LM:vl-setattributevalue ( blk tag val )
(setq tag (strcase tag))
(vl-some
'(lambda ( att )
(if (= tag (strcase (vla-get-tagstring att)))
(progn (vla-put-textstring att val) val)
)
)
(vlax-invoke blk 'getattributes)
)
)
(defun setAttrib ( blkname att val / ss vla-obj)
(setq ss (ssget "X" (list (cons 2 blkname)(cons 0 "INSERT")(cons 410 (getvar 'ctab)))))
(LM:vl-setattributevalue vla-obj att val)
)
(defun c:REVUP ()
(setAttrib "SSREVISION" "1_NO" "1")
)
thank you very much