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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Ok, for whatever reason, this now works in regular AutoCAD:
[Example]^C^C(setenv "Temp1" (getvar "clayer")) _line
WooHOO!
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 <Mark>:
Command: ============= Is it possible for regular AutoCAD to do this as well?
--

Thanks,
Mark



Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
How about:
[Example]^C^C(setenv "Temp1" (getstring "Temp1 Value: "))(command "_.line") ___

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
$(getvar,textsize) $(getenv,label);$(if,$(or,$(<,$(index,0,$(getvar,ucsxdir)),0),$(<,$(index,1, $(getvar,ucsydir)),0),$(=,$(index,1,$(getvar,ucsxdir)),-1)),_rotate _l _non @ 180 )_ucs _r md ====== This single macro above labels a line with an attributed block named "Label_2" using the line's UCS for orientation, and then resets the UCS (to "md" in this case). You can even use multiple words using quotes.
Example: ======Command: _SETENV Enter variable name: Label Value <Mark>: "Paul Turvill" Select object to align UCS: _nea,_mid of
Select line at "x": -----------------x----------------
Result: --------- Paul Turvill --------
This LT macro works PERFECTLY in regular AutoCAD if only I remove the first part: "_setenv Label \" which specifies the label value (after manually entering a Registry value). I can also substitue "setenv" with "users1" and all "$(getenv,label)" with "$(getvar,users1)" and it works perfectly.
However, using Users1, the value isn't saved and the prompt is a generic:
Using USERS1: "Enter new value for USERS1, or . for none <"Mark">:"
- istead of -
Using LT's SETENV command: "Enter variable name: Label Value <Mark>:"
It's that "_setenv" that's just KILLING me! :-( What I'm wondering is should I take a crash course in AutoLISP and attempt to create LT's SETENV comand for AutoCAD or is there another regular AutoCAD command that I can use instead of Setenv? Would it even be possible to create this LT command for AutoCAD or would it be worth the trouble? If you think it's possible, I'll go for it. I don't know enough about regular AutoCAD (yet) to know if something like this is even possible with LISP or any other supported programming language.
Again, using Users1 instead of Setenv does work with no other modifications, it's just not ideal.
--

Thanks a billion,
Mark



Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.