Author Topic: Redefine all block inside a block  (Read 3081 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Redefine all block inside a block
« on: April 10, 2006, 01:51:39 PM »
Hi all,..

I'm trying to found a way to redefine all block inside a block when inserting..
in lisp..

any idea ?

thanks.
Keep smile...

Yoland

  • Guest

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Redefine all block inside a block
« Reply #2 on: April 10, 2006, 02:38:48 PM »
When you know what block you are going to insert, then you can check the blocks definition in the blocks collection, step through it, and find all the objects that are blocks, and then redefine them before you insert.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Redefine all block inside a block
« Reply #3 on: April 10, 2006, 06:17:08 PM »
Thanks Yoland.....I know the trick..
but it not redefine all block inside a block..
need to search in this block...if there is other blocs..extract the name and redefine them.

When you know what block you are going to insert, then you can check the blocks definition in the blocks collection, step through it, and find all the objects that are blocks, and then redefine them before you insert.

do you think that is the easiest and best way ?

If yes..i'll work on it...

thanks.
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Redefine all block inside a block
« Reply #4 on: April 10, 2006, 06:35:08 PM »
When you know what block you are going to insert, then you can check the blocks definition in the blocks collection, step through it, and find all the objects that are blocks, and then redefine them before you insert.
do you think that is the easiest and best way ?

I do.  I can't think of a better way, and I do think you will want to do it before you insert it into the drawing so that you don't have to reinsert the new one incase it has attributes.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

RbtDanforth

  • Guest
Re: Redefine all block inside a block
« Reply #5 on: April 10, 2006, 07:01:14 PM »
As I use block instead of xrefs I ran into the nested block problem a while back. I came up with a pair of programs.
One to wblock all the nested blocks
Code: [Select]
(defun c:wmd (/ a b c d X)
                    (SETQ X (CADDDR (NENTSEL "WBLOCK DEEP PICKS")))
      (FOREACH Q X (setq a(strcat(cdr (assoc 2 (entget Q))) "")
                        b(getfiled "update" a "dwg" 9))
                        (command "WBLOCK"  b a(terpri)))
(TERPRI)
                          )
steps through all the levels in a single line picked wblocking out each nested block starting with the deepest one
and

Code: [Select]
(defun c:Nud (/ a b c d X)
                    (SETQ X (CADDDR (NENTSEL "DEEP PICKS")))
      (FOREACH Q X (setq a(strcat(setq b(cdr (assoc 2 (ENTGET Q))))
                                "=" (setq c (getfiled "update" b "dwg" 8)) )
                            C  (IF(=(substr C 2 1)":")
                               (PRINC (substr C (1+ (strlen(getvar "dwgprefix")))))
                               (PRINC  C))
                            d (- (strlen c) 4)
                            c (substr c 1 d)
                          ) (command "insert" a(terpri))(entupd q))
(TERPRI)
 )
         

will go out looking for blocks of that name and insert them = updating each level.

More recently I have discovered that you can go into a drawing that has the correct block using the Design center and if you right click of the block, just redefining is one of the options. If you do not have a block of that name in your drawing the redefine stuff is greyed out.