Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rename ONE block.

1 view
Skip to first unread message

Karl

unread,
Dec 18, 2002, 10:38:39 PM12/18/02
to
Has anybody ever seen a routine that will:
Use REFEDIT to modify a block and then have the option of renaming
that particular block in lieu of changing all the blocks in the
drawing with the original name?
Sort of like RENAME for only one insert of that particular block.
Or maybe RENAMEONE which would find the insertion point, explode that
that particular block and and then create an identical block in it's
place with a different name.

--
Karl
(|:-{>

Paul Turvill

unread,
Dec 19, 2002, 1:23:16 AM12/19/02
to
There might be one, but why not just EXPLODE one of the insertions, make
your modifications, then use the BLOCK command to create a new block with
the new name from the old and modified objects?
___

"Karl" <kdh...@att.net> wrote in message
news:nhf20v0on1g09pos7...@4ax.com...

Karl

unread,
Dec 19, 2002, 3:20:13 PM12/19/02
to
Because I'm trying to automate that exact process - without
necessarily modifying the block.
Sorry, There were just too many things in my head when I phreased the
question..
If I could just rename one block of a "bunch" of blocks of the same
name my life would be complete -- or at least it would make me happy.
The code is a little over my head.

It has to do with the COPY With a Base Point command.
That is how I insert windows in my architectural drawings.
ACAD gives the blocks a random "coded" name. That's what I'm truly
after -- to rename blocks with names like "A$C3D38282D".

Kevin Nehls

unread,
Dec 19, 2002, 3:29:21 PM12/19/02
to
Yep, it's part of the Mechanical version. We have a slightly modified
REFEDIT command that allows us to rename the block you are editing as well
as changing the insertion point.

Sorry, can't be of more much help other than going along with Paul's
suggestion?

You can still automate that process by creating a routine that will prompt a
user to select a block to rename and the name name, then have the routine
save it's current settings (layer, insertion point, rotation angle, etc)
then explode it and create the block with those settings and the new name.

--
Kevin Nehls


"Karl" <kdh...@att.net> wrote in message
news:nhf20v0on1g09pos7...@4ax.com...

Joe Burke

unread,
Dec 19, 2002, 5:27:58 PM12/19/02
to
Karl,

I think this is what you want.

Joe Burke

;make a copy of a block with a new name
;select block to copy, enter new name, pick insertion point
;remove pause "1" "1" "0" at end to control block scale and
;rotation while inserting the copied block
;doesn't seem to work with anonymous blocks

;thanks to Alex Repetto for code posted to Customization NG
;thanks to Jason Piercey for his help
;code revised Joe Burke July 29, 2001

(defun C:CopyBlock2 (/ *error* OldBlockName NewBlockName
rewind BlockName Info BlockInfo ent_name ent_info)

(defun *error* (Msg)
(cond
((or (not Msg)
(member Msg '("console break"
"Function cancelled"
"quit / exit abort"))))
((princ (strcat "\nError: " Msg)))
) ;cond
(princ)
) ;end error

(sssetfirst)
(setq OldBlockName (entsel "\nSelect Block to copy: "))
(while
(or
(null OldBlockName)
(/= "INSERT" (cdr (assoc 0 (entget (car OldBlockName)))))
)
(princ "\nSelection was not a block - try again...")
(setq OldBlockName (entsel "\nSelect Block to copy: "))
)
;block name
(setq OldBlockName (strcase (cdr (assoc 2 (entget (car OldBlockName))))))
;new name
(setq NewBlockName (getstring T "\nEnter new block name: "))
;block definition
(setq rewind T)
(while (setq Info (tblnext "BLOCK" rewind))
(setq BlockName (strcase (cdr (assoc 2 Info))))
(if (= OldBlockName BlockName)
(setq BlockInfo Info)
)
(setq rewind nil)
)
(if BlockInfo
(progn
(setq ent_name (cdr (assoc -2 BlockInfo)))
;header definition:
(entmake (list '(0 . "BLOCK")
(cons 2 NewBlockName)
'(70 . 2)
(cons 10 '(0 0 0))
)
)
;body definition:
(entmake (cdr (entget ent_name)))
(while (setq ent_name (entnext ent_name))
(setq ent_info (cdr (entget ent_name)))
(entmake ent_info)
)
;footer definition:
(entmake '((0 . "ENDBLK")))

(command "-INSERT" NewBlockName pause "1" "1" "0")
)
)
(*Error* nil)
(princ)
) ;end


"Karl" <kdh...@att.net> wrote in message

news:ar940v4lmf1d2sicm...@4ax.com...

Daniel J. Altamura, R.A.

unread,
Dec 20, 2002, 7:53:47 AM12/20/02
to
You could always wblock it out to a file, or copy/paste into a new file,
open the new file, rename the block, then insert it back into the drawing.

--
Daniel J. Altamura, R.A.
Altamura Architectural Consulting
and SoftWorx, Autodesk Authorized Developer
DAlt...@compuserve.com
-----------------------------------------------------------------


"Karl" <kdh...@att.net> wrote in message
news:nhf20v0on1g09pos7...@4ax.com...

0 new messages