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

Thread: Replace block in multiple drawings

  1. #1
    Member
    Join Date
    2010-10
    Posts
    20
    0 Did you find this post helpful? Yes

    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
    Certifiable AUGI Addict Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    4,682
    0 Did you find this post helpful? Yes

    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 Perry @MistresDorkness
    Archibus System Administrator
    Technical Editor
    not all who wander are lost
    (missing MEP/FP and Revit)

  3. #3
    Certifiable AUGI Addict Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    4,682
    0 Did you find this post helpful? Yes

    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 Perry @MistresDorkness
    Archibus System Administrator
    Technical Editor
    not all who wander are lost
    (missing MEP/FP and Revit)

  4. #4
    ACA Community Director dkoch's Avatar
    Join Date
    2003-03
    Location
    Where the BIM things are.
    Posts
    2,060
    0 Did you find this post helpful? Yes

    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.
    David Koch

  5. #5
    Certifiable AUGI Addict Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    4,682
    0 Did you find this post helpful? Yes

    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 Perry @MistresDorkness
    Archibus System Administrator
    Technical Editor
    not all who wander are lost
    (missing MEP/FP and Revit)

  6. #6
    ACA Community Director dkoch's Avatar
    Join Date
    2003-03
    Location
    Where the BIM things are.
    Posts
    2,060
    0 Did you find this post helpful? Yes

    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".
    David Koch

  7. #7
    Certifiable AUGI Addict Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    4,682
    0 Did you find this post helpful? Yes

    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 Perry @MistresDorkness
    Archibus System Administrator
    Technical Editor
    not all who wander are lost
    (missing MEP/FP and Revit)

  8. #8
    Member
    Join Date
    2013-08
    Posts
    3
    0 Did you find this post helpful? Yes

    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
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    3,693
    0 Did you find this post helpful? Yes

    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
    "Potential has a shelf life." - Margaret Atwood

    Autodesk Exchange Apps
    ~ Autoloader ~ AutoCAD Security

  10. #10
    ACA Community Director dkoch's Avatar
    Join Date
    2003-03
    Location
    Where the BIM things are.
    Posts
    2,060
    0 Did you find this post helpful? Yes

    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.
    David Koch

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 2012-09-20, 04:53 PM
  2. Find and Replace text in multiple drawings
    By hbisco in forum AutoLISP
    Replies: 18
    Last Post: 2012-01-20, 05:01 PM
  3. replace texts in two drawings together?
    By ccy137 in forum VBA/COM Interop
    Replies: 3
    Last Post: 2009-10-22, 12:06 PM
  4. Replies: 1
    Last Post: 2009-08-18, 11:20 PM
  5. Find and Replace for Multiple Drawings
    By acadwishlist in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2007-06-20, 06:04 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
  •