Author Topic: Redefining a block in multiple files via OBJECTDBX Wrapper  (Read 2593 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Redefining a block in multiple files via OBJECTDBX Wrapper
« on: April 11, 2015, 09:07:16 AM »
Lee ad awhile ago showed me an awesome way to do some layer management stuff via this.

http://www.theswamp.org/index.php?topic=47376.msg524151#msg524151

I was wondering using his same setup how to change it to redefine 1 block name in mulitple dwgs.

Thanks!
Civil3D 2020

ttray33y

  • Mosquito
  • Posts: 1
Re: Redefining a block in multiple files via OBJECTDBX Wrapper
« Reply #1 on: June 14, 2015, 11:26:33 PM »
in my own understanding. ObjectDBX wrapper cannot do that.

Code: [Select]
http://lee-mac.com/odbxbase.html

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Redefining a block in multiple files via OBJECTDBX Wrapper
« Reply #2 on: June 15, 2015, 04:10:10 AM »
You could try the following (untested!):
Code - Auto/Visual Lisp: [Select]
  1. (defun c:batchredef ( / blk dwg )
  2.     (while
  3.         (not
  4.             (or
  5.                 (= "" (setq blk (getstring t "\nSpecify block name to redefine: ")))
  6.                 (setq dwg (findfile (strcat blk ".dwg")))
  7.             )
  8.         )
  9.         (princ (strcat "\nFile \"" blk ".dwg\" not found."))
  10.     )
  11.     (if dwg
  12.         (LM:odbx
  13.             (function
  14.                 (lambda ( doc )
  15.                     (if
  16.                         (not
  17.                             (vl-catch-all-error-p
  18.                                 (vl-catch-all-apply 'vla-item  (list (vla-get-blocks doc) blk))
  19.                             )
  20.                         )
  21.                         (vla-delete
  22.                             (vla-insertblock
  23.                                 (vla-get-modelspace doc)
  24.                                 (vlax-3D-point 0 0) dwg 1.0 1.0 1.0 0.0
  25.                             )
  26.                         )
  27.                     )
  28.                 )
  29.             )
  30.             nil t
  31.         )
  32.     )
  33.     (princ)
  34. )

EDIT: On testing the above, this method does not appear to be successful.
« Last Edit: June 15, 2015, 04:59:16 AM by Lee Mac »