Ahankhah Posted December 29, 2014 Posted December 29, 2014 Hi all, is there a way to get informations from dbx opened drawing to find out that the drawing is indeed just a dynamic block? It is for filtering those drawings stoped by alert box anouncing one of the following messages: [Drawing name] contains authoring elements. open in Block Editor? or [Drawing name] contains authoring elements which cannot be edited. open drawing anyway? I appreciate any help Quote
Lee Mac Posted December 29, 2014 Posted December 29, 2014 Try the following: ;; Dynamic Block File-p - Lee Mac ;; Returns T if the supplied drawing file is a dynamic block ;; dwg - [str] Drawing filename (defun LM:dynamicblockfile-p ( dwg / doc lst rtn ) (setq rtn (and (setq dwg (findfile dwg)) (or (setq doc (cdr (assoc (strcase dwg) (vlax-for doc (vla-get-documents (vlax-get-acad-object)) (setq lst (cons (cons (strcase (vla-get-fullname doc)) doc) lst)) ) ) ) ) (and (setq doc (vla-getinterfaceobject (vlax-get-acad-object) (if (< (atoi (getvar 'acadver)) 16) "objectdbx.axdbdocument" (strcat "objectdbx.axdbdocument." (itoa (atoi (getvar 'acadver)))) ) ) ) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-open (list doc dwg)))) ) ) (= :vlax-true (vla-get-isdynamicblock (vla-get-modelspace doc))) ) ) (if (= 'vla-object (type doc)) (vlax-release-object doc) ) rtn ) The above could (and should) be optimised if you intend to call the function from within a loop. Quote
Ahankhah Posted December 29, 2014 Author Posted December 29, 2014 Lee, thank you very much for your prompt reply, as always. I appreciate your great helps:D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.