Help - R2005 broke this!

Discussion in 'AutoCAD' started by John Schmidt, Jul 15, 2004.

  1. John Schmidt

    John Schmidt Guest

    We have a routine that puts a "tic" mark at the end of selected arcs, but it
    now longer works since upgrading to R2005. Instead of drawing the expected
    tic mark, it says "zero length line created" in R2005. The person who wrote
    this is no longer with us, and I don't know LISP well enough to determine
    the cause of the problem.

    Any suggestions on resolving this greatly appreciated!

    Thanks - John

    (defun c:toc ()
    (setq selset (ssget))
    (setq lngth2 (getreal "How big ya wannit? "))
    (setq lngth (/ lngth2 2))
    (setq count 0)
    (setvar "CMDECHO" 0)
    (repeat (sslength selset)
    (if (= "ARC" (cdr (Assoc 0 (entget (ssname selset count)))))
    (progn
    (setq item (entget (ssname selset count)))
    (setq x1 (cdr(assoc 10 item)))
    (setq x2 (cdr(assoc 40 item)))
    (setq dist (- x2 lngth))
    (setq ffty (cdr(assoc 50 item)))
    (setq pnt1 (polar x1 ffty dist))
    (setq pnt2 (polar pnt1 ffty lngth2))
    (command "line" pnt1 pnt2 "")
    (setq ffty1 (cdr(assoc 51 item)))
    (setq pnt3 (polar x1 ffty1 dist))
    (setq pnt4 (polar pnt3 ffty1 lngth2))
    (command "line" pnt3 pnt4 "")
    )
    )
    (Setq count (1+ count))
    (princ ".")
    )
    (Setvar "cmdecho" 1)

    )
     
    John Schmidt, Jul 15, 2004
    #1
  2. John Schmidt

    Matt W Guest

    Worked for me. (I know that's not what you wanted to hear... or read)

    Are your OSNAPs on?? If so, turn them off.

    Try this one...
    Code:
    (defun c:toc ()
    (setq osm (getvar "osmode"))
    (setvar "osmode" 0)
    (setq selset (ssget))
    (setq lngth2 (getreal "How big ya wannit?   "))
    (setq lngth (/ lngth2 2))
    (setq count 0)
    (setvar "CMDECHO" 0)
    (repeat (sslength selset)
    (if (= "ARC" (cdr (Assoc 0 (entget (ssname selset count)))))
    (progn
    (setq item (entget (ssname selset count)))
    (setq x1 (cdr(assoc 10 item)))
    (setq x2 (cdr(assoc 40 item)))
    (setq dist (- x2 lngth))
    (setq ffty (cdr(assoc 50 item)))
    (setq pnt1 (polar x1 ffty dist))
    (setq pnt2 (polar pnt1 ffty lngth2))
    (command "line" pnt1 pnt2 "")
    (setq ffty1 (cdr(assoc 51 item)))
    (setq pnt3 (polar x1 ffty1 dist))
    (setq pnt4 (polar pnt3 ffty1 lngth2))
    (command "line" pnt3 pnt4 "")
    )
    )
    (Setq count (1+ count))
    (princ ".")
    )
    (Setvar "cmdecho" 1)
    (setvar "osmode" osm)
    )
    
    --
    Matt W

    The difference between genius and stupidity is that genius has its limits.
    | We have a routine that puts a "tic" mark at the end of selected arcs, but
    it
    | now longer works since upgrading to R2005. Instead of drawing the expected
    | tic mark, it says "zero length line created" in R2005. The person who
    wrote
    | this is no longer with us, and I don't know LISP well enough to determine
    | the cause of the problem.
    |
    | Any suggestions on resolving this greatly appreciated!
    |
    | Thanks - John
    |
    | (defun c:toc ()
    | (setq selset (ssget))
    | (setq lngth2 (getreal "How big ya wannit? "))
    | (setq lngth (/ lngth2 2))
    | (setq count 0)
    | (setvar "CMDECHO" 0)
    | (repeat (sslength selset)
    | (if (= "ARC" (cdr (Assoc 0 (entget (ssname selset count)))))
    | (progn
    | (setq item (entget (ssname selset count)))
    | (setq x1 (cdr(assoc 10 item)))
    | (setq x2 (cdr(assoc 40 item)))
    | (setq dist (- x2 lngth))
    | (setq ffty (cdr(assoc 50 item)))
    | (setq pnt1 (polar x1 ffty dist))
    | (setq pnt2 (polar pnt1 ffty lngth2))
    | (command "line" pnt1 pnt2 "")
    | (setq ffty1 (cdr(assoc 51 item)))
    | (setq pnt3 (polar x1 ffty1 dist))
    | (setq pnt4 (polar pnt3 ffty1 lngth2))
    | (command "line" pnt3 pnt4 "")
    | )
    | )
    | (Setq count (1+ count))
    | (princ ".")
    | )
    | (Setvar "cmdecho" 1)
    |
    | )
    |
    |
     
    Matt W, Jul 15, 2004
    #2
  3. John Schmidt

    John Schmidt Guest

    Thanks! Osnaps was it! At least I DO know how to save and restore those in
    the routine.

    Thanks again!

    John
     
    John Schmidt, Jul 15, 2004
    #3
  4. Yes OSNAP is it.
    Include
    (setq om (getvar "osmode"))
    (setvar "osmode" 0)
    someplace in the beginning of the lisp,
    then
    (setvar "osmode" om)
    at the end.

    BTW just out of curiosity - what language is this - "How big ya wannit?"
    I hope there are no ladies in your office ;-)

    John G
     
    John Georgiev, Jul 15, 2004
    #4
  5. John Schmidt

    John Schmidt Guest

    BTW just out of curiosity - what language is this - "How big ya wannit?"
    Actually, we DO have a couple sharp ladies using AutoCAD - they've never
    mentioned this... {:)

    Thanks again, everyone...

    John
     
    John Schmidt, Jul 15, 2004
    #5
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.