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?!
Solved! Go to Solution.
Solved by АлексЮстасу. Go to Solution.
Solved by АлексЮстасу. Go to Solution.
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.
@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
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.
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.
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
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 ChicagoLooper 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.
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
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
LOL HHHH
its blocks that a get automaticlly from an app that i use in autocad
and the have differnt names
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
- 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
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.
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 unchanged
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.
Can't find what you're looking for? Ask the community or share your knowledge.