Author Topic: osnap question  (Read 8444 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
osnap question
« on: August 13, 2004, 11:01:03 AM »
i have this code in my acaddoc.lsp file to reset my osnaps. what i'm wondering is how could i make this work transparently?

(DEFUN C:DK ()
(COMMAND "OSMODE" "127"))
(PRINC)

ELOQUINTET

  • Guest
osnap question
« Reply #1 on: August 13, 2004, 11:01:46 AM »
whoops that's

Code: [Select]
(DEFUN C:DK ()
(COMMAND "OSMODE" "127"))
(PRINC)

Andrew H

  • Guest
osnap question
« Reply #2 on: August 13, 2004, 12:02:21 PM »
I don't know about transparent, but I have my F1 key remapped to be my standard osnape stettings. It seems to work great. Let me know if you want me to post how to do this.

ELOQUINTET

  • Guest
osnap question
« Reply #3 on: August 13, 2004, 12:24:37 PM »
i know how to do that thanks anyway andrew. i would like to be able to reset my osnaps to my preferred setting while in a command.

Andrew H

  • Guest
osnap question
« Reply #4 on: August 13, 2004, 12:33:00 PM »
I just ran a test and if you setup your F1 key with 'osmode instead of just osmode it will run transparent.

ELOQUINTET

  • Guest
osnap question
« Reply #5 on: August 13, 2004, 12:51:52 PM »
thanks andrew i actually redefined F4 to be 'osmode;127 works like a charm thanks man

Andrew H

  • Guest
osnap question
« Reply #6 on: August 13, 2004, 12:52:42 PM »
anytime!!

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
osnap question
« Reply #7 on: August 13, 2004, 12:56:23 PM »
(defun c:dk () (setvar "osmode" 127) (princ))
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Andrew H

  • Guest
osnap question
« Reply #8 on: August 13, 2004, 12:58:56 PM »
how is that different from what dan originally posted?

PDJ

  • Guest
osnap question
« Reply #9 on: August 13, 2004, 01:19:05 PM »
What's wrong with the shift/right click combo??

Is this how you want your osmode just for this particular command??  If so, you can capture your current osmode when you start the routine, switch to this mode, then go back to your previous one when you finish the routine if you like..  Takes a little more programming but, it's not uncommon to see this in a LOT of lisp routines..

Then there are some that just turn off ALL your osnaps, turn your blipmode on, and create text styles and layers that only the original author had a use for..

God I love this program..

Andrew H

  • Guest
osnap question
« Reply #10 on: August 13, 2004, 01:25:28 PM »
Shift/right click is very limited. Setting up an "F" key is very useful when people who think they know how to write lisp, but really don't mess up your osmode. Toggling osmode with a lisp is easy enough, but hitting one button and having my osmode go to exactly what I want is very handy.

And yes this program is the best.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
osnap question
« Reply #11 on: August 13, 2004, 01:31:06 PM »
Quote from: Andrew H
how is that different from what dan originally posted?


quite a bit. Let me demonstrate.

Ill be right back.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CADaver

  • Guest
Re: osnap question
« Reply #12 on: August 13, 2004, 01:35:21 PM »
Quote from: eloquintet
i have this code in my acaddoc.lsp file to reset my osnaps. what i'm wondering is how could i make this work transparently?

Code: [Select]
(DEFUN C:DK ()
(COMMAND "OSMODE" "127"))
(PRINC)


I know you've already gotten a better answer, but for future reference, lose the C: and make it
Code: [Select]
(defun dk ()
(COMMAND "OSMODE" "127"))
(PRINC)


Then add (dk) to the button

You can create entire toolbars to transparently set all kinds of stuff, I use

Code: [Select]
(defun su ()
 (setq sn (car (getvar "snapunit")))
(if
 (setq nsn (getdist (strcat "Enter New Snap Value <" (rtos sn) ">: ")))
 (setq sn nsn)
)
 (setq snp (list sn sn))
 (setvar "snapunit" snp)
(princ)
)

to transparently change my snap unit.  The possibilities are interesting.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
osnap question
« Reply #13 on: August 13, 2004, 01:35:41 PM »
Here is a demonstration from my command line.

There is a big diff. using "setvar" over "command".
Code: [Select]
***********************
Command: *Cancel*

Command: (defun c:dk () (COMMAND "OSMODE" "127") (princ))
C:DK

Command: osmode

Enter new value for OSMODE <247>: 247

Command: l LINE Specify first point: 'dk

Invalid point.
Specify first point: 'osmode

>>Enter new value for OSMODE <247>:

Resuming LINE command.
Specify first point: *Cancel*

Command: *Cancel*

Command: *Cancel*

Command: (defun c:dk () (setvar "osmode" 127) (princ))
C:DK

Command: l LINE Specify first point: 'dk

Command: 'osmode

Enter new value for OSMODE <127>:

Resuming LINE command.
Specify first point: *Cancel*

Command: *Cancel*

Command: *Cancel*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CADaver

  • Guest
osnap question
« Reply #14 on: August 13, 2004, 01:38:45 PM »
oops, I only just noticed he was using (COMMAND instead of (SETVAR.