Author Topic: layer previous help  (Read 8558 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
layer previous help
« on: February 11, 2004, 08:13:31 AM »
i asked this question before but never really resolved it. i have some macros which create a layer set it current then perform a command. i would like to make it revert to the previous layer afterwards. the layer is a non plotting one and i keep forgetting to switch back. this would greatly help me if someone could throw me a bone. thanks

^C^C(command "-layer" "n" "VIEWPORT" "c" "WHITE" "VIEWPORT" "p" "n" "VIEWPORT" ) ;setvar clayer "VIEWPORT";MvEx_Ms2Ps;

CADaver

  • Guest
layer previous help
« Reply #1 on: February 11, 2004, 08:21:01 AM »
Get the current layer first with (setq clay (getvar 'CLAYER"))

Then close with (setvar "clayer" clay)

ELOQUINTET

  • Guest
layer previous help
« Reply #2 on: February 11, 2004, 08:30:10 AM »
daron told me to write it this way before but i'm not getting any result.he also told me not to create a new layer called "o-hatch". If I want to make sure it exists, use make not new. I want to create it if it doesn't exist or just make it current if it does.
what's wrong with this?

(command "-layer" "n" "0-HATCH" "c" "9" "0-HATCH" );(setq var (getvar 'clayer));setvar clayer "0-HATCH";hpname;STEEL;hpscale;1;hpang;0;bhatch;/;(setvar 'clayer var);

thanks for your help  :D

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
layer previous help
« Reply #3 on: February 11, 2004, 08:47:16 AM »
Just a guess, parenthesis missing??

Code: [Select]
(command "-layer" "n" "0-HATCH" "c" "9" "0-HATCH" );(setq var (getvar 'clayer));(setvar clayer "0-HATCH");hpname;STEEL;hpscale;1;hpang;0;bhatch;/;(setvar 'clayer var);
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ELOQUINTET

  • Guest
layer previous help
« Reply #4 on: February 11, 2004, 09:02:33 AM »
nice try cab but no go.  :cry: just a thought wouldn't it make more sense to get the current layer at the beginning? if so would i do it like so?

(setq var (getvar 'clayer));(command "-layer" "n" "0-HATCH" "c" "9" "0-HATCH" );(setvar clayer "0-HATCH");hpname;STEEL;hpscale;.0625;hpang;0;bhatch;/;(setvar 'clayer var);

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
layer previous help
« Reply #5 on: February 11, 2004, 09:05:34 AM »
try using this
Code: [Select]
(getvar "clayer")
instead of this
Code: [Select]
(getvar 'clayer)
just a guess!
TheSwamp.org  (serving the CAD community since 2003)

CADaver

  • Guest
layer previous help
« Reply #6 on: February 11, 2004, 09:14:25 AM »
Quote from: eloquintet
(setq var (getvar 'clayer));(command "-layer" "n" "0-HATCH" "c" "9" "0-HATCH" );(setvar clayer "0-HATCH");hpname;STEEL;hpscale;.0625;hpang;0;bhatch;/;(setvar 'clayer var);


That's how I'd do it, except I'd use double quotes around the variable name:
(setq var (getvar "clayer"))
and
(setvar "clayer" var)


Another suggestion, If you're going to make layer O-HATCH current anyway use "layer" "M" instead of "layer" "N".  "LAYER" "MAKE", makes the new layer current.

Code: [Select]
(setq var (getvar "clayer"));(command "-layer" "M" "0-HATCH" "c" "9" "0-HATCH" );hpname;STEEL;hpscale;.0625;hpang;0;bhatch;/;(setvar "clayer" var)

ELOQUINTET

  • Guest
layer previous help
« Reply #7 on: February 11, 2004, 09:27:13 AM »
here's the results i get. it looks to be halting at the transition between layer and hatch settings. how do i make this transition?

Command: (setq var (getvar "clayer"))
"0"
Command: (command "-layer" "M" "0-HATCH" "c" "9" "0-HATCH" )
-layer
Current layer:  "0"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
M
Enter name for new layer (becomes the current layer) <0>: 0-HATCH Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
c
Enter color name or number (1-255): 9
Enter name list of layer(s) for color 9 <0-HATCH>: 0-HATCH Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
nil
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
hpname
Invalid option keyword.
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:

daron

  • Guest
layer previous help
« Reply #8 on: February 11, 2004, 09:45:10 AM »
Here's your bone. There is a toolbar near the layer pulldown, that has three white papers on it with a previous arrow. Hitting this button will set your previous layer state, including plottability. You can hit it as many times as you need to. Here's the toolbars code: ^C^C_LayerP

ELOQUINTET

  • Guest
layer previous help
« Reply #9 on: February 11, 2004, 02:51:41 PM »
sorry guys i was out for a bit. yes daron that's what i was thinking i could do initually just add;_layerp after my code but it didn't work. i really wish i could figure this out urrrrrrrrgh

daron

  • Guest
layer previous help
« Reply #10 on: February 11, 2004, 03:20:21 PM »
On the command line, what happens when you run this:  (command "-layer" "M" "0-HATCH" "c" "9" "0-HATCH" ) ? I'll tell you what I get; an unfinished command. You can't automatically continue if you give control back to the user, which is what you've done. You need to add something to that. That is why you are getting this after:
Code: [Select]

nil
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
hpname
Invalid option keyword.
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:

ELOQUINTET

  • Guest
layer previous help
« Reply #11 on: February 11, 2004, 03:27:03 PM »
ok that makes sense so what do i add to end the layer potion and start the hatch variable part?

daron

  • Guest
layer previous help
« Reply #12 on: February 11, 2004, 03:36:34 PM »
In a lisp macro (command ...) all enter functions are dealt with using a set of double quotes, i.e. "". So, depending on how many you need to get out of the command, you'll need that many sets of quotes. In a menu you use semi-colons: ;. Understand?

ELOQUINTET

  • Guest
layer previous help
« Reply #13 on: February 11, 2004, 03:45:48 PM »
i'm not really following you. i'm new to this and am trying to decode what you guys show me. so are you saying i should be using : instead of " in here or no or just in the part before hpname. i'm lost  :oops:

daron

  • Guest
layer previous help
« Reply #14 on: February 11, 2004, 03:56:16 PM »
It depends on your application. If you're writing the code directly in the menu, you program an enter function as a semi-colon ; not colon : . Now, if you are using a lisp macro; in the lisp file itself, you use empty quotes for enter "". Experiment with it a bit.