Author Topic: Does X become Y??  (Read 3842 times)

0 Members and 1 Guest are viewing this topic.

Anonymous

  • Guest
Does X become Y??
« on: February 01, 2004, 07:39:03 PM »
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?
Code: [Select]
(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... :cry:

Craig

  • Guest
Does X become Y??
« Reply #1 on: February 01, 2004, 08:21:11 PM »
>I captured an image to show you but I don't know how to insert it in this post..

Go to http://theswamp.org/lilly.pond/ and create yourself a folder, then upload your image into the folder. Once you upload it click on the file you uploaded and the copy the url. Come back to your post and press the Img button, paste in the copied url and then press Img again or select close tags. What the link will look like is "[img]http://theswamp.org/lilly.pond/yourfolderhere/imagehere.jpg/[img]" minus the " "

Anonymous

  • Guest
Does X become Y??
« Reply #2 on: February 01, 2004, 10:01:01 PM »
Thanks Craig

Water Bear

  • Guest
Does X become Y??
« Reply #3 on: February 01, 2004, 10:47:57 PM »
here it is...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Does X become Y??
« Reply #4 on: February 02, 2004, 01:20:21 AM »
Untested...

Code: [Select]
(setq hyp (distance off_grip off_point)
(setq delta_ang (@delta (angle off_grip off_point) Line_Of_Travel_angle))
(setq opp_ang (- (* pi 0.5) delta_ang)) ; (- 90deg delta_ang)
(setq offdst (* hyp (cos opp_ang)))

  ;; compute the delta angle between a1 & a
  (defun @delta (a1 a2)
   (cond
    ((> a1 (+ a2 pi)) (- (+ a2 pi pi) a1))
    ((> a2 (+ a1 pi)) (abs(- a2 a1 pi pi)))
    ((- a2 a1))
   )
  )



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.

Water Bear

  • Guest
Does X become Y??
« Reply #5 on: February 02, 2004, 12:37:42 PM »
Thanks CAB ...it worked like a charm! :D