Author Topic: Strip block of Dynamic Properties  (Read 37168 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Strip block of Dynamic Properties
« on: March 23, 2010, 01:07:55 PM »
Does any one have a lisp that will strip the dynamic properties from dynamic blocks?

I have an extensive DB library which I use quite heavily throughout my drawings, some payed for, others spent serious time on developing.
I starting freelance drafting about a year ago and would like to protect my investment in the DB's, both in money as well as time and effort.
My DB collection helps me produce drawings quicker and more accurately then the clients can in house.  Which is why my clients come to me with the work.
I have released the dwg files with the DB's, in them to the clients and have notice they are starting to use them in their offices.
One client has drop my services altogether because he is able to work cheaper in house with my DB collection then before.
I would like to strip any DB from my drawings to prevent other's from following suit.
The only way I figure to protect my db now is to explode all blocks before transferring to the clients.
If anyone has a better way of protecting my investment, please feel free to express it.

Any help would be greatly appreciated.....

Thanks
Shade  :mrgreen:




 

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #1 on: March 23, 2010, 01:10:05 PM »
What version of AutoCAD? What happens if you do a "Save As" to the lowest version available, does that "lobotomize" the dynamic blocks?

edit: DOH, just saw your sig. Last question stands.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #2 on: March 23, 2010, 01:35:55 PM »
Okay, that doesn't work. I have 2008. Saved to r14 and re-opened -- the dynamic data round tripped ok.

Some lisp should be able to lobotomize it no prob tho.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Strip block of Dynamic Properties
« Reply #3 on: March 23, 2010, 01:39:26 PM »
Just an example:
Code: [Select]
(vla-ConvertToStaticBlock (vlax-ename->vla-object (car (entsel))) "NewName")
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #4 on: March 23, 2010, 01:42:29 PM »
yep
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Strip block of Dynamic Properties
« Reply #5 on: March 23, 2010, 01:46:29 PM »
Granted, if you select multiples of the same Dynamic block, it will error. However, you just convert the first one, then rename the remaining accordingly.
Code: [Select]
(vla-put-name x "NewName")
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #6 on: March 23, 2010, 02:13:21 PM »
Be careful, that strategy will introduce errors unless all instances of a given block share the same state.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #7 on: March 23, 2010, 02:31:35 PM »
Just an example:
Code: [Select]
(vla-ConvertToStaticBlock (vlax-ename->vla-object (car (entsel))) "NewName")

That's a new one for me thanks Alan  :-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Strip block of Dynamic Properties
« Reply #8 on: March 23, 2010, 02:36:05 PM »
Be careful, that strategy will introduce errors unless all instances of a given block share the same state.
Oh yeah, I wasn't thinking about that.

Just an example:
Code: [Select]
(vla-ConvertToStaticBlock (vlax-ename->vla-object (car (entsel))) "NewName")

That's a new one for me thanks Alan  :-)
:)  I remembered seeing it a while back when I wrote the routine that allows one to change the visibility states for multiple Dynamic blocks at once.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #9 on: March 26, 2010, 01:43:38 PM »
Friday quick & dirty freebie ... not the most efficient but free ...

Code: [Select]
(defun c:UnDynamic

    (   /
        _get_item
        _right
        _make_key
        _dynamic->static_block
        _get_locked
        _get_dynamic_inserts
        _main
    )

    (defun _get_item ( collection key / item )
        (vl-catch-all-apply
           '(lambda ( ) (setq item (vla-item collection key)))
        )
        item
    )

    (defun _right ( str n / len )
        (if (< n (setq len (strlen str)))
            (substr str (1+ (- len n)))
            str
        )
    )

    (defun _make_key ( collection prefix len / key )
        (   (lambda ( i pad )
                (while
                    (_get_item collection
                        (setq key
                            (strcat prefix
                                (_right
                                    (strcat pad (itoa (setq i (1+ i))))
                                    len
                                )
                            )
                        )
                    )
                )
                key
            )
            0
            (   (lambda ( pad )
                    (while (< (strlen pad) len)
                        (setq pad (strcat "0" pad))
                    )
                    pad
                )
                ""
            )
        )
    )

    (defun _dynamic->static_block ( blocks insert len )
        (vla-ConvertToStaticBlock
            insert
            (_make_key blocks "STATIC_" len)
        )
    )

    (defun _get_locked ( layers / locked )
        (vlax-for layer layers
            (if (eq :vlax-true (vla-get-lock layer))
                (setq locked (cons layer locked))
            )
        )
        locked
    )

    (defun _get_dynamic_inserts ( blocks / inserts )
        (vlax-for block blocks
            (vlax-for object block
                (if (eq "AcDbBlockReference" (vla-get-objectname object))
                    (if (eq :vlax-true (vla-get-isdynamicblock object))
                        (setq inserts (cons object inserts))
                    )
                )
            )
        )
        inserts
    )

    (defun _main ( document / blocks inserts locked len )
        (if
            (setq inserts
                (_get_dynamic_inserts
                    (setq blocks (vla-get-blocks document))
                )
            )
            (progn
                (foreach layer (setq locked (_get_locked (vla-get-layers document)))
                    (vla-put-lock layer :vlax-false)
                )
                (setq len (strlen (itoa (length inserts))))
                (foreach insert inserts
                    (_dynamic->static_block blocks insert len)
                )
                (foreach layer locked
                    (vla-put-lock layer :vlax-true)
                )
            )
        )
        (princ)
    )

    (_main (vla-get-activedocument (vlax-get-acad-object)))

)

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Strip block of Dynamic Properties
« Reply #10 on: March 26, 2010, 02:01:55 PM »
Friday quick & dirty freebie ... not the most efficient but free ...
Alan is right, you really are an artist. Nice work.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #11 on: March 26, 2010, 02:16:11 PM »
Friday quick & dirty freebie ... not the most efficient but free ...
Alan is right, you really are an artist. Nice work.

x2   :-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #12 on: March 26, 2010, 02:38:59 PM »
Tall praise given the source(s). Someday I will be worthy. Thanks guys.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

trogg

  • Bull Frog
  • Posts: 255
Re: Strip block of Dynamic Properties
« Reply #13 on: November 14, 2010, 10:22:32 PM »
In my CAD customization class, we were warned that after we saved our drawings with dynamic blocks, if we save them as a .dxf we would lose the dynamic block functions and any hyper-links.
just a thought from a newbie.
Although - I really like the code though too

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Strip block of Dynamic Properties
« Reply #14 on: November 15, 2010, 01:43:23 PM »
The .dxf method would work, but may introduce more errors too.....the code looks good too though.

mexxx_

  • Guest
Re: Strip block of Dynamic Properties
« Reply #15 on: March 19, 2013, 06:04:39 AM »
Hello,

I have now found that all lines in the block included. Characterized the block unnecessarily large and blows to the drawing.

mexxx_

  • Guest
Re: Strip block of Dynamic Properties
« Reply #16 on: March 27, 2013, 04:40:23 AM »
Hello,

I delete the invisible Objects with this Code. Can you integrate this Code in your Code please?

Code: [Select]
(defun c:delinvb (/ acdoc ss i sset nme Blockdefinition)
  (vl-load-com)
  (setq acdoc (vla-get-activedocument
                (vlax-get-acad-object)
              )
  )
  (if (setq ss (ssget "_:L" '((0 . "INSERT"))))
    (repeat
      (setq i (sslength ss))
      (setq sset (ssname ss (setq i (1- i))))
      (setq nme (cdr (assoc 2 (entget sset))))
      (setq Blockdefinition (vla-item (vla-get-blocks acdoc) nme))
      (if
        (and
          (eq :vlax-false (vla-get-isxref Blockdefinition))
          (eq :vlax-false (vla-get-islayout Blockdefinition))
        )
          (vlax-for x Blockdefinition
       (if(=(vla-get-Visible  x) :vlax-false)
        (vla-delete x)
    )
)
      )
    )
    (princ)
  )
  (vla-regen acdoc acAllViewports)
  (princ)
)

Thanks  :-)

cadpoobah

  • Newt
  • Posts: 48
Re: Strip block of Dynamic Properties
« Reply #17 on: December 11, 2013, 02:44:10 PM »
Friday quick & dirty freebie ... not the most efficient but free ...

That's a Fenomonal Friday Freebie, MP! :-)

I made a couple mods.

Mod 1 - I wanted to preserve the original block name and just add the numeric suffix to it, rather than renaming them to the generic "STATIC_#".
In the "_dynamic->static_block" function, I changed:
Code: [Select]
(_make_key blocks "STATIC_" len)was changed to
Code: [Select]
(_make_key blocks (strcat (vla-get-EffectiveName insert) "_") len)
Mod 2 - The function was bombing if the block it found was nested within an Xref.
Code: [Select]
(foreach insert inserts
  (_dynamic->static_block blocks insert len)
)
was changed to
Code: [Select]
(foreach insert inserts
  (if (null (wcmatch (vla-get-name insert) "*|*"))
    (_dynamic->static_block blocks insert len)
    )
)

Works great otherwise! Thanks!
« Last Edit: May 24, 2017, 03:04:28 PM by cadpoobah »
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com #dayjob
www.unpavedart.com    #sidehustle

bluepencil

  • Guest
Re: Strip block of Dynamic Properties
« Reply #18 on: November 10, 2015, 05:45:17 AM »
Hi!I was also looking for a way protect my "investment" in creating dynamic blocks... and I want to also find a way to strip the dynamic properties of the blocks when i pass the drawings to client and other people.  Then i stumbled upon this post...

I tried to make the code into an AUTOLISP and loaded it to my AutoCAD and it gave me this error:

Command: UNDYNAMIC
; error: no function definition: VLAX-GET-ACAD-OBJECT


I am using AutoCAD 2016 (Beta for Mac)... and i am not code-savvy... please can you help me what does it mean?  Or this error happened because I am using AutoCAD for Mac?

Thanks a lot!

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #19 on: November 10, 2015, 06:14:34 AM »
The error occurs because you have not issued the (vl-load-com) expression to define the set of ActiveX(COM) functions before attempting to evaluate such functions; however, since you are using AutoCAD for Mac, the ActiveX extensions will be unavailable in any case.

bluepencil

  • Guest
Re: Strip block of Dynamic Properties
« Reply #20 on: November 10, 2015, 06:23:02 AM »
Hi Lee Mac,

Are there any workaround for this in the MAC platform?

Thanks!

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #21 on: November 10, 2015, 06:53:24 AM »
Are there any workaround for this in the MAC platform?

No, ActiveX(COM) is a proprietary MS technology and so not available on a Mac platform; there are the new setpropertyvalue / getpropertyvalue / dumpallproperties functions, which are an attempt by Autodesk to bridge this shortfall, but these will not help in this particular case.

bluepencil

  • Guest
Re: Strip block of Dynamic Properties
« Reply #22 on: November 10, 2015, 07:20:55 AM »
Thanks again!

I guess this means exploding or ref-edit-in-place of dynamic blocks will be part of my workflow... haha.

Thanks!

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #23 on: November 10, 2015, 08:41:18 AM »
Or switch to Windows  :wink:

Richardb1208

  • Guest
Re: Strip block of Dynamic Properties
« Reply #24 on: February 24, 2016, 06:00:26 AM »
Hi All

These lisps are brilliant!! Has anyone created / found a lisp that will take the UNDYNAMIC in a slightly different direction?

I have 400 drawings that contain Dynamic blocks that use the visibility method. I need to lobotomize the blocks at a global level but ensure that the end product is the block renamed to include the visibility state convention. i.e. BlockName_VisibilityState.

Can anyone help?

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Strip block of Dynamic Properties
« Reply #25 on: February 24, 2016, 10:12:51 AM »
Hi All

These lisps are brilliant!! Has anyone created / found a lisp that will take the UNDYNAMIC in a slightly different direction?

I have 400 drawings that contain Dynamic blocks that use the visibility method. I need to lobotomize the blocks at a global level but ensure that the end product is the block renamed to include the visibility state convention. i.e. BlockName_VisibilityState.

Can anyone help?
Here you go .. welcome to TheSwamp :)  . be aware that the code does not checked for locked layers.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:staticblocks (/ name)
  2.     (vlax-for b2 b
  3.       (if (and (vlax-property-available-p b2 'isdynamicblock)
  4.           (minusp (vlax-get b2 'isdynamicblock))
  5.           (setq name (vl-some '(lambda (prop)
  6.                   (if (= "Visibility" (vla-get-propertyname prop))
  7.                (vlax-get prop 'value)
  8.                   )
  9.                 )
  10.                (vlax-invoke b2 'getdynamicblockproperties)
  11.            )
  12.           )
  13.      )
  14.    (if (tblobjname "block" (setq name (strcat (vla-get-effectivename b2) "_" name)))
  15.      (vla-put-name b2 name)
  16.      (vla-converttostaticblock b2 name)
  17.    )
  18.       )
  19.     )
  20.   )
  21.   (princ)
  22. )
  23.  

*Also if your dynamic blocks have other properties that can change under the visibility state, the renamed block will take on the properties of the first found.
« Last Edit: February 24, 2016, 02:18:31 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #26 on: February 24, 2016, 01:23:36 PM »
Nice one Ron - though, unfortunately I don't believe that you can rely on the Property Name of the Visibility State parameter being named "Visibility", since any dynamic block parameter may be arbitrarily named.

Therefore, as an extension of your code, I would propose:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:staticblocks ( / bln lst vis )
  2.         (vlax-for obj blk
  3.             (if (and (= "AcDbBlockReference" (vla-get-objectname obj))
  4.                      (vlax-property-available-p obj 'isdynamicblock)
  5.                      (= :vlax-true (vla-get-isdynamicblock obj))
  6.                      (or (setq bln (vla-get-effectivename  obj)
  7.                                vis (cdr (assoc bln lst))
  8.                          )
  9.                          (and (setq vis (LM:getvisibilityparametername obj))
  10.                               (setq lst (cons (cons bln vis) lst))
  11.                          )
  12.                      )
  13.                      (setq vis (LM:getdynpropvalue obj vis))
  14.                 )
  15.                 (if (tblsearch "block" (setq bln (strcat bln "_" vis)))
  16.                     (vla-put-name obj bln)
  17.                     (vla-converttostaticblock obj bln)
  18.                 )
  19.             )
  20.         )
  21.     )
  22.     (princ)
  23. )
  24.  
  25. ;; Get Dynamic Block Property Value  -  Lee Mac
  26. ;; Returns the value of a Dynamic Block property (if present)
  27. ;; blk - [vla] VLA Dynamic Block Reference object
  28. ;; prp - [str] Dynamic Block property name (case-insensitive)
  29.  
  30. (defun LM:getdynpropvalue ( blk prp )
  31.     (setq prp (strcase prp))
  32.     (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
  33.         (vlax-invoke blk 'getdynamicblockproperties)
  34.     )
  35. )
  36.  
  37. ;; Get Visibility Parameter Name  -  Lee Mac
  38. ;; Returns the name of the Visibility Parameter of a Dynamic Block (if present)
  39. ;; blk - [vla] VLA Dynamic Block Reference object
  40. ;; Returns: [str] Name of Visibility Parameter, else nil
  41.  
  42. (defun LM:getvisibilityparametername ( blk / vis )  
  43.     (if
  44.         (and
  45.             (vlax-property-available-p blk 'effectivename)
  46.             (setq blk
  47.                 (vla-item
  48.                     (vla-get-blocks (vla-get-document blk))
  49.                     (vla-get-effectivename blk)
  50.                 )
  51.             )
  52.             (= :vlax-true (vla-get-isdynamicblock blk))
  53.             (= :vlax-true (vla-get-hasextensiondictionary blk))
  54.             (setq vis
  55.                 (vl-some
  56.                    '(lambda ( pair )
  57.                         (if
  58.                             (and
  59.                                 (= 360 (car pair))
  60.                                 (= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair)))))
  61.                             )
  62.                             (cdr pair)
  63.                         )
  64.                     )
  65.                     (dictsearch
  66.                         (vlax-vla-object->ename (vla-getextensiondictionary blk))
  67.                         "ACAD_ENHANCEDBLOCK"
  68.                     )
  69.                 )
  70.             )
  71.         )
  72.         (cdr (assoc 301 (entget vis)))
  73.     )
  74. )
  75.  

Dynamic Block functions from here.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Strip block of Dynamic Properties
« Reply #27 on: February 24, 2016, 01:39:17 PM »
Maybe the following to account for other dynamic block parameters and for locked layers?

Code - Auto/Visual Lisp: [Select]
  1. (defun c:staticblocks ( / doc eff lck lst nbn new obn vis vpl )
  2.           new
  3.         (lambda ( old vis / cnt rtn )
  4.             (setq cnt 0)
  5.             (if (tblsearch "block" (setq rtn (strcat old "_" vis)))
  6.                 (while (tblsearch "block" (setq rtn (strcat old "_" vis "_" (itoa (setq cnt (1+ cnt)))))))
  7.             )
  8.             rtn
  9.         )
  10.     )
  11.     (vlax-for lay (vla-get-layers doc)
  12.         (if (= :vlax-true (vla-get-lock lay))
  13.             (progn
  14.                 (setq lck (cons lay lck))
  15.                 (vla-put-lock lay :vlax-false)
  16.             )
  17.         )
  18.     )
  19.     (vlax-for blk (vla-get-blocks doc)
  20.         (vlax-for obj blk
  21.             (cond
  22.                 (   (not
  23.                         (and
  24.                             (= "AcDbBlockReference" (vla-get-objectname obj))
  25.                             (vlax-property-available-p obj 'isdynamicblock)
  26.                             (= :vlax-true (vla-get-isdynamicblock obj))
  27.                         )
  28.                     )
  29.                 )
  30.                 (   (setq obn (vla-get-name obj)
  31.                           nbn (cdr (assoc obn lst))
  32.                     )
  33.                     (vla-put-name obj nbn)                        
  34.                 )
  35.                 (   (and
  36.                         (or (setq eff (vla-get-effectivename obj)
  37.                                   vis (cdr (assoc eff vpl))
  38.                             )
  39.                             (and (setq vis (LM:getvisibilityparametername obj))
  40.                                  (setq vpl (cons (cons eff vis) vpl))
  41.                             )
  42.                         )
  43.                         (setq vis (LM:getdynpropvalue obj vis))
  44.                         (setq nbn (new eff vis))
  45.                     )
  46.                     (vla-converttostaticblock obj nbn)
  47.                     (setq lst (cons (cons obn nbn) lst))
  48.                 )
  49.             )
  50.         )
  51.     )
  52.     (foreach lay lck (vla-put-lock lay :vlax-true))
  53.     (princ)
  54. )
  55.  
  56. ;; Get Dynamic Block Property Value  -  Lee Mac
  57. ;; Returns the value of a Dynamic Block property (if present)
  58. ;; blk - [vla] VLA Dynamic Block Reference object
  59. ;; prp - [str] Dynamic Block property name (case-insensitive)
  60.  
  61. (defun LM:getdynpropvalue ( blk prp )
  62.     (setq prp (strcase prp))
  63.     (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
  64.         (vlax-invoke blk 'getdynamicblockproperties)
  65.     )
  66. )
  67.  
  68. ;; Get Visibility Parameter Name  -  Lee Mac
  69. ;; Returns the name of the Visibility Parameter of a Dynamic Block (if present)
  70. ;; blk - [vla] VLA Dynamic Block Reference object
  71. ;; Returns: [str] Name of Visibility Parameter, else nil
  72.  
  73. (defun LM:getvisibilityparametername ( blk / vis )  
  74.     (if
  75.         (and
  76.             (vlax-property-available-p blk 'effectivename)
  77.             (setq blk
  78.                 (vla-item
  79.                     (vla-get-blocks (vla-get-document blk))
  80.                     (vla-get-effectivename blk)
  81.                 )
  82.             )
  83.             (= :vlax-true (vla-get-isdynamicblock blk))
  84.             (= :vlax-true (vla-get-hasextensiondictionary blk))
  85.             (setq vis
  86.                 (vl-some
  87.                    '(lambda ( pair )
  88.                         (if
  89.                             (and
  90.                                 (= 360 (car pair))
  91.                                 (= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair)))))
  92.                             )
  93.                             (cdr pair)
  94.                         )
  95.                     )
  96.                     (dictsearch
  97.                         (vlax-vla-object->ename (vla-getextensiondictionary blk))
  98.                         "ACAD_ENHANCEDBLOCK"
  99.                     )
  100.                 )
  101.             )
  102.         )
  103.         (cdr (assoc 301 (entget vis)))
  104.     )
  105. )
  106.  

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Strip block of Dynamic Properties
« Reply #28 on: February 24, 2016, 02:19:17 PM »
Nice one Ron - though, unfortunately I don't believe that you can rely on the Property Name of the Visibility State parameter being named "Visibility", since any dynamic block parameter may be arbitrarily named.

Dynamic Block functions from here.
Ah yes .. silly me  :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Strip block of Dynamic Properties
« Reply #29 on: March 01, 2016, 07:26:12 AM »
Quote from: MP
Friday quick & dirty freebie ... not the most efficient but free ...
...and then 6 years later, stolen and presented without credit. 

https://lispbox.wordpress.com/2016/02/29/undinamic-all-blocks-in-one-click/


MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #30 on: March 01, 2016, 02:29:32 PM »
Happens tons (here and out there), one of many reasons why I basically stopped posting code.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Strip block of Dynamic Properties
« Reply #31 on: March 01, 2016, 02:34:42 PM »
Happens tons (here and out there), one of many reasons why I basically stopped posting code.

Some of the blog posts at that particular site refer to another URL**, but many are flat out stealing since they are posted under the guise of being original.

** Re-posting code can be excused in special cases, but most of the time a person should just link to the original source.
The owner of this particular "blog" is doing nothing more than copying and pasting work from others.


MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #32 on: March 01, 2016, 02:45:24 PM »
The shameless repackaging that frequently goes on at the swamp is far more bothersome than the activities of those "out there". That said, the author of that site is a complete <pick derogatory word>.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Strip block of Dynamic Properties
« Reply #33 on: March 01, 2016, 02:54:25 PM »
Quote from: MP
That said, the author of that site is a complete <pick derogatory word>.

I should state that we are both using the word "author" loosely.

Oh, and he is a member here at the Swamp too.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Strip block of Dynamic Properties
« Reply #34 on: March 01, 2016, 02:58:24 PM »
Quote from: MP
Friday quick & dirty freebie ... not the most efficient but free ...
...and then 6 years later, stolen and presented without credit. 

https://lispbox.wordpress.com/2016/02/29/undinamic-all-blocks-in-one-click/
have dynamic blocks really been around 6 years?  (where does time go?)
Be your Best


Michael Farrell
http://primeservicesglobal.com/

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Strip block of Dynamic Properties
« Reply #35 on: March 01, 2016, 03:14:42 PM »
Quote from: mjfarrell
have dynamic blocks really been around 6 years?

Almost 11 years actually.

http://lynn.blogs.com/lynn_allens_blog/files/autocad_2006_tips_and_tricks_booklet.pdf



AIberto

  • Guest
Re: Strip block of Dynamic Properties
« Reply #36 on: April 19, 2016, 01:38:50 AM »
Friday quick & dirty freebie ... not the most efficient but free ...

Code: [Select]
(defun c:UnDynamic

)

Dear MP

It will change all dynamic blocks to normal blocks. I only need change selected blocks(not all)  to normal blocks . Where need modify ?

Thanks a lot.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Strip block of Dynamic Properties
« Reply #37 on: April 19, 2016, 11:09:43 AM »
Please see post #4.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

FrankenClyde

  • Guest
Re: Strip block of Dynamic Properties
« Reply #38 on: January 26, 2017, 12:11:34 PM »
ACK!

Dynamic Blocks are one of my favorite things, since I got a legitimate copy of v2006.
I use them extensively, but this morning I was told to cease, under threat of dismissal (out of the blue). Seems Production does not like them (Architectural Millwork, with CNC routers).
So, I found this site, via a web search, and direction from Cad-Notes
http://www.cad-notes.com/how-to-convert-dynamic-block-to-regular-block/

I copied the code in post #9, to great success, in a test drawing. I copied several (20+) visibility, rotation, flip, etc. versions of one block out to a blank drawing, and the code ran instantaneously, naming the new ones STATIC_01, STATIC_02, etc..
Then I copied 5-6 more into the new file, and tried it again. Not so good - the program hung for several minutes, until I hit esc. A few of the new ones had been converted, as STATIC_1, STATIC_2, etc. (without the "0#). I gather this is a once-and-only-once thing to do.

Then I signed up for The Swamp as a newb. That's when I saw there were a full three pages of posts, and several more versions of code for this converting DB's to regular blocks, including some renaming enhancements.

My main exposure to .lsp is using the defun:c in my extensive acaddoc.lsp file, with souped-up .pgp combined commands, like "n" for "move" "previous" ("mp" is for match properties). I know nothing of all the other functions of lisp or v-lisp.

My reason for posting is that I am confused with the subsequent posts, and which one to go with. I like the bit from post #17, then there's #25-27, with different code altogether.

Which should I use??

iku

  • Guest
Re: Strip block of Dynamic Properties
« Reply #39 on: September 29, 2017, 06:24:08 AM »
Hello.

During my search on the web I found the nice script that was posted here (reply #9) and I gave it a shot. It works just fine for my needs except that my blocks have annotative scales and that information gets lost. I'm not very fluent with lisp but am I correct assuming that there aren't any parameters one can pass to ConvertToStaticBlock method except new block name? I couldn't find confirmation, but static blocks don't support anno scales? So I need a new approach altogether instead of ConvertToStaticBlock?

Could someone help me with this please? :)