OK.. you guys have been a tremendous help, but I have to call on you again!
I'm trying to get an offset distance perpendicaular a reference point, however my line of travel isn't perpendicular to X or Y axis. I tried changing the snapang variable, but that didn't give me the correct distance. What am I doing wrong?
(setvar "snapang" #trav)
;;;test for direction of offset
(while (not exitloop)
(setq off_grip (getpoint "\nSelect side you wish to offset:")
off_point (getpoint "\nSelect point to align with:")
test_point (polar off_grip #trav 12.0)
off_dir (sideOf off_grip test_point off_point)
)
(if (= off_grip #start)
;;if grip is on right
(cond ((minusp off_dir)
(setq left_dif (abs
(- #wid2
(+ #wid1 (- (cadr off_grip) (cadr off_point)))
)
)
right_dif (abs (- (cadr off_grip) (cadr off_point)))
)
)
((zerop off_dir)
(setq right_dif 0.0
left_dif (abs (- #wid1 #wid2))
)
)
(T
(setq left_dif (abs
(- #wid1
(+ #wid2 (- (cadr off_grip) (cadr off_point)))
)
)
right_dif (- (+ left_dif #wid1) #wid2)
)
)
)
;;then grip is on left
(cond ((minusp off_dir)
(setq left_dif (abs (- (cadr off_grip) (cadr off_point)))
right_dif (abs
(- #wid1
(+ #wid2 (- (cadr off_grip) (cadr off_point)))
)
)
)
)
((zerop off_dir)
(setq left_dif 0.0
right_dif (abs (- #wid1 #wid2))
)
)
(T
(setq left_dif (abs (- (cadr off_grip) (cadr off_point)))
right_dif (abs
(- #wid2
(+ #wid1 (- (cadr off_grip) (cadr off_point)))
)
)
)
)
)
) ;if main
(if (or (> (abs left_dif) slpmat) (> (abs right_dif) slpmat))
(prompt
"\nOffset TOO great, reduce amount, \nmake in two tranitions OR go to OFFSETS"
)
(setq exitloop T)
)
) ;while
(setq exitloop nil)
;;;negative sets right
(cond ((minusp off_dir)
(prompt
(strcat "\nSetting RIGHT..."
(rtos (abs right_dif) 5 2)
" inches"
)
)
)
;;;zero means the side picked is flat
((zerop off_dir)
(if (> (car #start) (car off_grip))
(prompt "\nLeft side is flat..")
(prompt "\nRight side is flat..")
)
)
;;;positive sets left
(T
(prompt
(strcat "\nSetting LEFT..."
(rtos (abs left_dif) 5 2)
" inches"
)
)
)
)
(setvar "snapang" 0)
I captured an image to show you but I don't know how to insert it in this post...