Does anyone know if it might be possible to programmatically insert a block from another DWG file?
I am using a lot of dynamic blocks and also creating toolpalettes using Design Center so it is easiest to create a single file with all the blocks in a single file. I have one DWG file "library" for each tab of my toolpalette.
The problem is that occasionally I need to insert a block from my "library" programmatically (using LISP) and I have no way to access it. I might just add here that all this would not be necessary if Autodesk would add a feature to toolpalettes that run a command or macro before and/or after insertion is completed. That would sure save me a lot of reactor programming and other needless complications.
It's possible using ObjectDBX, but in my way, y'd rather wblock your blocks in one folder per library and add the path of each foder in acad support path, all your blocks should be available from each drawing.
Here is another note for Autodesk while I'm thinking of it. I would LOVE to just right-click on a drawing in Design Center and select "Create Tool palette" but I find that there are so many tweeks "(usually ...auxiliary scale, prompt for rotation, and explode) I have to make to each tool palette item AFTER i've created the tab that I dread re-creating the tool palette. What would be great is if we could store this information into the block itself...then include PRE-insertion and POST-insertion macro support (that allows user interaction like getPoint and entsel that is not supported using reactors). Then maintaining a block libary would EASY and the blocks would be SMART.
;; written by Fatty T.O.H (c) 2004
;; all rights removed
;; get ObjectDBX document
;; edited 4/20/06
;; edited 5/28/06 by Jeff M (see commented lines)
;; edited 10/5/06
;; edited 3/19/07
;; edited 3/20/07
(defun odbx-test (/ dbx_doc)
;; edited 5/28/06 by Jeff M
;; modified slightly to work with more versions
(if (< (setq dbxver (atoi (getvar "ACADVER"))) 15)
"ObjectDBX method not applicable\nin this AutoCAD version"
(if (= (atoi (getvar "ACADVER")) 15)
I've played with this type of code a bit and found that DBX seems to need a lock on the source file. Does anyone know of an alternative method that can acquire the block even if the source file is open by another user? ...or can a DBX be opened in a "read-only" mode?