AutoCAD Map 3D Forum
Welcome to Autodesk’s AutoCAD Map 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

rename multiple blocks

34 REPLIES 34
SOLVED
Reply
Message 1 of 35
Anonymous
2887 Views, 34 Replies

rename multiple blocks

HI TO EVERYONE

i am still looking for a simple lisp to  rename multiple blocks at once in the same drawing

i mean different block names to one name

any ideas?!

34 REPLIES 34
Message 2 of 35
АлексЮстасу
in reply to: Anonymous

Hi,

 

1. Maybe try in dxf using text editors or the like?
2. Export these blocks, and import as one needed?
3. In ODCLASS, define all of these blocks as one object displayed by the desired block. All of these blocks will be replaced with the right one.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 3 of 35
Barzdil
in reply to: Anonymous

Hello, You mean like do command "BLOCKREPLACE" ? Maybe it's better to ask in special Lisp forum.

Message 4 of 35
ChicagoLooper
in reply to: Anonymous


@Anonymous wrote:

HI TO EVERYONE

.....i mean different block names to one name

any ideas?!


If they are 'different' blocks then you can't, and shouldn't, give those different blocks the same name.

Chicagolooper
Message 5 of 35

I assumed that each of the same blocks has different names. For example: "bl_1", "bl_2" ... "bl_77777"...
This happens, for example, after dgn, Microstation, if the export parameters in dwg indicate creating for each block a block with its own name.

 

4. You can try this lisp - FRTO. He will replace anything with anything you indicate.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 6 of 35
Anonymous
in reply to: ChicagoLooper

its ok i want to give them the same name!

Message 7 of 35
Anonymous
in reply to: ChicagoLooper

BLOCKREPLACE or renameBLOCKS.jpg does not let you name varies blocks 

Message 8 of 35
Anonymous
in reply to: АлексЮстасу

FRTO did not help

u got somthin else?

Message 9 of 35
Barzdil
in reply to: Anonymous

Hello, do You have the same problem with block renaming always in every new Your drawing, or it's just the problem only in one drawing? If You always in every new drawing have same blocks with exactly same names , whitch You want to rename, then I suggest You to write a simple command macros to Yourself.

Message 10 of 35
Anonymous
in reply to: Barzdil

yes it is always in every new drawing i have same blocks with exactly same names

but i dont know how to write in macros

can u do it for me

 

Message 11 of 35
Barzdil
in reply to: Anonymous

        As АлексЮстасу  suggested "2" method in second message, You can also use Mapexport-Import routine >> like here << to write Your own command and put it >> somewhere << in Ribbon, ToolPalettes or in exactly toolbar, and Your all blocks will be replaced just in one click. This method I suggest if You have say 20 or more blocks to rename.  But if You want to do Your job through command "blockreplace", here is just an example how to write Your own command macros for relpacing blocks:
-blockreplace;AAAA;666;Y;-blockreplace;BBBB;666;Y;
AAAA and BBBB are interchangeable blocks, and 666 is the name of the block you want.
 
Message 12 of 35
АлексЮстасу
in reply to: Anonymous

If you want to give different blocks (i.e. with a different description, consisting of different elements) the same names, then this task is impossible, because is absurd. As wrote to you above.
You can solve only another problem - to replace different blocks with one.

 

FRTO is a very powerful program - it allows you to replace anything with anything. Blocks to other blocks, plines to blocks, lines to texts, texts on a circle, lines, circles, blocks, texts to splines, etc.

 

 

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 13 of 35
Anonymous
in reply to: АлексЮстасу

could u check again the code in frto

i have some unknown letters in the code

(defun c:frto(/ ACTDOC COPOBJ ERRCOUNT EXTLST
EXTSET FROMCEN LAYCOL MAXPT CURLAY
MINPT OBJLAY OKCOUNT OLAYST
SCLAY TOCEN TOOBJ VLAOBJ *ERROR*)
(vl-load-com)
(defun *ERROR*(msg)
(if olaySt
(vla-put-Lock objLay olaySt)
); end if
(vla-EndUndoMark actDoc)
(princ)
); end of *ERROR*
(defun GetBoundingCenter(vlaObj / blPt trPt cnPt)
(vla-GetBoundingBox vlaObj 'minPt 'maxPt)
(setq blPt(vlax-safearray->list minPt)
trPt(vlax-safearray->list maxPt)
cnPt(vlax-3D-point
(list
(+(car blPt)(/(-(car trPt)(car blPt))2))
(+(cadr blPt)(/(-(cadr trPt)(cadr blPt))2))
0.0
); end list
); end vlax-3D-point
); end setq
); end of GetBoundingCenter
(if(not(setq extSet(ssget "_I")))
(progn
(princ "\n׃ךאזטעו מבתוךע הכ חאלום ט םאזלטעו Enter ")
(setq extSet(ssget))
); end progn
); end if
(if(not extSet)
(princ "\nDistination objects isn't selected!")
); end if
(if
(and
extSet
(setq toObj(entsel "\n׃ךאזטעו מבתוךע םא קעמ חאלוםטע "))
); and and
(progn
(setq actDoc
(vla-get-ActiveDocument
(vlax-get-Acad-object))
layCol
(vla-get-Layers actDoc)
extLst
(mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp
(mapcar 'cadr(ssnamex extSet))))
vlaObj(vlax-ename->vla-object(car toObj))
objLay(vla-Item layCol
(vla-get-Layer vlaObj))
olaySt(vla-get-Lock objLay)
fromCen(GetBoundingCenter vlaObj)
errCount 0
okCount 0
); end setq
(vla-StartUndoMark actDoc)
(foreach obj extLst
(setq toCen(GetBoundingCenter obj)
scLay(vla-Item layCol
(vla-get-Layer obj))
);end setq
(if(/= :vlax-true(vla-get-Lock scLay))
(progn
(setq curLay(vla-get-Layer obj))
(vla-put-Lock objLay :vlax-false)
(setq copObj(vla-copy vlaObj))
(vla-Move copObj fromCen toCen)
(vla-put-Layer copObj curLay)
(vla-put-Lock objLay olaySt)
(vla-Delete obj)
(setq okCount(1+ okCount))
); end progn
(setq errCount(1+ errCount))
); end if
); end foreach
(princ
(strcat "\n" (itoa okCount) " were changed. "
(if(/= 0 errCount)
(strcat (itoa errCount) " were on locked layer! ")
""
); end if
); end strcat
); end princ
(vla-EndUndoMark actDoc)
); end progn
(princ "\nSource object isn't selected! ")
); end if
(princ)
); end of c:frto

 

i highlighted it with red

Message 14 of 35

Why do your blocks have different names? Why don’t you work on keeping the same block name? Why do you allow the block to rename itself? Why can’t you maintain control of your block?

 

What’s next, the block telling you what socks to wear?

Chicagolooper
Message 15 of 35
Anonymous
in reply to: ChicagoLooper

LOL HHHH

its blocks that a get automaticlly from an app that i use in autocad

and the have differnt names

Message 16 of 35
ChicagoLooper
in reply to: Anonymous

I would suggest you find  another app (or method) that doesn't rename the block or gives you the option to keep the existing block name. 

 

Your goal should be how to bring in blocks that maintain their relative position and their attributes. It shouldn’t be how to rename blocks that get their name changed even when I don’t want them renamed in the first place. 

Chicagolooper
Message 17 of 35
АлексЮстасу
in reply to: Anonymous

  - could u check again the code in frto

  - i have some unknown letters in the code

 

Replace the first with:
Specify objects to replace and press Enter
Second on:
Specify an object to replace

 

Try this version - attached.
Authors: {Smirnoff} - Russia, Vladimir Azarko - Belarus / Minsk

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 18 of 35

Warning: FRTO has a very important feature - the blocks are replaced not at the insertion points, but at the centers of their gabarits.
That is, if the block is asymmetric, then the replacement block may not be in the same place where the block was replaced.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 19 of 35
Anonymous
in reply to: АлексЮстасу

can i use frto to change block name but also  keep block text the same?

now i used it and it woks but it changed block name and text !

i need the text in the block to remain unchangedBLOCK.png

Message 20 of 35
АлексЮстасу
in reply to: Anonymous

Try my second method:

2. Export these blocks, and import as one needed

MAPEXPORT all blocks with an attribute. MAPIMPORT as one block with an attribute.

 

In principle, in order not to guess, it is better to immediately attach the dwg example.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report