;;; ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 6-21-99 ;;;> EDITED: 09-06-2005 ;;; (DEFUN ttarc_error (msg / ) (setq *error* old_ttarcerror) (setvar "osmode" old_osmodes) (princ "\nERROR: ") (princ msg) (princ "\n") (princ) ) (DEFUN C:TTARC () (setq old_ttarcerror *error*) (setq old_osmodes (getvar "osmode")) (setvar "osmode" 0) (setq frst_tan (nentselp "\nSelect first tangent")) (setq scnd_tan (nentselp "\nSelect second tangent")) (setq frst_edef (entget (car frst_tan))) (setq scnd_edef (entget (car scnd_tan))) (setq frst_sav frst_edef) (setq scnd_sav scnd_edef) (if ureal nil (load "ureal" "\nFile UREAL.LSP bot loaded! ") ) ;_ end of if (if (eq (cdr (assoc 0 frst_edef)) "VERTEX") (progn (while (not (equal (cdr (assoc 0 frst_edef)) "SEQEND")) (setq frst_edef (entget (entnext (cdr (assoc -1 frst_edef))))) ) ;_ end of while (setq frst_edef (entget (entnext (cdr (assoc -2 frst_edef))))) (while (not (equal frst_edef frst_sav)) (setq frst_edef (entget (entnext (cdr (assoc -1 frst_edef))))) ) ;_ end of while (setq frst_pnt1 (list (cadr (assoc 10 frst_edef)) (caddr (assoc 10 frst_edef)) 0) frst_pnt2 (list (cadr (assoc 10 (entget (entnext (cdr (assoc -1 frst_edef)))))) (caddr (assoc 10 (entget (entnext (cdr (assoc -1 frst_edef)))))) 0 ) ;_ end of list ) ;_ end of setq ) ;_ end of progn (progn (if (not (equal (cdr (assoc 0 frst_edef)) "LINE")) (progn (princ "\nFirst entity not a polyline or line!") (setq abort_attarc T)) (setq frst_pnt1 (list (cadr (assoc 10 frst_edef)) (caddr (assoc 10 frst_edef)) 0) frst_pnt2 (list (cadr (assoc 11 frst_edef)) (caddr (assoc 11 frst_edef)) 0) ) ;_ end of setq ) ;_ end of if ) ;_ end of progn ) ;_ end of if (if (eq (cdr (assoc 0 scnd_edef)) "VERTEX") (progn (while (not (equal (cdr (assoc 0 scnd_edef)) "SEQEND")) (setq scnd_edef (entget (entnext (cdr (assoc -1 scnd_edef))))) ) ;_ end of while (setq scnd_edef (entget (entnext (cdr (assoc -2 scnd_edef))))) (while (not (equal scnd_edef scnd_sav)) (setq scnd_edef (entget (entnext (cdr (assoc -1 scnd_edef))))) ) ;_ end of while (setq scnd_pnt1 (list (cadr (assoc 10 scnd_edef)) (caddr (assoc 10 scnd_edef)) 0) scnd_pnt2 (list (cadr (assoc 10 (entget (entnext (cdr (assoc -1 scnd_edef)))))) (caddr (assoc 10 (entget (entnext (cdr (assoc -1 scnd_edef)))))) 0 ) ;_ end of list ) ;_ end of setq ) ;_ end of progn (progn (if (not (equal (cdr (assoc 0 scnd_edef)) "LINE")) (progn (princ "\nSecond entity not polyline or line!") (setq abort_attarc T)) (setq scnd_pnt1 (list (cadr (assoc 10 scnd_edef)) (caddr (assoc 10 scnd_edef)) 0) scnd_pnt2 (list (cadr (assoc 11 scnd_edef)) (caddr (assoc 11 scnd_edef)) 0) ) ;_ end of setq ) ;_ end of if ) ;_ end of progn ) ;_ end of if (cond (abort_attarc (setq abort_arc nil)) ((or (eq (angle frst_pnt1 frst_pnt2) (angle scnd_pnt1 scnd_pnt2)) (eq (angle frst_pnt1 frst_pnt2) (angle scnd_pnt2 scnd_pnt1)) ) ;_ end of or (princ "\nSegments are parallel! ") ) (T (setq tarc_rad (ureal 1 "" "\nRadius for tangent arc? " tarc_rad)) (setq vrtx_pnt (inters frst_pnt1 frst_pnt2 scnd_pnt1 scnd_pnt2 nil)) (setq frst_pkpnt (inters (cadr frst_tan)(polar(cadr frst_tan)(+(angle frst_pnt1 frst_pnt2)(/ pi 2.0))tarc_rad)frst_pnt1 frst_pnt2 nil)) (setq frst_clpt1 (polar frst_pkpnt (+(angle frst_pnt1 frst_pnt2)(* pi 0.5))tarc_rad)) (setq frst_clpt2 (polar frst_pkpnt (+(angle frst_pnt1 frst_pnt2)(* pi 1.5))tarc_rad)) (IF (<(distance frst_clpt1 (cadr frst_tan))(distance frst_clpt2 (cadr frst_tan))) (setq frst_clpt frst_clpt1) (setq frst_clpt frst_clpt2) ) (setq scnd_pkpnt (inters (cadr scnd_tan)(polar(cadr scnd_tan)(+(angle scnd_pnt1 scnd_pnt2)(/ pi 2.0))tarc_rad)scnd_pnt1 scnd_pnt2 nil)) (setq scnd_clpt1 (polar scnd_pkpnt (+(angle scnd_pnt1 scnd_pnt2)(* pi 0.5))tarc_rad)) (setq scnd_clpt2 (polar scnd_pkpnt (+(angle scnd_pnt1 scnd_pnt2)(* pi 1.5))tarc_rad)) (IF (<(distance scnd_clpt1 (cadr scnd_tan))(distance scnd_clpt2 (cadr scnd_tan))) (setq scnd_clpt scnd_clpt1) (setq scnd_clpt scnd_clpt2) ) (setq cntr_pnt (inters frst_clpt (polar frst_clpt (angle frst_pnt1 frst_pnt2) tarc_rad) scnd_clpt (polar scnd_clpt (angle scnd_pnt1 scnd_pnt2) tarc_rad) nil)) (setq frst_pnt0 (inters frst_pnt1 frst_pnt2 cntr_pnt (polar cntr_pnt (+(angle frst_pnt1 frst_pnt2)(* pi 0.5)) tarc_rad)nil)) (setq scnd_pnt0 (inters scnd_pnt1 scnd_pnt2 cntr_pnt (polar cntr_pnt (+(angle scnd_pnt1 scnd_pnt2)(* pi 0.5)) tarc_rad)nil)) (command "arc" "c" cntr_pnt frst_pnt0 scnd_pnt0) (command "arc" "c" cntr_pnt scnd_pnt0 frst_pnt0) ;;; (cond ((and (eq vrtx_pnt frst_pnt1) (eq vrtx_pnt scnd_pnt1)) ;;; (setq ang_tend1 (- (angle vrtx_pnt frst_pnt2) (angle vrtx_pnt scnd_pnt2))) ;;; ) ;;; ((and (eq vrtx_pnt frst_pnt1) (eq vrtx_pnt scnd_pnt2)) ;;; (setq ang_tend2 (- (angle vrtx_pnt frst_pnt2) (angle vrtx_pnt scnd_pnt1))) ;;; ) ;;; ((and (eq vrtx_pnt frst_pnt2) (eq vrtx_pnt scnd_pnt2)) ;;; (setq ang_tend3 (- (angle vrtx_pnt frst_pnt1) (angle vrtx_pnt scnd_pnt1))) ;;; ) ;;; ((and (eq vrtx_pnt frst_pnt2) (eq vrtx_pnt scnd_pnt1)) ;;; (setq ang_tend4 (- (angle vrtx_pnt frst_pnt1) (angle vrtx_pnt scnd_pnt2))) ;;; ) ;;; (T (setq ang_tend (- (angle vrtx_pnt frst_pnt1) (angle vrtx_pnt scnd_pnt1)))) ;;; ) ;_ end of cond ;;; (cond ((> ang_tend pi) (setq ang_tend (- (* 2 pi) ang_tend))) ;;; ((< ang_tend (- 0 pi)) (setq ang_tend (+ (* 2 pi) ang_tend))) ;;; ) ;_ end of cond ;;; (setq cntr_dis (/ tarc_rad (sin (/ (abs ang_tend1) 2.0000)))) ;;; (tpntcalc) ;;; (setq cntr_dis (/ tarc_rad (sin (/ (abs ang_tend2) 2.0000)))) ;;; (tpntcalc) ;;; (setq cntr_dis (/ tarc_rad (sin (/ (abs ang_tend3) 2.0000)))) ;;; (tpntcalc) ;;; (setq cntr_dis (/ tarc_rad (sin (/ (abs ang_tend4) 2.0000)))) ;;; (tpntcalc) ) ) ;_ end of cond (setq *error* old_ttarcerror) (setvar "osmode" old_osmodes) (princ) ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 0 nil nil nil nil T) ;*** DO NOT add text below the comment! ***|;