I'm working in ACAD 2011 and have a drawing with multiple blocks (block '1') that need to be replaced with new block '2'. Is there any utility for replace the block with new block in multiple files?
Thanks in advance!
|
I'm working in ACAD 2011 and have a drawing with multiple blocks (block '1') that need to be replaced with new block '2'. Is there any utility for replace the block with new block in multiple files?
Thanks in advance!
There isn't really an in-built tool for that.
Try using this class handout to automate the procedure:
http://forums.augi.com/showthread.ph...ngs-in-a-Hurry
There are three sample exercises in that class, look for the 2nd one.
Melanie Stone
@MistresDorkness
Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
Technical Editornot all those who wander are lost
If you have any trouble with your code, I'm sure the folks in the customization and programming forums will be able to help you out.
http://forums.augi.com/forumdisplay....-Customization
http://forums.augi.com/forumdisplay.php?91-AutoLISP
Melanie Stone
@MistresDorkness
Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
Technical Editornot all those who wander are lost
Do you want to replace all instances of Block1 with Block2? If so, the Express Tools Replace Block tool (Express Tools ribbon tab, Blocks panel), should work for you.
Melanie Stone
@MistresDorkness
Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
Technical Editornot all those who wander are lost
Melanie Stone
@MistresDorkness
Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
Technical Editornot all those who wander are lost
You can use script. I have used that along with the visual lisp function to collect all of the file names in a directory to
open drawing
load necessary lisp files
run lisp files
save
close
go on to the next drawing
you could
open
replace block
save
close
etc
I'd personally not use a Script, and opt for ObjectDBX, given that this is an iterative task which modifies the Drawing's Database... A Script would work just fine functionally, it's just too slow for my preference. :thumbsup:
I'd probably code a sub-function, which accepts three arguments, the first being a DBX Document Object, the second being the EffectiveName of the BlockReference to be replaced, and the third being the EffectiveName of the BlockReference to replace it... However, the implied task here is to first match the applicable Object Properties prior to replacement, such as InsertionPoint, Color, Rotation, etc. and even Visibility State if dealing with more advanced functionality.
My main code would prompt the user to specify a directory to search, qualify any applicable drawings (perhaps even opening them to determine if they're the right version if working with multiple versions of AutoCAD-based products, etc.), and then programmatically iterate the list of drawings with an ObjectDBX Interface.
If you're not familiar with ObjectDBX, R. Robert Bell wrote a nice Autodesk University course (CP114-4, Good Habits for Code in Visual LISP) that I completed way back when I first learned what a LISP Defun was (Fall 2009), which unfortunately cannot be found here at AUGI I'm afraid... In any event, here's a direct link to the course handout (.DOCx format).
Also, here's a BatchFindSurface routine which you can cull, that implements some of the functionality I describe here (and more)... In short, it queries a directory of drawings for any Civil 3D Surfaces, generates, and opens a report, etc..
Cheers
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000