TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: bman on July 12, 2005, 08:48:18 AM

Title: Can't clear my osnaps
Post by: bman 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)
)
Title: Re: Can't clear my osnaps
Post by: JohnK 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)
)
Title: Can't clear my osnaps
Post by: CAB 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)
)
Title: Can't clear my osnaps
Post by: Mark 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)
  )
Title: Can't clear my osnaps
Post by: bman 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)
)
Title: Can't clear my osnaps
Post by: CADaver on July 12, 2005, 12:18:05 PM
There is no need to set OSMODE to 0 prior to setting it to 256.
Title: Can't clear my osnaps
Post by: daron 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.