Author Topic: Can't clear my osnaps  (Read 2716 times)

0 Members and 1 Guest are viewing this topic.

bman

  • Guest
Can't clear my osnaps
« on: July 12, 2005, 08:48:18 AM »
Why aren't my osnaps setting to 0 prior to executing the circle command?

Code: [Select]
(defun c:cr3 (/ oldsnap)
     (setq oldsnap (getvar "osmode"))
       (setvar "osmode" 0)  
       (setvar "osmode" 256)  
         (command "circle" "3p")
(setvar "osmode" oldsnap)
(princ)
)

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: Can't clear my osnaps
« Reply #1 on: July 12, 2005, 08:53:28 AM »
Quote from: bman
Why aren't my osnaps setting to 0 prior to executing the circle command?

Code: [Select]
(defun c:cr3 (/ oldsnap)
     (setq oldsnap (getvar "osmode"))
       (setvar "osmode" 0)  
       (setvar "osmode" 256)  
         (command "circle" "3p")
(setvar "osmode" oldsnap)
(princ)
)


Code: [Select]
(defun c:cr3 (/ oldsnap)
     (setq oldsnap (getvar "osmode"))
       (setvar "osmode" 0)  
       (setvar "osmode" 256)   ;; <-----------
         (command "circle" "3p")
(setvar "osmode" oldsnap)
(princ)
)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Can't clear my osnaps
« Reply #2 on: July 12, 2005, 09:07:40 AM »
bman
I don't understand your routine?
It appears as though you want to exit the routine before picking the three points. Is that true?
If not you need to pause to allow the user to pick the points else the osnaps will be reset
when the leave the routine.
You would need this:
Code: [Select]
(defun c:cr3 (/ oldsnap)
   (setq oldsnap (getvar "osmode"))
   (setvar "osmode" 0)    
   (command "circle" "3p" pause pause pause)
   (setvar "osmode" oldsnap)
   (princ)
)

Or this:
Code: [Select]
(defun c:cr3 (/ oldsnap)
   (command "circle" "3p"
             "non" pause
             "non" pause
             "non" pause
   )
  (princ)
)
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.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Can't clear my osnaps
« Reply #3 on: July 12, 2005, 09:17:06 AM »
I was thinking more along these lines....

Code: [Select]

(defun c:cr3 (/ oldsnap)
    (setq oldsnap (getvar "osmode"))

    (setvar "osmode" 0)
    (command "circle" "3p" pause)

    (while
      (< 0 (getvar "CMDACTIVE"))
       (command pause)
    )
   
    (setvar "osmode" oldsnap)
    (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

bman

  • Guest
Can't clear my osnaps
« Reply #4 on: July 12, 2005, 10:01:45 AM »
I was trying to set the osmode to 0 & then to 256 prior to the circle command
This seems to work well
Code: [Select]
(defun c:cr3 (/ oldsnap)  
   (setq oldsnap (getvar "osmode"))  
   (setvar "osmode" 0)  
   (prompt "\nSelect first tangent point: ")
   (setvar "osmode" 256)  
   (command "circle" "3p" pause pause pause)
   (setvar "osmode" oldsnap)
   (princ)
)

CADaver

  • Guest
Can't clear my osnaps
« Reply #5 on: July 12, 2005, 12:18:05 PM »
There is no need to set OSMODE to 0 prior to setting it to 256.

daron

  • Guest
Can't clear my osnaps
« Reply #6 on: July 12, 2005, 01:45:38 PM »
As well, there's probably no reason to set it to anything except maybe zero as osmode's can all be overridden and if the user misses or snaps to the wrong point, he may have to escape & restart the routine.