2
15
13
初来乍到
使用道具 举报
106
1万
101
顶梁支柱
;; Sets the initiating command to "TEST"(defun C:TEST();; Sets the pre-defined values for blow-off(setq d 0.0211)(setq F 0.63)(setq T 1878);; Sets the variables for blow-off(setq Vw (getreal "\n Enter the Windspeed (m/s):"))(setq L (getreal "\n Enter the Span-length (m):"));; Calculates the Blow-off in (m)(setq multiply1 (* (* Vw Vw) (* L L)))(setq multiply2 (* d F))(setq BLOWOFFm1 (* multiply1 multiply2))(setq BLOWOFFm (/ BLOWOFFm1 (* 8 T)));; Sets pre-defined values for sag(setq V 7.159)(setq t 1878);; Sets the variables for sag(setq S (getreal "\n Enter the height at the start of the span (m):"))(setq E (getreal "\n Enter the height at the end of the span (m):"))(setq As L);; Calculates position of low point in span(setq P (- (/ As 2) (* t (/ (- E S) (* V As)))));; Calculates the wire sag (m)(setq sag1 (/ (* V (EXPT P 2.0)) (* 2 t)));; Converts wire sag into (cm)(setq sag (* sag1 100));; Converts BLOWOFFm onto (cm)(setq BLOWOFFcm (* BLOWOFFm 100));; Asks the user to select the original wire location(setq originalwire (getpoint "\n Select the original wire location:"));; Sets temporary points for blow-off(setq temp1 (polar originalwire 4.7123889803846898576939650749193 sag));; Draws clearance circle for originalwire(command "_CIRCLE" originalwire (/ d 2));; Creates points for arc based on blowoff and sag(setq arcpointmiddle (polar temp1 1.5707963267948966192313216916398 BLOWOFFcm))(setq arcpointright (polar arcpointmiddle 0.0 BLOWOFFcm))(setq arcpointleft (polar arcpointmiddle 3.1415926535897932384626433832795 BLOWOFFcm));; Linetype load(defun ltype_set (ltname)(if (not (tblsearch "LTYPE" ltname)) ;; Check to see if the linetype exists(if (findfile "acad.lin")(command "._LINETYPE" "._LOAD" ltname "acad.lin" "") ;; Load the linetype if it is found(setq ltname "Continuous") ;; If not, set the linetype to Continuous)));; Creates a new layer for the clearnace to be placed on after checking if the layer already exists(defun layer_set (lyr col ltname)(if (tblsearch "LAYER" lyr) ;; Check to see if the layer exists(command "._LAYER" "_THAW" lyr "_UNLOCK" lyr "_ON" lyr "_SET" lyr "") ;; If layer exists, set it current;; If the layer doesn't exist, make this layer(if (tblsearch "LTYPE" ltname) ;; If linetype doesn't exist(command "._LAYER" "_MAKE" lyr "_COLOUR" col lyr "_LT" ltname lyr "")(command "._LAYER" "_MAKE" lyr "_COLOUR" col lyr "_LT" "Continuous" lyr ""))));; Draws arc from arcpointright to arcpointleft through arcpointmiddle on the new layer(layer_set "Continuous" "50" "DASHDOT")(command "._CIRCLE" originalwire sag);(command "._ARC" arcpointleft arcpointmiddle arcpointright);; Reset layer back to "0"(layer_set "0" "7" "Continuous");; Draws clearance circles for left, right and middle arcpoints(command "_CIRCLE" temp1 (/ d 2))(command "_CIRCLE" arcpointleft (/ d 2))(command "_CIRCLE" arcpointright (/ d 2));; Draws lines for trim(setq line1 (polar arcpointleft 4.7123889803846898576939650749193 BLOWOFFcm))(command "._LINE" arcpointleft line1 "")(setq line2 (polar arcpointright 4.7123889803846898576939650749193 BLOWOFFcm))(command "._LINE" arcpointright line2 "")