Author Topic: Replacing one block with another  (Read 6316 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Replacing one block with another
« Reply #15 on: December 15, 2008, 11:47:58 AM »
Just a stab in the dark here, but it looks like you could have a definition of that block inside itself.

Bingo!

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Skeeps

  • Guest
Re: Replacing one block with another
« Reply #16 on: December 15, 2008, 11:51:06 AM »
Yeah I think you maybe right.
Not sure I created all these blocks. But I'm not sure how to rectify it.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Replacing one block with another
« Reply #17 on: December 15, 2008, 11:53:03 AM »
Can you post your block?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

M-dub

  • Guest
Re: Replacing one block with another
« Reply #18 on: December 15, 2008, 12:04:19 PM »
Yeah, if you can post the block, we can fix it for you, but if not you should be able to do it.  Before you modify your block, save a backup copy then get to work on it.

Open the block file, use QUICKSELECT to find the Block Reference with the Name property matching your block name (filename).  See what happens when you delete it.
Then try purging everything out of the drawing and save it.

Go back into the drawing you want to update and try Ron's suggestion or my macro and see what happens.

EDIT:  Too late... there's the block.  :)

quamper

  • Guest
Re: Replacing one block with another
« Reply #19 on: December 15, 2008, 12:04:31 PM »
I stuck the block on a tool palette.. Then inserted it into a new drawing. Populated the atrributes. Switched back to the original drawing with the block made some geometry changes inside. Flipped back to new drawing. Hit re-define on my tool palette and boom updated block with no attributes changed.

Skeeps

  • Guest
Re: Replacing one block with another
« Reply #20 on: December 15, 2008, 12:08:49 PM »
oh thanks guys, I got so far with the macro, but to be honest..It's pretty new to me and alot of stuff ended up in red. I have to leave now to go and pick up my kiddiewinkles.  I'll have a bash at this tomorrow and let you know.


Thanks once again, you've been very patient. :mrgreen:

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Replacing one block with another
« Reply #21 on: December 15, 2008, 12:09:27 PM »
If you are going to update using -insert this is how i would approach it (one drawing per titleblock).

Here's a little snippet you could add to startup to automagically update them :)

Code: [Select]
(defun c:updatetitleblocks (/ path)
  (setq path "c:\\your\\path\\here\\")
  (foreach name '("a0 portrait" "a0 sheet" "a1 portrait" "a1 sheet" "a2 portrait" "a2 sheet"
  "a3 sheet")
    (if (and (tblobjname "block" name)
     (ssget "_x" (list (cons 2 name)))
)
      (command ".-INSERT"
       (strcat name "=" path name ".dwg")
       '(0 0 0)
       (command)
      )
    )
  )
  (princ)
)
« Last Edit: December 15, 2008, 12:57:24 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Kate M

  • Guest
Re: Replacing one block with another
« Reply #22 on: December 15, 2008, 01:30:08 PM »
What about Express Tools' Block Replace?

quamper

  • Guest
Re: Replacing one block with another
« Reply #23 on: December 15, 2008, 01:35:36 PM »
What about Express Tools' Block Replace?

Doesn't that only works with blocks already in the drawing that are named two different things?

I think in this situation, my solution is the absolute simplest. I tested with his actual block and it worked so I'm not sure what the problem is  :|

Unless there are alot of drawings and you're trying to automate it.. but if you're opening up the drawings anyway I think it's the simplest solution

Kate M

  • Guest
Re: Replacing one block with another
« Reply #24 on: December 15, 2008, 02:12:09 PM »
What about Express Tools' Block Replace?

Doesn't that only works with blocks already in the drawing that are named two different things?
Ah yes, you are correct. I was thinking that you could browse for the replacement block, but I guess not.

Skeeps

  • Guest
Re: Replacing one block with another
« Reply #25 on: December 16, 2008, 04:05:39 AM »
morning chaps. I've got a small job to do then I'll give your suggestion a go Quamper.


Skeeps

  • Guest
Re: Replacing one block with another
« Reply #26 on: December 16, 2008, 05:45:35 AM »
ok because I have absolutly loads of these drawings to update I'm going to try just renaming the block. A0 SHEET will be called A0SHEET
If that doesn't work then I'll use your way Quamper.



Skeeps

  • Guest
Re: Replacing one block with another
« Reply #27 on: December 16, 2008, 06:13:56 AM »
It Worked! Party time!
just renaming the blocks now I can use insert then express tools to replace the block.
A right mix of everything.


Thankyou all so much for your help. X

M-dub

  • Guest
Re: Replacing one block with another
« Reply #28 on: December 16, 2008, 07:56:56 AM »
Glad you got it figured out, Skeeps!  :)

quamper

  • Guest
Re: Replacing one block with another
« Reply #29 on: December 16, 2008, 08:17:52 AM »
Great glad it worked!