Slot lisp won't pick a perpendicular point on a line.

Slot lisp won't pick a perpendicular point on a line.

StanThe
Enthusiast Enthusiast
1,061 Views
3 Replies
Message 1 of 4

Slot lisp won't pick a perpendicular point on a line.

StanThe
Enthusiast
Enthusiast

I have a lisp that draws a slot to 2 points. Can someone tell me why i can't pick a perpendicular point on a line as my second point?

Added my lisp routine here:

 

;This lisp will draw a slot center to center with a 1" diameter. SAH
(defun c:FH1 (/ cntr1 cntr2 pt1 pt2 pt3 pt4 a b c )
(setq cntr1 (getpoint "\nPick start of slot: ")) ;pt1 = first point
(setq cntr2 (getpoint "\nPick end of slot: ")) ;pt2 = end point
(setq b (angle cntr1 cntr2)) 😜 = angle
(setq c (distance cntr1 cntr2)) ;c = length
(setq pt1 (polar cntr1 (- b (/ pi 2)) 0.5)) ;(dtr 90.0) = (/ pi 2)
(setq pt2 (polar cntr2 (- b (/ pi 2)) 0.5))
(setq pt3 (polar cntr2 (+ b (/ pi 2)) 0.5))
(setq pt4 (polar cntr1 (+ b (/ pi 2)) 0.5)) ;0.5 is the radius
(SETVAR "PLINEWID" 0)
(COMMAND "PLINE" pt1 pt2 "A" pt3 "L" pt4 "A" "CL" "")
(princ "the center to center length is ") (princ c) (terpri)
(princ "the angle of the slot is ") (prompt (angtos b 1 5))(princ)
)
(princ)

SH
0 Likes
Accepted solutions (1)
1,062 Views
3 Replies
Replies (3)
Message 2 of 4

dbhunia
Advisor
Advisor
Accepted solution

Try like this....

 

.....................
(setq cntr1 (getpoint "\nPick start of slot: ")) ;pt1 = first point
(setq cntr2 (getpoint cntr1 "\nPick end of slot: ")) ;pt2 = end point
.....................
(COMMAND "PLINE" "_none" pt1 "_none" pt2 "A" "_none" pt3 "L" "_none" pt4 "A" "CL" "");Also try this
.....................

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 4

StanThe
Enthusiast
Enthusiast

Thank you for your help dbhunia, works great!!!

Would you tell me why that was the cause or where i can research that fix?

Thanks!

SH
0 Likes
Message 4 of 4

dbhunia
Advisor
Advisor

Whenever you want to snap/Draw a perpendicular on any Line/pline /.... that should always required a reference point respect to which the perpendicular will create......


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes