Extract a value from a Dynamic block using simple Autolisp code rather than Visual Lisp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I see that there are a lot of posts for extracting values or properties from a dynamic block, however, all the code I have seen so far is Visual Lisp. Wondering if it is possible to extract a value from a dynamic block using just simple Autolisp functions. The reason is that I would like to re-jig some useful code that extracts attrributes to build a sensible PDF filename when plotting drawings but it can't be VL code as I want to run it as a script using AutoCAD Core Console. My understanding is that Core Console does not accept VL code....at least, there are no VL commands in the commands list for Core Console.
I would appreciate any advice. Just not sure that it is actually possible.
The code I am trying to replicate is...
;;now get status from separate dynamic block ONLY IF IT EXISTS
(if (/= "" XDYNBLNAME )
(progn
(setq BName XDYNBLNAME)
(setq VLAOBJ (vlax-ename->vla-object (SDynBe Bname)))
(LM:getdynprops VLAOBJ)
(setq XSTATUS XDYNSTATUSNAME)
(setq VSTATUS (LM:getdynpropvalue VLAOBJ XDYNSTATUSNAME))
);p
()
);f
(if (= VSTATUS "FOR TENDER / CONSTRUCTION")
(setq VSTATUS "FOR TENDER AND CONSTRUCTION")
()
)
also some Lee Mac functions..
(defun LM:getdynprops ( blk )
(mapcar '(lambda ( x ) (cons (vla-get-propertyname x) (vlax-get x 'value)))
(vlax-invoke blk 'getdynamicblockproperties)
)
)
(defun LM:getdynpropvalue ( blk prp )
(setq prp (strcase prp))
(vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
(vlax-invoke blk 'getdynamicblockproperties)
)
)
Many thanks in advance,
Peter T