8
37
30
初来乍到
;;By Andrea Andreetti 2008-11-27 ;;;; ;;;; D U C T A T T A C H ;;;; Takeoff Disttance 100 ;;;; ;; ;;(princ "\nDuctAttach v.1.0 By: Andrea Andreetti")(vl-load-com)(defun c:DuctAttach (/ Ent_10 Ent_11 Ent_62 Ent_0 Inter_L1 Inter_L2 entData Basepoint1 Basepoint2 Dduct grjp1 grjp2 ficp1 ficp2 ficpX #DCswitch Dway1 Dway2 Dway3 Dway4 ArcEnt dr_sel1 dr_sel2 SLi_0 VLA_line1 VLA_line1_start VLA_line1_end ArcEntLIST VLA_line2 VLA_line2_start VLA_line2_end 4po GEN_clayercolor Input entData arcX arcY newLine 1_sp 1_sp 3_sp 4_sp)(setq ArcEnt nil) ;; Degre Conversion ;; ;;(defun dtr (a) (* pi (/ a 180.0)))(defun rtd (a)(/ (* a 180) pi)) ;;;; Degre Conversion ;; (DCclean)(if (not #DCswitch)(setq #DCswitch 0)) (setq dr_sel1 nil dr_sel2 nil) (while (or (= dr_sel1 nil) (/= (cdr (assoc 0 (setq dr_sel1data (entget (car dr_sel1))))) "LINE") )(setq dr_sel1 (entsel "\nSelect the Branch Duct Lines")))(while (or (= dr_sel2 nil) (/= (cdr (assoc 0 (setq dr_sel2data (entget (car dr_sel2))))) "LINE") )(setq dr_sel2 (entsel "\nSelect the Branch Duct Lines"))) (if (and dr_sel1 dr_sel2) (progn(setq SLi_0 (cdr (assoc 8 (entget (car dr_sel1)))))(setq VLA_line1 (vlax-ename->vla-object (car dr_sel1)))(setq VLA_line1_start (vlax-get VLA_line1 'startpoint))(setq VLA_line1_end (vlax-get VLA_line1 'endpoint))(setq VLA_line2 (vlax-ename->vla-object (car dr_sel2)))(setq VLA_line2_start (vlax-get VLA_line2 'startpoint))(setq VLA_line2_end (vlax-get VLA_line2 'endpoint)) (if (< (getvar "LUNITS") 3) (setq 4po 100) (setq 4po 4))(setq GEN_clayercolor (cdr (assoc 62 (entget (tblobjname "layer" (getvar "clayer")))))) (defun *error* (msg) (DCclean)(if VLA_line0 (progn (vlax-release-object VLA_line0)(setq VLA_line0 nil))) (if VLA_line1 (progn (vlax-release-object VLA_line1)(setq VLA_line1 nil)))(if Nline (progn (vlax-release-object Nline)(setq Nline nil)))(if Sline (progn (vlax-release-object Sline)(setq Sline nil))) (princ msg) ) (while (and (setq Input (grread T 4 4)) (or (= (car Input) 5) (and (= (car Input) 2) (= (cadr Input) 9) ) ) ) ;;SWITCH MODE ;; ;;(if (and (= (car Input) 2) (= (cadr Input) 9) ) (progn(setq Input (grread T 4 4))(if (> #DCswitch 5) (setq #DCswitch 0) (setq #DCswitch (1+ #DCswitch)))(progn (if (eq #DCswitch 0) (princ "\n- Switched to Square/Square excentric connection -")) (if (eq #DCswitch 1) (princ "\n- Switched to Square/Square Straight connection -")) (if (eq #DCswitch 2) (princ "\n- Switched to Square/Square Concentric connection -")) (if (eq #DCswitch 3) (princ "\n- Switched to Round/Square Concentric connection -")) (if (eq #DCswitch 4) (princ "\n- Switched to Round/Round Concentric connection -")) (if (eq #DCswitch 4) (princ "\n- Switched to Round/Round Straight connection -")))))(DCswitch) ;;;;SWITCH MODE ;;)))(DCclean)(if (eq (car Input) 3)