Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Anonymous
2604 Vistas, 5 Respuestas

Macro to Redefine Block in Multiple Drawings (but with blockname contain space)

Hi, I would like to ask for solution, since I'm very new to autocad macros
I have drawings set from other party that i have to revise, unfortunately they don't use xref and only using blocks,

and they split their drawings to multiple files, so i have to use adcenter to redefine block one by one in each drawings

 

I search the forum and found solution for macros as below:
-INSERT
title=
Y
(COMMAND \e "RESUME")


but unfortunately macro above only works for drawing name that does not contain space
if, let say the drawing name is title 01, it would not work
i try to use "title 01" between the filename:

 

-INSERT
"title 01"=
Y
(COMMAND \e "RESUME")

 

it will say:
Command: -INSERT
Enter block name or [?]: "TITLE 01"=
Warning: If you are trying to insert the file: "TITLE 01"
it must be inserted using the <block>=<filename> syntax.
Command: Y
Unknown command "Y". Press F1 for help.

Is there  a solution for my problem above? would very much appreciated for the help :cara_con_una_leve_sonrisa:

thank you

Alfred.NESWADBA
en respuesta a: Anonymous

Hi,

 

please do not start multiple threads with the same question (just added the space in filename issue).

You have already a thread and active discussion >>>there<<<, please continue in that thread.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
R_Tweed
en respuesta a: Anonymous

I am running 2020 with arch toolsets and found that when I used the quotes for the long file name it worked but did not work for a "block name". It reads back the block as test 1" for why I have now clue.  I personally don't like to use file names or blocks or pretty much anything with spaces within Autocad. That said If you rename the block then the a script will work.  You should also rename the base.dwg naming if possible.

 

You could make two scripts. one to rename and then another to do the block update.

;first script renames the block

-RENAME
B
"cir 1"
cir-1
;next script

-insert

;block name=dwg file location and namecir-1=c:\plot\cir-1.dwg
0,0
1
1

ERASE
LAST

daneson.marcelino
en respuesta a: Anonymous

In Scripts, dealing with the strings with spaces will be in this format in order to continue.

 

(command "insert" "a3(tags)=C:\\Users\\dmmn0800\\Documents\\a3(tags).dwg" "0,0" "1" "1" "0")

 

in this situation, i replace the block named "A3(tags)" with a new one. Even the file name of the new block has space, (e.g A3 Tags.dwg) the script can read it because it was written in autolisp format.

 

Anonymous
en respuesta a: R_Tweed

technically this works, although need to workaround a bit, but still it get the job done
I just rename the block name to remove the space, and then just use the first script to batch redefine 

thanks for all the help

Anonymous
en respuesta a: Alfred.NESWADBA

very sorry about that, I'll close this one

thank you