Diedesigner Posted February 9, 2011 Posted February 9, 2011 Hi all, I tried this lisp file out and it works fine, except that it draws the same height arrows and text no matter my dimscale setting. I tried playing with the variables and got the arrow & line scales to adjust, but nothing seems to work for the text height. I'm not a great lisp guy; can anyone show me how to modify it to get the lisp to draw according to the dimscale setting? ;;;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) Quote
Freerefill Posted February 10, 2011 Posted February 10, 2011 Just a guess, try removing the line: (setvar "dimscale" 2.0) Or anything else that sets the dimscale to anything you don't want it to be. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.