Results 1 to 7 of 7

Thread: Changing block names

  1. #1
    100 Club
    Join Date
    2005-05
    Posts
    111
    Login to Give a bone
    0

    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
    9,096
    Login to Give a bone
    0

    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
    Login to Give a bone
    0

    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
    Login to Give a bone
    0

    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
    9,096
    Login to Give a bone
    0

    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
    Login to Give a bone
    0

    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
    9,096
    Login to Give a bone
    0

    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 the parameters names
    By MartinL in forum Revit Structure - Families
    Replies: 2
    Last Post: 2010-07-05, 08:24 AM
  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 Xref names
    By BCrouse in forum AutoCAD General
    Replies: 5
    Last Post: 2005-08-12, 05:35 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
  •