Jump to content

Redefining a dwg of Blocks into another dwg


rcb007

Recommended Posts

I know I can take individual dwgs and redefine them into the target dwg by either design center, blocks palette, or lisp routine. 

 

Is there a method to take all blocks placed inside a UpdateMaster.dwg (Which has all the most update Blocks), then either redefine / update into the working dwg? 

 

Thank you for any help.

Link to comment
Share on other sites

http://www.lee-mac.com/steal.html

 

none tech way. save a copy of your updatemaster.dwg in the same folder as the drawing you want updated. delete everything out of updatedmaster but leave the block definitions. then go into your old drawing and cut all and paste it into the updatemaster.dwg. as long as the blocks have the same name & base point you should be good.  then use the steal command to move over everything else.

Edited by mhupp
  • Like 2
Link to comment
Share on other sites

This is what I use ... it will require individual drawings per block ( code included ) placed somewhere in your search paths:

;; Redefine blocks with drawings found in search paths
(defun c:foo (/ file out)
  (setq out nil)
  (vlax-for x (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (or (wcmatch (vla-get-name x) "*|*,`**") (setq out (cons (vla-get-name x) out)))
  )
  (setvar 'cmdecho 0)
  (foreach x out
    (if	(setq file (findfile (strcat x ".dwg")))
      (progn (command ".-INSERT" (strcat x "=" file) nil)
	     (and (ssget "_x" (list '(0 . "insert") (cons 2 x) '(66 . 1)))
		  (command "._attsync" "name" x)
	     )
      )
    )
  )
  (setvar 'cmdecho 1)
  (princ)
)
;; Export all blocks in a drawing to a subfolder '_ExportedBlocks'
(defun c:exportblocks (/ x dir)
  (vl-mkdir (setq dir (strcat (getvar 'dwgprefix) "_ExportedBlocks\\")))
  (setvar 'filedia 0)
  (vlax-for x (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (or	(wcmatch (vla-get-name x) "*|*,`**")
	(command "._-wblock" (strcat dir (vla-get-name x)) (vla-get-name x))
    )
  )
  (setvar 'filedia 1)
  (startapp "explorer" (strcat "/e," dir))
)

 

Edited by ronjonp
Link to comment
Share on other sites

Thank you guys very much for your direction. Sounds like the only way to get this to work is by doing it individually. 


If I have over 30 blocks that need to be redefined, then I will make it work.

 

Thanks again!

Link to comment
Share on other sites

You can run lee-mac Steal from a program sense you can make a little lisp and steal multiple blocks in 1 go. So if you know the block names then its quick, I have done it. Just need to look again at the command sequence. 

 

(if(not steal)(load "StealV1-6"))
(Steal "C:\\My Folder\\MyDrawing.dwg" '(("Blocks" "BLK1" "BLK2")) ) ; add more names

 

  • Agree 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...