Author Topic: Point inverse  (Read 3579 times)

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
Point inverse
« on: August 07, 2004, 03:33:54 PM »
Here's a simple routine I've been using for a while that others might like.  I used to be constantly annoyed by the fact that the dist command returns a 3D-distance and angles in/from the XY-plane, while Lines/Curves By Points returns a horiz dist and bearing, but no slope dist or deltaXYZ.

This routine returns horiz dist, slope dist, and bearing, along with the deltaXYZ.  I actually changed my toolbar button and "d" alias to this routine; if I ever want to use the old routine (which hasn't happened yet), I can always type "dist".

Note: it only works in drawings attatched to an LDD project.

Code: [Select]
(defun C:PTINV (/ p1 p2 p1_2d p2_2d)
  (setvar "cmdecho" 0)
  (while (setq p1 (getpoint "\nEnter first point:  "))
    (if (setq p2 (getpoint p1 "Enter second point:"))
      (progn
(setq p1_2d (list (car p1) (cadr p1)))
(setq p2_2d (list (car p2) (cadr p2)))
(princ
 (strcat
   "\n \nHD = "
   (rtos (distance p1_2d p2_2d))
   "   SD = "
   (rtos (distance p1 p2))
   "   Course = "
   (F:BEAR p1 p2 "")
 )
)
(princ
 (strcat
   "\nDelta X = "
   (rtos (- (car p2) (car p1)))
   "  Delta Y = "
   (rtos (- (cadr p2) (cadr p1)))
   "  Delta Z = "
   (rtos (- (caddr p2) (caddr p1)))
 )
)
      )
    )
  )
  (princ)
)

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Point inverse
« Reply #1 on: August 09, 2004, 02:37:27 PM »
nice tool. Thank you for sharing!
Civil3D 2020