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

Troubleshoot a MACRO

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
272 Views, 6 Replies

Troubleshoot a MACRO

I made a toolbar with my popular wiretypes.
If some layer not exists it will be created (it must be defined in the create/edit wire type).
All works fine. Only for 1 layer i also want to change the linetype. So i tried adding this extra bit of code, but.....

Here is a working code:

^C^C(if (tblsearch "LAYER" "YEL_EARTH") (command "-layer" "C" "2" "YEL_EARTH" "") (command "-layer" "N" "YEL_EARTH" "C" "2" "YEL_EARTH" ""))(command "-layer" "S" "YEL_EARTH" "")(if(not wd_load)(if(setq x(findfile "wd_load.lsp"))(load x)))(wd_load);wd_inwire

Here is the code with the added Linetype which doesn't work:

^C^C(if (tblsearch "LAYER" "YEL_EARTH") (command "-layer" "C" "2" "YEL_EARTH" "") (command "-layer" "N" "YEL_EARTH" "C" "2" "YEL_EARTH" "L" "DASHDOT" "YEL_EARTH" ""))(command "-layer" "S" "YEL_EARTH" "")(if(not wd_load)(if(setq x(findfile "wd_load.lsp"))(load x)))(wd_load);wd_inwire

The only thing i added is the next:
"L" "DASHDOT" "YEL_EARTH"

On the command line this is the result:
(((_> wd_inwire


What is wrong?

Thanks already,
Peter
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Ok found it.
The length of the MACRO is limited to 255 characters.
Mine is 283.
Message 3 of 7
Anonymous
in reply to: Anonymous

Hello Peter,

You could create lisp routine to avoid the limit of 255 characters.
Message 4 of 7
Anonymous
in reply to: Anonymous

Yes, i know, but this was for the moment the quickest and easiest part, until i hit 283 characters.
Looking in the API i also found what i need and i can reduce the characters.
But yeah, i will make a lisp for it when i have some more time.

Peter
Message 5 of 7
Anonymous
in reply to: Anonymous

Have made some efforts to create the lisp.
For those who are interested. You can find it as an attachment to this post.
Message 6 of 7
Anonymous
in reply to: Anonymous

I use a script to add all my wire layers to a drawing. If a new wire type is used, I update my script file and run it. Therefore this new wire type will be available on this and all future drawings and projects.

I know this adds adds many wire types that are not used on the drawing but you can purge these later if you want (I don't bother).

Thanks to Doug in an earlier post for describing how to do this! Once you have created your script and saved it somewhere, just type SCRIPT in the command line, navigate to it and Bingo! all your layers are there.

I have attached my file - metric stuff though. Pay very careful attention to the spaces in each line.

It won't allow me to attach a .scr so rename .txt to .scr.

John
Message 7 of 7
Anonymous
in reply to: Anonymous

"Thanks to Doug in an earlier post for describing how to do this! Once you have created your script and saved it somewhere, just type SCRIPT in the command line, navigate to it and Bingo! all your layers are there."

Could you point to that thread of Doug's?

Thanks

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

Post to forums  

Autodesk Design & Make Report