assist with 90 degree and prependicular points

assist with 90 degree and prependicular points

DC-MWA
Collaborator Collaborator
1,032 Views
5 Replies
Message 1 of 6

assist with 90 degree and prependicular points

DC-MWA
Collaborator
Collaborator

I'm working on a lisp routine that defines required door spaces for ada and 11B.

I'm close but it only works in one direction, if I pick opposite direction, it puts "box" on wrong side.

The box should be drawn starting at hinge point in direction selected no matter what side hinge is on or which direction picked.

See image for clarification. Lisp attached..

Thanks in advance for any assistance or input.


doorbox-error.JPG

0 Likes
Accepted solutions (1)
1,033 Views
5 Replies
Replies (5)
Message 2 of 6

Kent1Cooper
Consultant
Consultant

[I assume in your "good" side that the 2nd_pt pointer should be to the edge of the door opening, not the corner of the box.]

 

Do you do this always with Ortho turned on, to ensure that 3rd_pt is always perpendicularly-from-the-wall from 1st_pt?  If not, can't 3rd_pt be just any old where [though in a quick look it appears maybe it doesn't actually determine anything]?  If so, shouldn't you force Ortho on, just as you force Osnap off?  And what if the wall isn't in an orthogonal direction?

 

The issue is in the line with the  ;;; 90 degrees  comment at the end -- it always adds  90 degrees, but whether it should add or subtract  90 degrees depends on the relationship of door opening direction and hinge-to-latch direction.  But how to handle that will at least be affected by the answers to my questions above.

 

There are also variables set in that routine that are never used....

Kent Cooper, AIA
0 Likes
Message 3 of 6

DC-MWA
Collaborator
Collaborator

Hi Kent,

1. Yes (edge of door)

2. Ortho question: I need to be able to this in any direction. We do project with doors layout out at many angles.

3. Variables: still in "frankenlisp mode", I'll clean it up. Gathering parts and pieces if you will..  😉

0 Likes
Message 4 of 6

ronjonp
Mentor
Mentor
Accepted solution

You could try something like this:

(defun c:foo (/ a d i onseg p1 p2 p3 pd)
  (cond
    ((and (setq p1 (getpoint "\nPick first point: "))
	  (setq p2 (getpoint p1 "\nPick second point: "))
	  (setq p3 (getpoint "\nPick third point: "))
	  (setq i (inters p1 p2 p3 (polar p3 (+ (angle p1 p2) (/ pi 2.0)) 1.) onseg))
	  (setq d (distance i p3))
	  (setq a (angle i p3))
     )
     (command "_.pline" p1 p2 (setq p3 (polar p2 a d)) (polar p3 (angle p2 p1) (distance p1 p2)) "_close")
    )
  )
  (princ)
)
0 Likes
Message 5 of 6

DC-MWA
Collaborator
Collaborator

Thank you. I was able to make it work with a few minor tweaks and adds.

Code compliant door clearances on the fly... Stoked!

0 Likes
Message 6 of 6

ronjonp
Mentor
Mentor

Glad to help 🙂

0 Likes