4
11
7
初来乍到
;;;CADALYST 03/06 Tip2096: sectionline.lsp Section Line (c) Wm. J. Townsend;;; SECTIONLINE.LSP - January ©2006 - Wm.J.Townsend;;;;;; Three styles of section lines each with optional annotation or;;; section/grid/page markers. Optional "SECTION X-X" tag too.;;;;;; Makes a new SectionLine layer and is based on your DIMSCALE setting.;;;;;; SE1 is the old standard dashed lines and arrowheads.;;;;;; SE2 is a modified ISO style. Pick two points to control the;;; direction of the view.;;;;;; SE3 is a free form ziggity-zaggity section line. Pick a bunch;;; of points to form the cut, and then select the viewing angle.;;; Common file settings(defun *pmd_err* (msg)(if (or (/= msg "\nFunction canceled. ")(= msg "\nQuit / Exit Abort. "))(princ)(princ (strcat "\nError: " msg)))(setq *error* *err_old* *err_old* nil)(layerback)(princ));;;(defun dtr (a) (* pi (/ a 180.0)));;;(defun selayer ()(setvar "cmdecho" 0)(setq *err_old* *error* *error* *pmd_err*)(command "undo" "mark")(if (= 0 (getvar "measurement"))(setq dist 0.25))(if (= 1 (getvar "measurement"))(setq dist 6.0))(setq tt1 nil)(setq tm1 nil)(setq tm2 nil)(setq tm3 nil)(setq msg5 nil)(setq osm (getvar "osmode")otm (getvar "orthomode")olm (getvar "clayer")dsc (getvar "dimtxt")dsz (getvar "dimscale")tsz (getvar "textsize")tsm (tblsearch "layer" "SectionLine"))(if (null tsm)(progn(prompt "\nCreating SectionLine Layer...\n")(command "-layer" "m" "SectionLine" "lt" "dashed" "SectionLine" "c" "230" "SectionLine" "")))(command "-layer" "s" "SectionLine" "")(setvar "osmode" 0)(setvar "orthomode" 0)(princ));;;(defun layerback ()(setq *error* *err_old* *err_old* nil)(command)(command)(setvar "osmode" osm)(setvar "orthomode" otm)(setvar "dimscale" dsz)(command "-layer" "s" olm "")(princ));;;(defun c:dfix ()(layerback)(princ));;; Draws the directional leaders and places the view labels.(defun pointers ()(setvar "dimscale" 2.0)(command "leader" pt1 pt6 "" "" "n")(command "change" "l" "" "p" "lt" "continuous" "")(command "leader" pt2 pt7 "" "" "n")(command "change" "l" "" "p" "lt" "continuous" "")(command "text" "mc" pt8 (* dsc 1.5) 0 tt1)(command "text" "mc" pt9 (* dsc 1.5) 0 tt1)(setvar "dimscale" dsz));;; Adds optional annotation, or SECTION (GRID/PAGE) identification;;; next to the cut line.(defun section_grid_page ()(setq tm1 (getstring T "\nEnter SectionLine Identification, or Annotation <none>: ")tm2 (getstring "\nEnter Page Number <none>: ")tm3 (getstring "\nEnter Grid Coordinate <none>: ")msg1 (strcase tm1)msg2 (strcase (strcat tm1 " (" tm2 ")"))msg3 (strcase (strcat tm1 " (" tm3 "/" tm2 ")")))(setq msg5 msg3)(progn(cond((/= tm3 "")(setq msg5 msg3))((/= tm2 "")(setq msg5 msg2))((= tm2 "")(setq msg5 msg1)))(command "text" "ml" pt10 dsc 0 msg5)));;; Draws the optional "SECTION X - X" tag.(defun view_label ()(setq choice (getstring "\nDo you wish to add a SectionLine View label? Yes/<No>: "))(setq msg4 (strcase (strcat "%%uSECTION "tt1" - "tt1"%%u")))(if (or (= 89 (ascii choice))(= 121 (ascii choice)))(progn(setq pt12 (getpoint "\nPick a point for the SectionLine Reference label: "))(command "text" "mc" pt12 dsc 0 msg4))(princ)));;; 4 Point basic section line.(defun c:se1 ()(selayer)(setq tt1 (strcase (getstring "\nEnter SectionLine Identifier: "))pt1 (getpoint "\nPick SectionLine start point: ")pt2 (getpoint pt1 "\nPick next corner: ")pt3 (getpoint pt2 "\nPick next corner: ")pt4 (getpoint pt3 "\nPick SectionLine end point:")rang (angle pt2 pt1)eang (angle pt3 pt4)pt5 (polar pt1 rang (* dsc 1.25))pt6 (polar pt4 eang (* dsc 1.25)))(progn(setvar "dimscale" 2.0)(command "dim1" "leader" pt1 pt2 ^c ^c)(command "erase" "l" "")(command "dim1" "leader" pt4 pt3 ^c ^c)(command "erase" "l" "")(command "pline" pt1 pt2 pt3 pt4 "")(command "text" "m" pt5 (* dsc 1.5) "0" tt1)(command "text" "m" pt6 (* dsc 1.5) "0" tt1)