Author Topic: File of Dynamic Block  (Read 3085 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
File of Dynamic Block
« on: March 07, 2017, 09:30:04 AM »
Hi all,..

I'm trying to find a way to detect if a dwg is a dynamic block.
I'm using ObjectDBX but I'm not able to get any information about this.

if someone can point me to any direction or suggestion it will be very appreciated.
Thank you. :)
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7526
Re: File of Dynamic Block
« Reply #1 on: March 07, 2017, 09:42:12 AM »
Hint: "AcDbBlockRepETag"

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Re: File of Dynamic Block
« Reply #2 on: March 07, 2017, 09:56:11 AM »
Hint: "AcDbBlockRepETag"

Thank you,....Ron.
but the block is not part of the drawing.....is the drawing itself.
I'll make few tests...:)
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7526
Re: File of Dynamic Block
« Reply #3 on: March 07, 2017, 10:03:21 AM »
In AutoCAD 2017 this works for me:
Code - Auto/Visual Lisp: [Select]
  1. (defun _isdynamic (doc) (minusp (vlax-get (vla-get-modelspace doc) 'isdynamicblock)))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Re: File of Dynamic Block
« Reply #4 on: March 07, 2017, 10:19:57 AM »
In AutoCAD 2017 this works for me:
Code - Auto/Visual Lisp: [Select]
  1. (defun _isdynamic (doc) (minusp (vlax-get (vla-get-modelspace doc) 'isdynamicblock)))

wow nice...I was searching on HasExtensionDictionary...
Than kyou very much run.
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7526
Re: File of Dynamic Block
« Reply #5 on: March 07, 2017, 11:08:33 AM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: File of Dynamic Block
« Reply #6 on: March 07, 2017, 12:24:24 PM »
I had this in my library:
Code - Auto/Visual Lisp: [Select]
  1. (defun _dynamicblockfile-p ( dwg / doc lst rtn )
  2.     (setq rtn
  3.         (and (setq dwg (findfile dwg))
  4.             (or
  5.                 (setq doc
  6.                     (cdr
  7.                         (assoc (strcase dwg)
  8.                             (vlax-for doc (vla-get-documents (vlax-get-acad-object))
  9.                                 (setq lst (cons (cons (strcase (vla-get-fullname doc)) doc) lst))
  10.                             )
  11.                         )
  12.                     )
  13.                 )
  14.                 (and
  15.                     (setq doc
  16.                         (vla-getinterfaceobject (vlax-get-acad-object)
  17.                             (if (< (atoi (getvar 'acadver)) 16)
  18.                                 "ObjectDBX.AxDbDocument"
  19.                                 (strcat "ObjectDBX.AxDbDocument." (itoa (atoi (getvar 'acadver))))
  20.                             )
  21.                         )
  22.                     )
  23.                     (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-open (list doc dwg))))
  24.                 )
  25.             )
  26.             (= :vlax-true (vla-get-isdynamicblock (vla-get-modelspace doc)))
  27.         )
  28.     )
  29.     (if (= 'vla-object (type doc))
  30.         (vlax-release-object doc)
  31.     )
  32.     rtn
  33. )

Andrea

  • Water Moccasin
  • Posts: 2372
Re: File of Dynamic Block
« Reply #7 on: March 07, 2017, 01:39:26 PM »
Thank you Lee,..
i've made a lisp with Both codes of you.. :)

Code: [Select]
(setq saa (dbx_openfile
            (setq fulldwg (vl-string-translate "/" "\\" (strcat _fold "\\" _dwgna)))
          )
)
(if (and (_isdynamic saa)
         (setq prp (lm:getvisibilityparametername vlabbl))
    )
  (setq bbldynlist (lm:getdynpropallowedvalues vlabbl prp))
)

the program create a list of all blocks in a folder and create a TREE list in a dialog made with ObjectDCL
showing all sub visibility option.  :)

Thank you Guys.

Keep smile...

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: File of Dynamic Block
« Reply #8 on: March 07, 2017, 01:53:21 PM »
You're welcome Andrea, I look forward to seeing the final result  :-)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: File of Dynamic Block
« Reply #9 on: March 07, 2017, 05:46:35 PM »
You're welcome Andrea, I look forward to seeing the final result  :-)

not final,..but seem to work :)
the second section (rose list) contain the visibility value
Keep smile...

bilançikur

  • Newt
  • Posts: 82
Re: File of Dynamic Block
« Reply #10 on: March 08, 2017, 01:48:41 AM »
Hi Andrea,

Cool program! ObjectDCL still is a great tool.
Not trying to hijack this topic but your question got me thinking...

I have a question, maybe you can help?

I have a folder containing about 250 dwg's.
These are all blocks... not dwg's with blocks in it but eacht dwg is 1 block itself.
Some (most) of the dwg's/blocks have dynamic properties.

Dynamic blocks created in AutoCAD are a pain in the #$$ when using them in ZWCAD.
And we use nearly 90% ZWCAD so there is the problem...

So I decided it would be better to have these dwg's stripped from dynamic properties.
But I resist on opening them all one by one...

Any idea how to "batch-excecute" this on the entire folder?
Thanks and have a nice day!

Andrea

  • Water Moccasin
  • Posts: 2372
Re: File of Dynamic Block
« Reply #11 on: March 08, 2017, 08:32:34 AM »
HERE

 :whistling:

seriously,..I don't know how to do this...
but I think 250 drawing is not a big deal..
maybe by making it with a simple script file...?
« Last Edit: March 08, 2017, 08:36:07 AM by Andrea »
Keep smile...

bilançikur

  • Newt
  • Posts: 82
Re: File of Dynamic Block
« Reply #12 on: March 09, 2017, 09:25:06 AM »
Andrea,

I am amazed that you find my post from years ago with the same question of wich I had completely forgotten. Maybe I was sleepwalking that day... because I had also not responded to Irneb. That is not my style, I like to thank people that help me out. But in this case I guess I have not seen the reply at all and the post was forgotten....

Maybe a script, yes I may look into that.

Thanks,
Me!