Results 1 to 7 of 7

Thread: Changing block names

  1. #1
    100 Club
    Join Date
    2005-05
    Posts
    111
    0 Did you find this post helpful? Yes

    Question Changing block names

    I have a drawing that desided that it would take a window block that I had copyed about 40 times and give each block a new name. The orig. was called window3030 and all the blocks changed and added window3030-flat-1 and so on.

    Is there any way to select all of the blocks and change them back to the orig. window3030 block????

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    7,557
    0 Did you find this post helpful? Yes

    Default Re: Changing block names

    Quote Originally Posted by pangell
    I have a drawing that desided that it would take a window block that I had copyed about 40 times and give each block a new name. The orig. was called window3030 and all the blocks changed and added window3030-flat-1 and so on.

    Is there any way to select all of the blocks and change them back to the orig. window3030 block????
    You could try the blockreplace command located in the Express Tools. It looks like you use the flatten command on your blocks.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    100 Club
    Join Date
    2005-05
    Posts
    111
    0 Did you find this post helpful? Yes

    Default Re: Changing block names

    Yes I can do that but, only one at a time which will take for ever. I would like all at one time.

  4. #4
    I could stop if I wanted to dfarris75's Avatar
    Join Date
    2004-12
    Location
    where ever i'm at
    Posts
    252
    0 Did you find this post helpful? Yes

    Default Re: Changing block names

    I have been told that it is poor practice to copy a block within a dwg. It is best to insert a new instance of the block each time. Not sure if this may have anything to do with your issue, but you may try it to see if you get the same result.
    Hope it helps.

  5. #5
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    7,557
    0 Did you find this post helpful? Yes

    Default Re: Changing block names

    Quote Originally Posted by pangell
    Yes I can do that but, only one at a time which will take for ever. I would like all at one time.
    Here is a bit of code to change the blocks that have been changed from the Express Tools Flatten command. This will replace the "flatten"ed blocks to the original block definition (without the *-flat-* block name) before the flatten command was executed on the blocks., as long as the original block definition is still within the drawing.

    Code:
    (defun C:FIXAFLAT ()
      (setq	SSET (ssget "x" (list (cons 2 "*-flat-*")))
    	CNT  0
      )
      (if SSET
        (progn
          (repeat (sslength SSET)
    	(setq ENTITY	(entget (ssname SSET CNT))
    	      BNAME	(cdr (assoc 2 ENTITY))
    	      BNAMECNT	(vl-string-search "-flat-" BNAME 0)
    	      BNAMEBASE	(substr BNAME 1 BNAMECNT)
    	      CNT	(1+ CNT)
    	)
    	(if (tblsearch "BLOCK" BNAMEBASE)
    	  (progn
    	    (setq ENTITY (subst (cons 2 BNAMEBASE) (assoc 2 ENTITY) ENTITY))
    	    (entmod ENTITY)
    	    (command "_purge" "Blocks" bname "No")
    	    (while (= 1 (getvar "cmdactive"))
    	      (command "")
    	      )
    	  )
    	)
          )
        )
      )
      (princ)
    )
    Let me know if you have any problems with this. It does not contain any error handling. It has been tested, but only a little.

    HTH
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  6. #6
    100 Club
    Join Date
    2005-05
    Posts
    111
    0 Did you find this post helpful? Yes

    Default Re: Changing block names

    I code worked great. The only thing if it could be set to leave the block placement prop. to what is on the drawing and not the block

    EX.. If I have a block and I had to mirror it in my drawing. When I run the code it will bring it back to the orig.

    Can we change the code so it will not change the block placement???

    Thank you

  7. #7
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    7,557
    0 Did you find this post helpful? Yes

    Default Re: Changing block names

    Quote Originally Posted by pangell
    I code worked great. The only thing if it could be set to leave the block placement prop. to what is on the drawing and not the block

    EX.. If I have a block and I had to mirror it in my drawing. When I run the code it will bring it back to the orig.

    Can we change the code so it will not change the block placement???

    Thank you
    This really doesn't do anything but replace the "flattened" block to the original block definition. I assumed those blocks are the originally defined blocks that the Express Tools Flatten command have modified. If so, the insertion should not have changed.

    You would need to post a copy of the drawing for me to see what is going on.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. Changing names of circuits
    By rob.goetze in forum Revit MEP - General
    Replies: 3
    Last Post: 2008-10-29, 11:25 PM
  2. Changing Block Names
    By amandas in forum Dynamic Blocks - Technical
    Replies: 3
    Last Post: 2008-08-29, 06:25 PM
  3. Blocks Changing Names
    By amandas in forum AutoCAD General
    Replies: 9
    Last Post: 2008-08-29, 06:01 PM
  4. Changing layer names
    By Matt Mercer in forum AutoLISP
    Replies: 11
    Last Post: 2006-02-02, 07:48 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
  •