Insert Block from another drawing

0
29
To insert just one block definition from another drawing requires
a DBX module.

If you go to this link you can see a simple version (with no
error trapping)

https://forums.autodesk.com/t5/visua…p/td-p/5519160

I prefer to write functions that can be reused.

I have vast libraries that include 1000’s of functions.

I prefer to build them with error trapping built in…

I broke this routine up into reusable functions that perform
the steps necessary to copy a block from another drawing.

So…

Code:

;___________________________________________________________________________________________________________|
;
; Written By: Peter Jamtgaard copyright 2017 All Rights Reserved
;___________________________________________________________________________________________________________|

;___________________________________________________________________________________________________________|

;___________________________________________________________________________________________________________|
;
; General Functions
;___________________________________________________________________________________________________________|

;* (BlockFromFile strFullName strBlockName)
;* Function to duplicate a block definition from an outside drawing

;* (CopyObjects2 objOwner lstObjects objCOllection)
;* Function to create a safearray of objects and run the copyobjects method

;* (DBXDocument strFullName)
;* Function to open a DBX Document

;* (DBXBlockDefinition objDBXDocument strBlockName)
;* Function to read a DBX document and return a specified block definition

;* (ErrorTrap symFunction)
;* Function to trap an error

;* (ListToSafeArray lstObjects symObjectType)
;* Function to create a safearray

;$ Header End

; Function Headers

;___________________________________________________________________________________________________________|
;
; Function to duplicate a block definition from an outside drawing
;___________________________________________________________________________________________________________|

(defun BlockFromFile (strFullName strBlockName / lstGlobalToRelease objBlocks objDBXDocument objDBXBlockDefinition)
 (if (and (setq objDBXDocument         (DBXDocument strFullName))
          (setq objDBXBlockDefinition  (DBXBlockDefinition objDBXDocument strBlockName))
          (setq objBlocks              (vla-get-blocks...

Read More

LEAVE A REPLY