剖面线。lsp不';t r
大家好,我尝试了这个lisp文件,它工作得很好,只是无论我的dimscale设置如何,它都绘制相同的高度箭头和文本。我试着玩变量,并得到箭头和线的比例来调整,但似乎没有任何工作的文字高度。我不是一个Lisp程序的人;谁能告诉我如何修改它,使lisp根据dimscale设置绘制?
;;;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)
(setvar "dimscale" dsz))
(setq choice (getstring "\nDo you wish to add a SectionLine Reference label? Yes/<No>: "))
(if (or (= 89 (ascii choice))(= 121 (ascii choice)))
(progn
(setvar "osmode" 39)
(setq pt15 (getpoint "\nPick a point for the SectionLine reference label: ")
pt5 (polar pt15 0 (* dsc 1.5))
pt10 (polar pt5 0 (* dsc 0.5)))
(section_grid_page)
(command "line" pt5 pt15 ""))
(princ))
(view_label)
(layerback)
(princ))
;;; 2 Point directional section line.
(defun c:se2 ()
(selayer)
(setq tt1 (strcase (getstring "\nEnter SectionLine Identifier: "))
pt1 (getpoint "\nPick SectionLine start point: ")
pt2 (getpoint pt1 "\nPick SectionLine end point: ")
ang (angle pt1 pt2)
aang (angle pt2 pt1)
bang (dtr 90)
cang (+ aang bang)
pt3 (polar pt1 aang dist)
pt4 (polar pt2 ang dist)
pt6 (polar pt1 cang (* dsc 4.0))
pt7 (polar pt2 cang (* dsc 4.0))
dang (angle pt1 pt6)
pt8 (polar pt6 dang (* dsc 1.25))
pt9 (polar pt7 dang (* dsc 1.25)))
(if (or (> (dtr 90) ang)(< (dtr 270) ang))
(setq pt5 (polar pt4 0 (* dsc 1.5)))
(setq pt5 (polar pt3 0 (* dsc 1.5))))
(setq pt10 (polar pt5 0 (* dsc 0.5)))
(setq choice (getstring "\nDo you wish to add a SectionLine Reference label? Yes/<No>: "))
(if (or (= 89 (ascii choice))(= 121 (ascii choice)))
(progn
(command "pline" pt3 pt4 "")(command "change" "l" "" "p" "c" "1" "")
(if (or (> (dtr 90) ang)(< (dtr 270) ang))
(command "pline" pt4 pt5 "")
(command "pline" pt3 pt5 ""))
(pointers)
(section_grid_page))
(progn
(command "pline" pt3 pt4 "")(command "change" "l" "" "p" "c" "1" "")
(pointers)))
(view_label)
(layerback)
(princ))
;;; Multi-point freeform section line. Too many variables (for me) to
;;; automate the label position, so you get to select your own.
(defun c:se3 ()
(selayer)
(setq tt1 (strcase (getstring "\nEnter SectionLine Identifier: ")))
(setq pt1 (getpoint"\nPick SectionLine start point: "))
(setq pt2 (getpoint pt1 "\nPick next point: "))
(command "pline" pt1 pt2 "")
(while
(setq pt3 (getpoint pt2"\nPick next point: "))
(command "pline" "" pt3 "")
(command "pedit" pt1 "j" pt2 pt3 "" "")
(setq pt2 pt3))
(command "change" pt1 "" "p" "c" "1" "")
(progn
(command "circle" pt1 dist)
(command "extend" "l" "" pt1 "")
(command "erase" "l" ""))
(progn
(command "circle" pt2 dist)
(command "extend" "l" "" pt2 "")
(command "erase" "l" ""))
(setq pt5 (getpoint pt1 "\nPick a point to select SectionLine view angle: "))
(setq ang (angle pt1 pt5)
aang (angle pt5 pt1)
bang (dtr 90)
cang (+ aang bang)
pt6 (polar pt1 ang (* dsc 4.0))
pt7 (polar pt2 ang (* dsc 4.0))
dang (angle pt1 pt6)
pt8 (polar pt6 dang (* dsc 1.25))
pt9 (polar pt7 dang (* dsc 1.25)))
(pointers)
(setq choice (getstring "\nDo you wish to add a SectionLine Reference label? Yes/<No>: "))
(if (or (= 89 (ascii choice))(= 121 (ascii choice)))
(progn
(setvar "osmode" 39)
(setq pt15 (getpoint "\nPick a point for the SectionLine reference label: "))
(setq pt5 (polar pt15 0 (* dsc 1.5)))
(setq pt10 (polar pt5 0 (* dsc 0.5)))
(section_grid_page)
(command "line" pt5 pt15 ""))
(princ))
(view_label)
(layerback)
(princ))
;;;
(princ "\nC:SE1~SE3, SectionLine utilities loaded.")
(princ)
只是一个猜测,尝试删除该行:
(setvar“dimscale”2.0)
或者将dimscale设置为任何您不希望的值。
页:
[1]