See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Lisp Help

  1. #1
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Lisp Help

    Need to get this code to add 10' and 10% to the final length. Any Ideas?

    Code:
    (defun c:cd ()
     (setvar "cmdecho" 0)
     (graphscr)
     (setq 
      p1 (getpoint "\nPick start point ")
      p2 (getpoint p1 "\nPick next point ")
      d1 (distance p1 p2)
      prdist (strcat "\nDistance: " (rtos d1))
     )
     (princ prdist)
     (setq p3 (getpoint p2 "\nPick next point or RETURN if done "))
     (while p3
      (setq
       d0 (distance p2 p3)
       d1 (+ (distance p2 p3) d1)
       p2 p3
       prdist (strcat "\nDistance: " (rtos d0) ", Cumulative distance: " (rtos d1))
      )
      (princ prdist)
      (setq p3 (getpoint p2 "\nPick Next Point "))
     )
     (setq cumd (strcat "Cumulative distance --> " (rtos d1)))
     (prompt cumd)
     (princ)
    )
    (princ "\nType CD to run Cumulative Distance")
    (princ)
    Last edited by BlackBox; 2013-07-27 at 05:05 AM.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    1

    Default Re: Lisp Help

    To add 10' then add 10% to the final length replace
    Code:
      (setq cumd (strcat "Cumulative distance --> " (rtos d1)))
    with
    Code:
      (setq d1 (*(+ d1 10) 1.1) cumd (strcat "Cumulative distance --> " (rtos d1)))

  3. #3
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Lisp Help

    Works perfect. You are a life saver.

Similar Threads

  1. Replies: 13
    Last Post: 2014-01-20, 06:14 PM
  2. NEED HELP WITH LISP ROUTINE - PURGE linetype lisp
    By ECASAOL350033 in forum AutoLISP
    Replies: 6
    Last Post: 2013-06-21, 01:13 AM
  3. Replies: 3
    Last Post: 2012-05-07, 08:16 PM
  4. Replies: 9
    Last Post: 2012-01-21, 07:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •