Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody.
I'm wanting a "basic thing" but I can't implement it in my code.
I need to get a specific value of an attribute in a specific block and then use it in the lisp.
It would be the value 11 of the BlkLocal block.
First I did a function in my lisp to get the value:
(defun get-attrib-value (blk-name tag)
(vlax-for blk (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (and (= (vla-get-ObjectName blk) "AcDbBlockReference") (= (vla-get-Name blk) blk-name))
(vlax-for attdef blk
(if (= (vla-get-TagString attdef) tag)
(return (vla-get-TextString attdef))
)
)
)
)
""
)
Then I used:
(setq VarX (get-attrib-value "BlkLocal" "11"))
but it returns empty.
I tried to understand a code found at:
however it scans and displays all.
Do you have an easy method to fix this VarX that shows empty even though it's not empty?
Solved! Go to Solution.