Author Topic: Macros/Menus question  (Read 7757 times)

0 Members and 1 Guest are viewing this topic.

Kate M

  • Guest
Macros/Menus question
« on: December 16, 2003, 12:06:29 PM »
Okay, so I'm venturing into the world of custom menus and toolbars, and I've hit a few roadblocks.

I got some pretty cool "LT Express" tools, and I'm trying to modify them a bit...like being able to pick more than one layer to be "isolated", or to keep repeating the "layoff" equivalent. Here's what I've got:

Code: [Select]
ID_LAYISO       [Isolate Layer]^C^C_ai_molc;\_-layer;off;*;n;;

and

Code: [Select]
ID_LAYOFF       [Turn Layer Off]^C^C_setenv;oldlayer;$m=$(getvar,clayer);_ai_molc;\"_-layer;_set;$M=$(getenv,oldlayer);_off;$M=$(getvar,clayer)";;

just as examples.

I know I could use a * to make the layoff repeat, but ending it's a bit of a pain -- you can't right-click or hit enter, so I'd like to have a way for it to do that. While I'm here, can anyone explain all the setenv/getenv bits?

Thanks!!

-Kate

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Macros/Menus question
« Reply #1 on: December 16, 2003, 12:26:30 PM »
setenv and getenv place and retrive information in the system environment set up by the operating system.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Macros/Menus question
« Reply #2 on: December 16, 2003, 12:32:29 PM »
Quote
getenv, provides AutoLISP routines with access to the currently defined operating system environment variables

If you open a command shell (DOS window) and type 'set' followed by <enter> you will see some of the variables. Others are stored in the registry.

for instance, to return the variable 'COMPUTERNAME' you would use;
Code: [Select]
(setq cn (getenv "COMPUTERNAME"))

(setq un (getenv "USERNAME"))


these are some in the registry under AutoCAD;

Code: [Select]
(setq mh (getenv "MaxHatch"))
(setq ps (getenv "ProfileStorage"))
(setq lt (getenv "LastTemplate"))


remember these variables are case sensitive.
TheSwamp.org  (serving the CAD community since 2003)

Kate M

  • Guest
Macros/Menus question
« Reply #3 on: December 16, 2003, 03:39:42 PM »
Does that mean it needs to be in the macro for it to work properly?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Macros/Menus question
« Reply #4 on: December 16, 2003, 04:44:38 PM »
Mark.. if you keep in mind that Kate is  unfortunately using LT and must abstain from lisp commands. She can however, implement diesel commands without problem. It works to some extent, but still provides some development issues.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

SMadsen

  • Guest
Macros/Menus question
« Reply #5 on: March 17, 2004, 07:43:12 AM »
Here are some macro's taken from a free tool for LT:

Code: [Select]
[->Layer edit]
[Layer isolate]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"-layer;set;$M=$(getvar,modemacro)";off;*;;;
[--]
[Turn object layer off]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"-layer;set;0;off;$M=$(getvar,modemacro)";;
[Turn on all layer]-la;on;*;;
[Freeze object layer]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"-layer;set;0;freeze;$M=$(getvar,modemacro)";;
[Freeze in active viewport]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"vplayer;freeze;$M=$(getvar,modemacro)";;;
[Thaw all layer]-la;thaw;*;;
[Lock object layer]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"-layer;lock;$M=$(getvar,modemacro)";;
[Lock all other layer]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"-layer;lock;*;unlock;$M=$(getvar,modemacro)";;
[Unlock object layer]_ai_molc;\^C^C_set;modemacro;$M=$(getvar,clayer);"-layer;unlock;$M=$(getvar,modemacro)";;
[Unlock all layer]-la;unlock;*;;


I don't have LT and can't test it.

On the same note, does anyone know why AI_MOLC works in LT?? I was under the impression that it is a lisp function :?

hudster

  • Gator
  • Posts: 2848
Macros/Menus question
« Reply #6 on: March 17, 2004, 09:01:07 AM »
To stop the command if you use * at the beginning of a macr, use the escape key.

I use a lot of macro commands and this way works best.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Kate M

  • Guest
Macros/Menus question
« Reply #7 on: March 17, 2004, 09:18:47 AM »
AI_MOLC must not be a lisp, because there's a button for it right next to the layer pull-down in LT. Go figure. :-)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Macros/Menus question
« Reply #8 on: March 17, 2004, 12:28:41 PM »
AI_MOLC is most likely defined within AutoCAD as a subroutine.

Those of us with LISP capabilities can use:
Code: [Select]

(type C:AI_MOLC)

This will return
Quote
SUBR
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

daron

  • Guest
Macros/Menus question
« Reply #9 on: March 17, 2004, 12:45:30 PM »
Doesn't a defined lisp also return SUBR.

I was thinking they probably created it as an ARX file so it could be used in LT as well, but I haven't looked into it.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Macros/Menus question
« Reply #10 on: March 17, 2004, 01:05:03 PM »
Well, it does... perhaps the thought was not flawless after all....You are probably correct. It may have been created in an ARX
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

SMadsen

  • Guest
Macros/Menus question
« Reply #11 on: March 17, 2004, 01:47:49 PM »
Kate, if you have the time and interest, could you run ARX->Command on LT and see if AI_MOLC turns up somewhere? Please?
That could be cool.

Kate M

  • Guest
Macros/Menus question
« Reply #12 on: March 17, 2004, 04:21:14 PM »
Um, hate to be stupid here, but...huh? ARX isn't a command or even listed in LT's help files.

SMadsen

  • Guest
Macros/Menus question
« Reply #13 on: March 18, 2004, 08:15:19 AM »
Really?
I have no idea what LT can or cannot do so I'll take the credit for being stupid thank you very much :)

Thanks for trying it out, Kate.

daron

  • Guest
Macros/Menus question
« Reply #14 on: March 18, 2004, 10:00:10 AM »
Stig, how would you run what you posted in regular autocad? I got the same as Kate. Nevermind, I get it.

Kate, maybe you tried what I tried originally. Try this: type ARX at the command line, then, if you get something other than unknown command, like : Enter an option [?/Load/Unload/Commands/Options]:

enter C.

Kate M

  • Guest
Macros/Menus question
« Reply #15 on: March 18, 2004, 12:56:07 PM »
Nope, no good -- it's funny, though, because I can't find AI_MOLC anywhere in the help file. The closest I get is instructions to "On the Layers toolbar, click Make Objects Layer Current." Weird.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Macros/Menus question
« Reply #16 on: March 18, 2004, 02:13:49 PM »
It is probably in an ARX module, in this case it would not be in the help menu in any depth
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie