AutoCAD Macros

Hello. I'm trying to get some macros I've written for LT to work in regular AutoCAD using a similar syntax. Here are some short examples...

======== I'm trying to save the last point picked as a registry setting using:

[&Pick Point]^C^C_id \(setenv "ActivePt" (getvar "lastpoint"))

I get the following error:

Command: (setenv "ActivePt" (getvar "lastpoint")) ; error: bad argument type: stringp (1.62005 41.933 0.0)

Can anyone help?

======== Also, can anyone tell me why this works?

[Save]^C^C(setenv "Temp1" (getvar "clayer"))

But this doesn't?

[Save]^C^C(setenv "Temp1" (getvar "clayer"))_line ========

Thanks, Mark

Reply to
Mark Gonzales
Loading thread data ...

Ok, for whatever reason, this now works in regular AutoCAD:

[Example]^C^C(setenv "Temp1" (getvar "clayer")) _line


And this works:

[Example]^C^C(setenv "Temp1" (getstring "Temp1 Value: "))

But this still doesn't work:

[Example]^C^C(setenv "Temp1" (getstring "Temp1 Value: ")) _line

It seems that I can't prompt the user for a Setenv value and then continue with the macro. :-( Any suggestions?

Also, the Setenv command in LT gives the current value as the default. For example:

============== Command: setenv Enter variable name: Temp1 Value: Mark

Command: Command: SETENV Enter variable name: Temp1 Value :

Command: ==============

Is it possible for regular AutoCAD to do this as well?

Reply to
Mark Gonzales

How about:

[Example]^C^C(setenv "Temp1" (getstring "Temp1 Value: "))(command "_.line") ___
Reply to
Paul Turvill

Thanks for the response Paul, but it's still a NoGo for me, even after removing the "." before "line". :-(

I'm ready to give up trying to use regular AutoCAD's Setenv LISP function. Even if I did get it to work, it still won't be as robust as LT's SETENV command which gives the current value as the default prompt.

Please consider my situation below and advise me on my best course of action.

I have written literally hundreds if not over a thousand AutoCAD LT macros and to my surprise, more than 90% of them work in regular AutoCAD so far with only minimum tweaking. I don't know LISP nor how to program in regular AutoCAD, only DIESEL using AutoCAD LT. My only problem thus far with regular AutoCAD is running macros containing LT's "_setenv" command.

For example...

======= ID_LabelLine [La&bel Line]*^C^C_setenv Label \_ucs _ob _nea,_mid \_ai_molc _non @ _break _non @$M=$(*,$(getvar,textsize),$(+,$(*,$(strlen,$(getenv,label)),.5),.5))

Reply to
Mark Gonzales

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.