*Free* lisp program to replace Acad distance command

Discussion in 'AutoCAD' started by medeziner, Aug 23, 2006.

  1. medeziner

    medeziner Guest

    HowFar lisp is a FREE lisp program to measure the exact
    distance and the X and Y components between two
    points (PT1-PT2) in Decimal, Fractional, Engineering,
    Architectural and Metric. It also gives the angle between
    the two points in Nearest degree, Decimal degree and
    degrees/minutes/seconds formats. While the dialog box
    displays the measurements it allows the user to change
    the precision of each format from 0 to 8 places precision.

    TRY IT OUT.......IT'S FREE
    http://mywebpages.comcast.net/medeziner/
     
    medeziner, Aug 23, 2006
    #1
  2. medeziner

    Dr Fleau Guest

    Ummm. DISTANCE command does the exact same thing, and with a little
    tweaking, you get the format you want. No big deal here.
    A free cooler full of Labatt's Blue would get my attention. Your freebie is
    just not quite titillating. Sorry.
    Unless I'm completely missing the point, which happens occasionally.
    Just for fun, here is a LISP I wrote that lets you pick lines and arcs (or
    whatever, but it just adds lines and arcs), adds the lengths and displays a
    message box with the result.
    Enjoy. Any and all mistakes are intentional, adding spice to an otherwise
    perfect file.

    Dr Fleau

    (defun c:develop (/ iter devel $a total data1
    stpt endpt distl strad endrad distr
    )
    (setvar "osmode" 0)
    (setq $a nil
    iter 0
    devel 0.0
    stpt nil
    endpt nil
    strad 0.0
    endrad 0.0
    rad 0.0
    distl 0.0
    distr 0.0
    total 0.0
    devel 0.0
    )
    (setq $a (ssget))
    (setq total (sslength $a))
    (while (< 0 total)
    (progn
    (setq data1 (cdr (entget (ssname $a iter))))
    (cond
    ((= (cdr (assoc 0 data1)) "LINE")
    (Progn
    (setq
    stpt
    (cdr (assoc 10 data1))
    endpt
    (cdr (assoc 11 data1))
    )
    (setq distl (abs (distance stpt endpt)))
    (setq devel (+ devel distl))
    ) ;_END PROGN
    ) ;_END COND1
    ((= (cdr (assoc 0 data1)) "ARC")
    (Progn
    (setq
    strad
    (cdr (assoc 50 data1))
    endrad
    (cdr (assoc 51 data1))
    rad
    (cdr (assoc 40 data1))
    )
    (cond
    ((> endrad strad)
    (setq distr (* rad (- endrad strad)))
    )
    ((setq distr (* rad (+ endrad (- (* 2 pi) strad))))
    )
    (t nil)
    ) ;_end COND
    (setq devel (+ devel distr))
    ) ;_END PROGN
    ) ;_END COND2
    (T nil)
    ) ;_END COND
    (setq iter (+ 1 iter))
    (setq total (- total 1))
    ) ;_END PROGN
    ) ;_END WHILE
    (alert (strcat "Total length : " (rtos devel) " units"))
    (setq $a nil)
    (setvar "osmode" 183)
    ) ;_end DEFUN DEVELOP
     
    Dr Fleau, Aug 23, 2006
    #2
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.