Author Topic: Raceway...Lisp routine Revisted...  (Read 2306 times)

0 Members and 1 Guest are viewing this topic.

AVCAD

  • Guest
Raceway...Lisp routine Revisted...
« on: November 05, 2004, 01:05:53 PM »
Original Post:

http://theswamp.org/phpBB2/viewtopic.php?t=2466&highlight=raceway

Ok, I have gotten away from creating this Lisp do to some major deadlines but I got some free time today.

This lisp is what I have: (from post in link)

Code: [Select]

(defun c:race (/ p1 ang ang2 cnt)
  (if (and
        (setq p1 (getpoint "\nPickInsert Point: "))
        (setq ang (getangle p1 "\nPick direction: "))
        (null(initget 7))
        (setq cnt (getint "\nEnter number of copies:"))
      )
    (progn
      (setq ang2 (* 180.0 (/ ang pi)))
      (command "INSERT" "G:/CHI-CUSTOMCAD/BLOCKS/TECHNOLOGY/TC/raceway.dwg"
               p1 "1" "" ang2)
      (command "._copybase" p1 (entlast) "")
      (repeat cnt
        (setq p1 (polar p1 ang 37.5))
        (command "._pasteclip" p1)
      )
    ) ; progn
  ) ; endif
  (princ)
) ; defun


Now the lisp works, BUT...

I want it to get the Distance between Point 1 and Point 2 (not just the Angle, it needs the angle too though).

Then I want it to take that distance and devide it by the 37.5 (and round to the nearest whole number).

Then I want that number as the "Enter Number of Copies" entry. This way it will take the Distance divide it by the length of the block and insert the correct amount along the path.

Obviously I know what I want but I have no clue how to get it there. Any help would be great.

Much appreciated.

Thanks guys/gals!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Raceway...Lisp routine Revisted...
« Reply #1 on: November 05, 2004, 03:30:30 PM »
(DISTANCE P1 P2)
will give you the distance
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.