Macro to redefine block only

Macro to redefine block only

M_c3d
Advisor Advisor
1,419 Views
8 Replies
Message 1 of 9

Macro to redefine block only

M_c3d
Advisor
Advisor

Hi,

 

I've written the macro below to redefine a specific block in an open drawing.  It work's OK apart from it does not escape the command at the end, it continues the -insert command and asks to specify point etc

 

^C^C-insert logo= c:\new\logo Y^C

 

Any ideas?

 

Thanks in advance!

0 Likes
Accepted solutions (1)
1,420 Views
8 Replies
Replies (8)
Message 2 of 9

ronjonp
Mentor
Mentor

Try this instead:

^C^C(command "-insert" "logo=c:\\new\\logo.dwg" nil)
Message 3 of 9

Moshe-A
Mentor
Mentor

@M_c3d  hi,

 

try this

 

^C^C-insert "logo=c:\new\logo Y" ^C

 

pay high attention to spaces as you know it's interpret as enters.

 

Moshe

Message 4 of 9

M_c3d
Advisor
Advisor

 Hi @Moshe-A 

 

Thanks for your help.  It returned;

 

Command: -insert Enter block name or [?] <a$c7a864ac9>: "logo=c:*Cancel*</a$c7a864ac9>

 

Thanks

0 Likes
Message 5 of 9

M_c3d
Advisor
Advisor

Hi @ronjonp 

 

Thanks for your help.  It returned;

 

Command: (command "-insert" "logo=c:*Cancel*

 

Thanks

0 Likes
Message 6 of 9

Moshe-A
Mentor
Mentor

works perfect here

 

is your wblock name "logo y"?

does it lay in c:\new folder?

 

if it does not then fix it by specifying and exact names

 

are you running an AutoCAD LT?

 

 

 

Message 7 of 9

cadffm
Consultant
Consultant
Accepted solution

 

@M_c3d 

- The block name is LOGO, right?

- and nobody who need to ask for basic help should use a blank as enter in a menu-macro, use the right character (; semicolon)

 Why: Works more often and is much easier to see&count.

Don't use Backslash in a menu-macro, except you want what it stand for: One User-input.

User SLASHs for the path

 

 

^C^C^C_.-INSERT;"LOGO=C:/NEW/LOGO";^C

 

 

Generally:

[F1] Command -INSERT

[F1]About Special Control Characters in Command Macros

Sebastian

Message 8 of 9

M_c3d
Advisor
Advisor

@Moshe-A  The block name was Logo with the Y for the redefine option.

I'm running civil 3d, but the macro will be for LT users.

Thanks,

0 Likes
Message 9 of 9

M_c3d
Advisor
Advisor

Yes the block name was Logo.  That's it now working.  I was aware of the spaces representing returns, I had originally got the code from another post I had made on the issue https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/macro-to-redefile-block/m-p/8717292#...

Thanks for your assistance, much appreciated @cadffm @Moshe-A @ronjonp 

0 Likes