; GLINE.LSP [Article Figure 2] (c)1990, Barry Bowen ; ------------------------ GLINE ------------------------------ (defun GLINE (/ EN ELIST) (E1 "Select Line: ") (if (not EN) (E1A) (E2)) (while (/= (E4 0 ELIST) "LINE") (prompt "\nEntity Selected is not a Line!") (E1 "Select Line: ") (if (not EN) (E1A) (E2)) ) ;End While (E3 'PT1 10) (E3 'PT1A 11) (setq BPT PT1 PT2 PT1A) (SUP1) (SUP2) ) ; -------------------------- E1A ------------------------------ (defun E1A () (while (not EN) (prompt "\nNo Line Selected-Try Again") (E1 "Select Line: ")) ) ; ------------------------- SUP1 ------------------------------ (defun SUP1 () (setq ANS (getstring "\nSuppress First Ext. Line? : ")) (if (/= ANS "") (setvar "dimse1" 1) (setvar "dimse1" 0) ) ) ; ------------------------- SUP2 ------------------------------ (defun SUP2 () (setq ANS (getstring "\nSuppress Second Ext. Line? : ")) (if (/= ANS "") (setvar "dimse2" 1) (setvar "dimse2" 0) ) ) ; ------------------------ PLOCATE ---------------------------- (defun PLOCATE () (setq PT1B (polar PT1 ANG1 1) PT2A (polar PT1C ANG2 1) PT2 (inters PT1 PT1B PT1C PT2A nil)) ) ; ------------------------ P3LOCATE --------------------------- (defun P3LOCATE () (setq PT1G (polar BPT ANG2 1) PT3A (polar PT3 ANG1 1) PT13 (inters BPT PT1G PT3 PT3A nil)) ) ; ------------------------ NEWLINE ---------------------------- (defun NEWLINE () (setq ANG (angle PT13 BPT) DDIS (* (getvar "dimscale") 0.40) PT3 (polar PT13 ANG DDIS)) ) FIGURE 3 ; ------------------------ DIMSTR ----------------------------- (defun DIMSTR () (setq DIST (rtos (distance PT1 PT2) (getvar "lunits") (getvar "luprec")) ACDIST (getstring T (strcat "\nDimension Text <" DIST ">: "))) (if (= ACDIST "") (STR) ;True (progn (setq DIST ACDIST) ;False (STR) ) ) ) ; ---------------------- NEWSTRING ---------------------------- (defun NEWSTRING () (command "color" "7") (setq EN (entlast)) (E2) (E3 'MPT 10) (entdel EN) (command "text" "c" MPT (angtos ANG1) ACDIST) (setq ANS (getstring "\nDimension Text Below : ")) (if (/= ANS "") (progn (RLOC) (setq MPT (polar MPT (+ pi ANG2) (* (getvar "dimscale") 0.25))) (setq LINE (getstring T "\nText: ")) (command "text" "c" MPT (angtos ANG1) LINE) ) ;End Progn ) ;End If (command "color" "bylayer" "undo" "end") ) ; -------------------------- STR ------------------------------ (defun STR (/ LGTH TSTR CH SLGTH NDIM1) (setq LGTH 1 TSTR (strlen DIST) CH (substr DIST LGTH 1)) (while (and (/= CH " ") (/= CH "")) (setq LGTH (1+ LGTH) CH (substr DIST LGTH 1)) ) ;End While (if (= CH "") (setq ACDIST DIST) (progn (setq SLGTH (- (- tstr LGTH) 1) NDIM (substr DIST 1 (1- LGTH)) NDIM1 (substr DIST (1+ LGTH) SLGTH)) (cond ((= NDIM1 "1/16") (DIMTX "%%201")) ((= NDIM1 "1/8") (DIMTX "%%202")) ((= NDIM1 "3/16") (DIMTX "%%203")) ((= NDIM1 "1/4") (DIMTX "%%204")) ((= NDIM1 "5/16") (DIMTX "%%205")) ((= NDIM1 "3/8") (DIMTX "%%206")) ((= NDIM1 "7/16") (DIMTX "%%207")) ((= NDIM1 "1/2") (DIMTX "%%208")) ((= NDIM1 "9/16") (DIMTX "%%209")) ((= NDIM1 "5/8") (DIMTX "%%210")) ((= NDIM1 "11/16") (DIMTX "%%211")) ((= NDIM1 "3/4") (DIMTX "%%212")) ((= NDIM1 "13/16") (DIMTX "%%213")) ((= NDIM1 "7/8") (DIMTX "%%214")) ((= NDIM1 "15/16") (DIMTX "%%215")) ) ;End Cond )) ;End If, Progn ) ; ------------------------- DIMTX ----------------------------- (defun DIMTX (FRAC) (setq ACDIST (strcat NDIM FRAC (chr 34)))) ; -------------------------- RLOC ----------------------------- (defun RLOC () (if (< (distance PT1 PT2) 48.0) (progn (setq ANS (getstring "\nRelocate Dimension Text? ")) (if (/= ANS "") (progn (command "move" (entlast) "" MPT pause) (setq ANS (getstring "\nAdd Arc : ")) (if (= ANS "") (progn (command "arc" MPT) (prompt "\nMid-point of Arc: ") (command pause) (prompt "\nArc End-point: ") (command pause) ) ) ) ) )))