;Draws Handrail - pline outline and non-plot pline w/width inside ;for hiding lines ; ; AUTHOR: HENRY C. FRANCIS ; 425 N. ASHE ST. ; SOUTHERN PINES, NC 28387 ; ; All rights reserved without prejudice. ; Copyright: 8-22-96 ; Edited: 8-22-96 ; (defun c:hrail ( / step lpl_lst rpl_lst) (setq end_cond (ukword 1 "First Last Both None" "Round ends " (if end_cond end_cond "Both"))) (setvar"PLINEWID"0) (cond ((eq end_cond "First") (setq arc_end1 T arc_end2 nil)) ((eq end_cond "Last") (setq arc_end1 nil arc_end2 T)) ((eq end_cond "Both") (setq arc_end1 T arc_end2 T)) ((eq end_cond "None") (setq arc_end1 nil arc_end2 nil)) );cond (setq hr_lp_lst nil hr_rp_lst nil prv_hr_pnt nil hr_pnt nil nxt_hr_pnt nil hr_pnt_lst nil ppnt_l nil ppnt_r nil) (setq rail_qrad (/(ureal 0 "" "Handrail O.D.: " (if rail_qrad (* rail_qrad 4.000)1.9))4.000)) (while (setq nxt_hr_pnt (upoint 0 "" "Pick handrail points" nil (if nxt_hr_pnt nxt_hr_pnt))) (setq hr_pnt_lst (if hr_pnt_lst (append hr_pnt_lst (list(list(car nxt_hr_pnt)(cadr nxt_hr_pnt)(getvar"elevation")))) (list(list(car nxt_hr_pnt)(cadr nxt_hr_pnt)(getvar"elevation"))) );if last_hr_pnt nxt_hr_pnt ntl_hr_pnt hr_pnt );setq (if hr_pnt ;if this is not the first point then construct offset points (if prv_hr_pnt ;if 2nd vector or greater then intersect 1st, 2nd vectors for corner pts (progn (setq ppnt_l (if (or (eq(angle prv_hr_pnt hr_pnt)(angle hr_pnt nxt_hr_pnt)) (eq(angle hr_pnt prv_hr_pnt)(angle hr_pnt nxt_hr_pnt)) ) (polar hr_pnt (+(angle hr_pnt nxt_hr_pnt)(/ pi 2.000))rail_qrad) (inters ppnt_l (polar ppnt_l (angle prv_hr_pnt hr_pnt)12) hr_pnt (polar hr_pnt (+(angle hr_pnt nxt_hr_pnt) (if (minusp (- (angle hr_pnt nxt_hr_pnt) (angle prv_hr_pnt hr_pnt) ) ) pi 0 );if (* (/ (- pi (abs (- (angle hr_pnt nxt_hr_pnt) (angle prv_hr_pnt hr_pnt) ) ) ) 2.000 ) (if (minusp (- (angle hr_pnt nxt_hr_pnt) (angle prv_hr_pnt hr_pnt) ) ) -1 1 );if );* );+ 12 );polar nil );inters );if ppnt_r (if (or (eq(angle prv_hr_pnt hr_pnt)(angle hr_pnt nxt_hr_pnt)) (eq(angle hr_pnt prv_hr_pnt)(angle hr_pnt nxt_hr_pnt)) ) (polar hr_pnt (-(angle hr_pnt nxt_hr_pnt)(/ pi 2.000))rail_qrad) (inters ppnt_r (polar ppnt_r (angle prv_hr_pnt hr_pnt)12) hr_pnt (polar hr_pnt (+(angle hr_pnt nxt_hr_pnt) (if (minusp (- (angle hr_pnt nxt_hr_pnt) (angle prv_hr_pnt hr_pnt) ) ) 0 pi );if (* (/ (- pi (abs (- (angle hr_pnt nxt_hr_pnt) (angle prv_hr_pnt hr_pnt) ) ) ) 2.000 ) (if (minusp (- (angle hr_pnt nxt_hr_pnt) (angle prv_hr_pnt hr_pnt) ) ) -1 1 );if );* );+ 12 );polar nil );inters );if prv_hr_pnt hr_pnt hr_pnt nxt_hr_pnt hr_lp_lst (if hr_lp_lst (append hr_lp_lst (list ppnt_l)) (list ppnt_l) );if hr_rp_lst (if hr_rp_lst (append hr_rp_lst (list ppnt_r)) (list ppnt_r) );if );setq (grdraw prv_hr_pnt hr_pnt 15) );progn ;otherwise construct square corner pts (progn (setq ppnt_l (polar hr_pnt (+(angle hr_pnt nxt_hr_pnt)(/ pi 2.000))rail_qrad) off_lp (polar hr_pnt (+(angle hr_pnt nxt_hr_pnt)(/ pi 2.000))(* rail_qrad 2)) ppnt_r (polar hr_pnt (-(angle hr_pnt nxt_hr_pnt)(/ pi 2.000))rail_qrad) off_rp (polar hr_pnt (-(angle hr_pnt nxt_hr_pnt)(/ pi 2.000))(* rail_qrad 2)) prv_hr_pnt hr_pnt hr_pnt nxt_hr_pnt hr_lp_lst (if hr_lp_lst (append hr_lp_lst (list ppnt_l)) (list ppnt_l) );if hr_rp_lst (if hr_rp_lst (append hr_rp_lst (list ppnt_r)) (list ppnt_r) );if );setq (grdraw prv_hr_pnt hr_pnt 15) );progn );if (setq hr_pnt nxt_hr_pnt) );if );while (c:svlayr) (setq count (length hr_lp_lst) step 0 ppnt_l (polar last_hr_pnt (+(angle ntl_hr_pnt last_hr_pnt)(/ pi 2.000))rail_qrad) ecor_lp (polar last_hr_pnt (+(angle ntl_hr_pnt last_hr_pnt)(/ pi 2.000))(* rail_qrad 2)) ppnt_r (polar last_hr_pnt (-(angle ntl_hr_pnt last_hr_pnt)(/ pi 2.000))rail_qrad) ecor_rp (polar last_hr_pnt (-(angle ntl_hr_pnt last_hr_pnt)(/ pi 2.000))(* rail_qrad 2)) hr_lp_lst (append hr_lp_lst (list ppnt_l)) hr_rp_lst (append hr_rp_lst (list ppnt_r)) mjrg "M" llt "-" prod "WALK" colra "F" colri "15" colr nil modf "NPLT" );setq (c:mklayr) (entmake (list (cons 0 "POLYLINE") (cons 10 (nth 0 hr_lp_lst)) (cons 40 (* rail_qrad 2)) (cons 41 (* rail_qrad 2)) (cons 66 1) ) ) (while(not(> step count)) (entmake (list (cons 0 "VERTEX") (cons 10 (nth step hr_lp_lst)) ) ) (setq step(1+ step)) );while (entmake (list (cons 0 "SEQEND") ) ) (setq left_pl (entlast)) (command "_fillet" "r" rail_qrad "") (command "_fillet" "p" left_pl) (command "_offset" rail_qrad left_pl off_lp off_lp "") (setq this_pl (entlast)) (setq step 0) (entmake (list (cons 0 "POLYLINE") (cons 10 (nth 0 hr_rp_lst)) (cons 40 (* rail_qrad 2)) (cons 41 (* rail_qrad 2)) (cons 66 1) ) ) (while(not(> step count)) (entmake (list (cons 0 "VERTEX") (cons 10 (nth step hr_rp_lst)) ) ) (setq step(1+ step)) );while (entmake (list (cons 0 "SEQEND") ) ) (setq right_pl (entlast)) (command "_fillet" "r" rail_qrad "") (command "_fillet" "p" right_pl) (command "_offset" rail_qrad right_pl off_rp off_rp "") (setq that_pl (entlast)) (setq ss_outl (ssadd)) (if arc_end1 (progn (command "_arc" "c" (nth 0 hr_pnt_lst) off_lp off_rp) (setq ss_outl (ssadd (entlast) ss_outl)) (command "_arc" "c" (nth 0 hr_pnt_lst)(nth 0 hr_lp_lst)(nth 0 hr_rp_lst)) (setq ss_hsend (ssadd) ss_hsend (ssadd (entlast) ss_hsend) );setq );progn (progn (command "_line" off_lp off_rp "") (setq ss_outl (ssadd (entlast) ss_outl)) );progn );if (if arc_end2 (progn (command "_arc" "c" last_hr_pnt ecor_rp ecor_lp) (setq ss_outl (ssadd (entlast) ss_outl)) (command "_arc" "c" (nth count hr_pnt_lst)(nth count hr_rp_lst)(nth count hr_lp_lst)) (setq ss_hsend (ssadd (entlast) ss_hsend)) );progn (progn (command "_line" ecor_lp ecor_rp "") (setq ss_outl (ssadd (entlast) ss_outl)) );progn ) (command "_pedit" this_pl "j" that_pl ss_outl "" "w" 0 "") (setq ss_outl (ssadd (entlast))) (command "_pedit" left_pl "j" right_pl ss_hsend "" "") (setq ss_hsend (ssadd (entlast))) (command "_layer" "m" "M-WALK6RAIL" "c" "6" "" "") (command "_change" ss_hsend "" "P" "E" (-(caddr off_lp)(* rail_qrad 4)) "") (command "_change" ss_outl "" "P" "LAYER" "M-WALK6RAIL" "") (c:rslayr) (c:sof) );defun