Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

Lee,

thank you very much for your prompt reply, as always.

I appreciate your great helps:D

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...