OSNAP doesn't work

Discussion in 'AutoCAD' started by Pj, Oct 14, 2009.

  1. Pj

    Pj Guest

    Hi,
    I need a help for a autolisp program:

    --start---
    (defun c:trat ()
    (setq tt 0)
    (setq trat (getreal "\nLunghezza tratteggio: "))
    (while (= tt 0)
    (setvar "OSMODE" 1)
    (setq s1 (entsel "\nSeleziona la linea da tratteggiare\n"))
    (setq ent (entget (car s1)))
    (setq pt1 (cdr (assoc 10 ent)))
    (setq pt2 (cdr (assoc 11 ent)))
    (setq lung (distance pt1 pt2))
    (command "_UCS" "_ob" s1)
    (command "._ERASE" s1 "")
    (setq pt1 nil)
    (setq pt2 nil)
    (setq pt1 (list 0 0 0))
    (setq pt2 (list lung 0 0))
    ;(command "_line" pt1 pt2 "")
    ;(command "_UCS" "_w" "")
    ;------------------------
    (setq x1 0)
    (setq x2 lung)
    (setq xa x1)
    (setq xb (+ x1 trat))
    ;(while (or(< xb (max x1 x2)) (< xa (max x1 x2)))
    (setvar "OSMODE" 0)
    (while (< xb (- lung trat))
    (print lung)
    (print (- lung trat))
    (print xb)
    (print xa)
    (setq pta (list xa 0 0))
    (setq ptb (list xb 0 0))
    (command "_line" pta ptb "")
    (setq xa nil)
    (setq xa (+ xb trat))
    (setq xb nil)
    (setq xb (+ xa trat))
    (setq pta nil)
    (setq ptb nil)
    )
    (setq pta (list xa 0 0))
    (setq xb nil)
    (setq xb x2)
    (setq ptb (list xb 0 0))
    (command "_line" pta ptb "")
    (command "_ucs" "_w")
    ;(setvar "OSMODE" 1)
    (command)
    (command "-osnap" "END,MID,CEN,NOD,QUA,INT,INS,PERP,TAN,APP,EXT,PAR")
    )
    )
    --end--
    why the last command "-osnap" doesnt work?
    Why if I use the command alone it works?
    Thank's
    Pj
     
    Pj, Oct 14, 2009
    #1
  2. I think, you better use
    (setvar "OSMODE" 11263)
    if yyou really want to turn all snaps on!?

    Thomas
     
    Thomas Proppe, Oct 14, 2009
    #2
  3. Pj

    strawberry Guest

    I think, you better use
    For me it's 15359
     
    strawberry, Oct 14, 2009
    #3
  4. Pj

    strawberry Guest

    I think, you better use
    For me (using AutoCAD 2008), ALL = 15359 while the combo chosen by the
    OP is 14847
     
    strawberry, Oct 14, 2009
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.