Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Replace block in multiple drawings

  1. #1
    Member
    Join Date
    2016-01
    Posts
    44
    Login to Give a bone
    0

    Default Replace block in multiple drawings

    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!

  2. #2
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,406
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    Quote Originally Posted by swapr78 View Post
    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 Editor
    not all those who wander are lost

  3. #3
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,406
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    Quote Originally Posted by Wanderer View Post
    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.
    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 Editor
    not all those who wander are lost

  4. #4
    Super Moderator dkoch's Avatar
    Join Date
    2003-03
    Location
    Philadelphia, PA
    Posts
    2,392
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    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.

  5. #5
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,406
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    Quote Originally Posted by dkoch View Post
    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.
    I thought that only ran in the current drawing and not across multiple files?
    Melanie Stone
    @MistresDorkness

    Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
    Technical Editor
    not all those who wander are lost

  6. #6
    Super Moderator dkoch's Avatar
    Join Date
    2003-03
    Location
    Philadelphia, PA
    Posts
    2,392
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    Quote Originally Posted by Wanderer View Post
    I thought that only ran in the current drawing and not across multiple files?
    Yes, I believe that is correct. The original post indicated "a drawing".

  7. #7
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,406
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    Quote Originally Posted by dkoch View Post
    Yes, I believe that is correct. The original post indicated "a drawing".
    In the first sentence... the 2nd sentence says multiple files.
    Melanie Stone
    @MistresDorkness

    Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
    Technical Editor
    not all those who wander are lost

  8. #8
    Member
    Join Date
    2013-08
    Posts
    3
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    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

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,713
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    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

  10. #10
    Super Moderator dkoch's Avatar
    Join Date
    2003-03
    Location
    Philadelphia, PA
    Posts
    2,392
    Login to Give a bone
    0

    Default Re: Replace block in multiple drawings

    Quote Originally Posted by Wanderer View Post
    In the first sentence... the 2nd sentence says multiple files.
    I should have gotten out of the way.

Page 1 of 2 12 LastLast

Similar Threads

  1. Find and Replace for Multiple Drawings
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2015-10-07, 11:07 AM
  2. replace multiple structured text with block
    By nicolae.baboi in forum VBA/COM Interop
    Replies: 0
    Last Post: 2013-09-12, 08:03 PM
  3. Replies: 0
    Last Post: 2012-09-20, 04:53 PM
  4. Find and Replace text in multiple drawings
    By hbisco in forum AutoLISP
    Replies: 18
    Last Post: 2012-01-20, 05:01 PM
  5. replace texts in two drawings together?
    By ccy137 in forum VBA/COM Interop
    Replies: 3
    Last Post: 2009-10-22, 12:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •