HOW TO MAKE ARC OF END POINTS

HOW TO MAKE ARC OF END POINTS

E.S.7.9
Advocate Advocate
485 Views
2 Replies
Message 1 of 3

HOW TO MAKE ARC OF END POINTS

E.S.7.9
Advocate
Advocate
hi i need to draw arc to endpoints of angular lines , how can i get that ? =================== (defun dtr (a) (* pi (/ a 180.0))) (defun rtd (a) (/ (* a 180.0) pi)) (DEFUN C:PRC () (setq IP (getpoint "\nSTART POINT: ")) (setq TBN 51) (setq TRY (getdist "\nWIDTH: ")) (setq aci1 (getdist "\nANGLE: ")) (setq aci3 (/ aci1 2)) (setq aci2 (* aci3 -1)) ;========================================= (setq P1 (polar IP (DTR 0.0) (/ TBN 2)) P3 (polar IP (DTR 180.0) (/ TBN 2)) P4 (polar P3 (DTR 90.0) TRY ) P5 (polar P1 (DTR 90.0) TRY) );setq ;========================================= (command "line" IP P1 "") (setq obb1 (entlast)) (command "line" IP P3 "") (setq obb2 (entlast)) (command "line" P3 P4 "") (setq obb4 (entlast)) (command "line" P1 P5 "") (setq obb5 (entlast)) (command "rotate" obb4 "" P3 ACI3 ) (command "rotate" obb5 "" P1 ACI2 ) (princ)) ============== thank you
0 Likes
Accepted solutions (2)
486 Views
2 Replies
Replies (2)
Message 2 of 3

marko_ribar
Advisor
Advisor
Accepted solution

Not sure, but try...

 

(defun dtr (a) (* pi (/ a 180.0)))
(defun rtd (a) (/ (* a 180.0) pi))
(defun C:PRC (/ osm IP TBN TRY aci1 aci3 aci2 P1 P3 P4 P5 obb1 obb2 obb4 obb5 C d P5R)
 (command "undo" "g")
 (setq osm (getvar 'osmode))
 (setvar 'osmode 0)
 (setq IP (getpoint "\nSTART POINT: "))
 (setq TBN 51)
 (initget 7)
 (setq TRY (getdist "\nWIDTH: "))
 (setq aci1 (rem (progn (initget 7) (getreal "\nANGLE IN DEGREES: ")) 180.0))
 (setq aci3 (/ aci1 2))
 (setq aci2 (* aci3 -1))
 (setq P1 (polar IP (DTR 0.0) (/ TBN 2))
       P3 (polar IP (DTR 180.0) (/ TBN 2))
       P4 (polar P3 (DTR 90.0) TRY)
       P5 (polar P1 (DTR 90.0) TRY)
 )
 (command "line" IP P1 "")
 (setq obb1 (entlast))
 (command "line" IP P3 "")
 (setq obb2 (entlast))
 (command "line" P3 P4 "")
 (setq obb4 (entlast))
 (command "line" P1 P5 "")
 (setq obb5 (entlast))
 (command "rotate" obb4 "" P3 ACI3)
 (command "rotate" obb5 "" P1 ACI2)
 (if (zerop aci1)
  (command "arc" P5 (polar IP (DTR 90.0) (+ TRY (/ TBN 2))) P4)
  (progn (setq C
               (apply 'inters
                      (append (mapcar 'cdr (vl-remove-if-not '(lambda (x) (member (car x) '(10 11))) (entget obb4)))
                              (mapcar 'cdr (vl-remove-if-not '(lambda (x) (member (car x) '(10 11))) (entget obb5)))
                              (list nil)
                      )
               )
         )
         (setq
          d (distance
             C
             (setq
              P5R (car (vl-remove
                        P1
                        (mapcar 'cdr (vl-remove-if-not '(lambda (x) (member (car x) '(10 11))) (entget obb5)))
                       )
                  )
             )
            )
         )
         (command "arc" "c" C P5R "a" aci1)
  )
 )
 (setvar 'osmode osm)
 (command "undo" "e")
 (princ)
)
Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 3 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

@E.S.7.9 wrote:
hi i need to draw arc to endpoints of angular lines , how can i get that ? ....
..

You haven't provided enough information.  There are an infinite number of Arcs that can be drawn between the endpoints of any two Lines.  Do you want the Arc that's tangent to the two Lines that were Rotated at the end of the code, at their endpoints?  Do you mean the endpoints about which they were Rotated, or their other endpoints?  Post an image or a sample drawing showing a typical situation.

 

By the way, I suspect this:

 

  (setq aci1 (getdist "\nANGLE: "))

 

should be this instead:

 

  (setq aci1 (getangle "\nANGLE: "))

 

And since you don't use any angles other than orthogonal ones, you don't really need that (dtr) function, but can just do this:

 

  (setq
    P1 (polar IP 0 (/ TBN 2))
    P3 (polar IP pi (/ TBN 2))
    P4 (polar P3 (/ pi 2) TRY )
    P5 (polar P1 (/ pi 2) TRY)
  ); setq

 

Also, the (rtd) function is never used, and there are a number of variables you don't need, since they are used only once, so their values may as well just be calculated where they are used, without bothering with the variables.

Kent Cooper, AIA
0 Likes