SEGUL Posted April 7, 2009 Posted April 7, 2009 thanks very much Lee Mac there is only one issue with the bearings (xdx'x")...the text for the bearings is been offset from the centre of the dimension....in some case far away from the dimension..... Any idea or solution as to how i can fix this? Look forward to you kind help Quote
Lee Mac Posted April 7, 2009 Posted April 7, 2009 I have added a variable that you can change at the top of the code - underneath the note: ;; ============================================================ ;; ;; ;; ;; PDIM.LSP - This lisp is for dimensioning of several ;; ;; LwPolylines simultaneously. The program works ;; ;; with the current dimensional style. ;; ;; The distance of the dimensional text from a ;; ;; polyline is equal to the height of the ;; ;; dimensional text (DIMTEXT system variable) ;; ;; multiplied by a variable 'tOff'. ;; ;; You can change value of 'tOff' in the ;; ;; program beginning, after the note. ;; ;; ;; ;; ============================================================ ;; ;; ;; ;; Command(s) to call: PDIM ;; ;; ;; ;; Select LwPolylines and press Enter. ;; ;; ;; ;; ============================================================ ;; ;; ;; ;; THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ;; ;; ON ANY MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS ;; ;; PROGRAM OR PARTS OF IT ABSOLUTELY FREE. ;; ;; ;; ;; THIS PROGRAM PROVIDES THIS PROGRAM 'AS IS' WITH ALL FAULTS ;; ;; AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF ;; ;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. ;; ;; ;; ;; ============================================================ ;; ;; ;; ;; V1.2, 9th Okt 2008, Riga, Latvia ;; ;; © Aleksandr Smirnov (ASMI) ;; ;; For AutoCAD 2000 - 2008 (isn't tested in a next versions) ;; ;; ;; ;; http://www.asmitools.com ;; ;; ;; ;; ============================================================ ;; (defun c:pdim (/ tOff bOff plSet pLlst vLst oldDss cAng cDis cPt) ; NOTE ; ; The distance of the text from a LwPolyline line is equal ; of multiplication of system variable 'DIMTXT' (height of ; the dimensional text) on a variable 'tOff'. Change this ; variable to change this distance. (setq tOff 1.0) ;; Dimension Offset (setq bOff 3.0) ;; Bearing Offset (princ "\n<<< Select LwPolyline for dimensioning >>> ") (if (setq plSet (ssget '((0 . "LWPOLYLINE")))) (progn (setq pLlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex plSet))) oldDss (getvar "DIMASSOC")) (setvar "CMDECHO" 0) (command "_.undo" "_be") (setvar "DIMASSOC" 2) (foreach pl pLlst (setq vLst (mapcar '(lambda(x) (trans x 0 1)) (mapcar 'cdr (vl-remove-if-not '(lambda(x) (= 10(car x))) (entget pl))))) (if (equal '(70 . 1) (assoc 70 (entget pl))) (setq vLst (append vLst (list (car vLst))))) (while (< 1 (length vLst)) (setq cAng (angle (car vLst) (cadr vLst)) cDis (/ (distance (car vLst) (cadr vLst)) 2)) (if (>= (caar vLst) (caadr vLst)) (setq cAng (- cAng pi))) (setq cPt (polar (polar (car vLst) cAng cDis) (+ cAng (* 0.5 pi)) (* tOff (getvar "DIMTXT"))) bPt (polar (polar (car vLst) cAng cDis) (+ cAng (* 0.5 pi)) (* bOff (getvar "DIMTXT")))) (command "_.dimaligned" "_end" (car vLst) "_end" (cadr vLst) "_none" cPt) (Make_Text bPt (angtos cAng 1 3) cAng) (setq vLst (cdr vLst)))) (setvar "DIMASSOC" oldDss) (command "_.undo" "_e") (setvar "CMDECHO" 1))) (princ)) (princ "\n*** Type PDIM for multiple LwPolyline dimensioning *** ") (defun Make_Text (pt val rot) (entmake (list '(0 . "TEXT") '(8 . "0") (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) '(71 . 0) '(72 . 1) '(73 . 1) (cons 11 pt)))) Quote
SEGUL Posted April 7, 2009 Posted April 7, 2009 Thank you so much Lee Mac I have one last and final request if its not to much of a hassle.....would you be able to ammend the pdim lisp code to have a bearings only code that auto dims lines. I hope its not to much to ask for..... I must thank you very much for you kind assitance and time in making my work easier and faster through using the lisp commands. Cheers Quote
Lee Mac Posted April 7, 2009 Posted April 7, 2009 No Problem - see below: ;; ============================================================ ;; ;; ;; ;; PDIM.LSP - This lisp is for dimensioning of several ;; ;; LwPolylines simultaneously. The program works ;; ;; with the current dimensional style. ;; ;; The distance of the dimensional text from a ;; ;; polyline is equal to the height of the ;; ;; dimensional text (DIMTEXT system variable) ;; ;; multiplied by a variable 'tOff'. ;; ;; You can change value of 'tOff' in the ;; ;; program beginning, after the note. ;; ;; ;; ;; ============================================================ ;; ;; ;; ;; Command(s) to call: PDIM ;; ;; ;; ;; Select LwPolylines and press Enter. ;; ;; ;; ;; ============================================================ ;; ;; ;; ;; THIS PROGRAM AND PARTS OF IT MAY REPRODUCED BY ANY METHOD ;; ;; ON ANY MEDIUM FOR ANY REASON. YOU CAN USE OR MODIFY THIS ;; ;; PROGRAM OR PARTS OF IT ABSOLUTELY FREE. ;; ;; ;; ;; THIS PROGRAM PROVIDES THIS PROGRAM 'AS IS' WITH ALL FAULTS ;; ;; AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF ;; ;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. ;; ;; ;; ;; ============================================================ ;; ;; ;; ;; V1.2, 9th Okt 2008, Riga, Latvia ;; ;; © Aleksandr Smirnov (ASMI) ;; ;; For AutoCAD 2000 - 2008 (isn't tested in a next versions) ;; ;; ;; ;; http://www.asmitools.com ;; ;; ;; ;; ============================================================ ;; (defun c:pdim (/ tOff bOff Dims Bears plSet pLlst vLst oldDss cAng cDis cPt) ; NOTE ; ; The distance of the text from a LwPolyline line is equal ; of multiplication of system variable 'DIMTXT' (height of ; the dimensional text) on a variable 'tOff'. Change this ; variable to change this distance. (setq tOff 1.0) ;; Dimension Offset (setq bOff 1.0) ;; Bearing Offset (setq Dims nil) ;; Dimensions (T or nil) (setq Bears T) ;; Bearings (T or nil) (princ "\n<<< Select LwPolyline for dimensioning >>> ") (if (setq plSet (ssget '((0 . "LWPOLYLINE")))) (progn (setq pLlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex plSet))) oldDss (getvar "DIMASSOC")) (setvar "CMDECHO" 0) (command "_.undo" "_be") (setvar "DIMASSOC" 2) (foreach pl pLlst (setq vLst (mapcar '(lambda (x) (trans x 0 1)) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget pl))))) (if (equal '(70 . 1) (assoc 70 (entget pl))) (setq vLst (append vLst (list (car vLst))))) (while (< 1 (length vLst)) (setq cAng (angle (car vLst) (cadr vLst)) cDis (/ (distance (car vLst) (cadr vLst)) 2)) (if (>= (caar vLst) (caadr vLst)) (setq cAng (- cAng pi))) (setq cPt (polar (polar (car vLst) cAng cDis) (+ cAng (* 0.5 pi)) (* tOff (getvar "DIMTXT"))) bPt (polar (polar (car vLst) cAng cDis) (+ cAng (* 0.5 pi)) (* bOff (getvar "DIMTXT")))) (if Dims (command "_.dimaligned" "_end" (car vLst) "_end" (cadr vLst) "_none" cPt)) (if Bears (Make_Text bPt (angtos cAng 1 3) cAng)) (setq vLst (cdr vLst)))) (setvar "DIMASSOC" oldDss) (command "_.undo" "_e") (setvar "CMDECHO" 1))) (princ)) (princ "\n*** Type PDIM for multiple LwPolyline dimensioning *** ") (defun Make_Text (pt val rot) (entmake (list '(0 . "TEXT") '(8 . "0") (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) '(71 . 0) '(72 . 1) '(73 . 1) (cons 11 pt)))) Change "Dims" and "Bears" to T or nil for Dims or Bearings.... Quote
Lee Mac Posted April 23, 2009 Posted April 23, 2009 As Requested by PM: ;; Slope Text by Lee McDonnell 23.04.2009 (defun c:slp (/ cEnt cObj tStr tBox tSze tHgt tWid grdat cPt sPt cAng bPt tPt pt1 pt2 pt3 pt4) (vl-load-com) (while (and (setq cEnt (entsel "\nSelect Curve: ")) (member (cdr (assoc 0 (entget (car cEnt)))) '("LINE" "LWPOLYLINE" "POLYLINE" "REGION"))) (setq cObj (vlax-ename->vla-object (car cEnt)) tStr (strcat (rtos (* 100. (sin (angle '(0 0 0) (vlax-curve-getFirstDeriv cObj (vlax-curve-getParamatPoint cObj (vlax-curve-getClosestPointto cObj (cadr cEnt))))))) 2 2) "% Slope") tBox (textbox (list (cons 1 tStr) (cons 40 (setq tSze (getvar 'TEXTSIZE))))) tHgt (- (cadadr tBox) (cadar tBox)) twid (- (caadr tBox) (caar tBox))) (while (= 5 (car (setq grdat (grread t 1)))) (redraw) (if (listp (setq cPt (cadr grdat))) (progn (setq sPt (vlax-curve-getClosestPointto cObj cPt) cAng (angle sPt cPt) bPt (polar sPt cAng tSze) tPt (polar sPt cAng (+ tSze tHgt)) pt1 (polar bpt (+ cAng (/ pi 2)) (/ tWid 2.0)) pt2 (polar bpt (- cAng (/ pi 2)) (/ tWid 2.0)) pt3 (polar tpt (+ cAng (/ pi 2)) (/ tWid 2.0)) pt4 (polar tpt (- cAng (/ pi 2)) (/ tWid 2.0))) (grvecs (list 3 pt1 pt3 3 pt2 pt4 3 pt3 pt4 3 pt1 pt2))))) (setq cAng (+ cAng (/ pi 2))) (cond ((and (> cAng (/ pi 2)) (<= cAng pi)) (setq cAng (- cAng pi))) ((and (> cAng pi) (<= cAng (/ (* 3 pi) 2))) (setq cAng (+ cAng pi)))) (Make_Text bPt tStr cAng) (redraw)) (princ)) (defun Make_Text (pt val rot) (entmake (list '(0 . "TEXT") '(8 . "TEXT") (cons 62 2) (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) '(71 . 0) '(72 . 1) '(73 . 1) (cons 11 pt)))) Quote
SEGUL Posted April 23, 2009 Posted April 23, 2009 Hi Lee Mac I must say that iam very impressed and blown away with the lisp commands that you create, they all work great.....and with many thanks for making my work much more easier and faster.......something that would take me hours doing only takes me minutes....and all thanks to you and all the lisp gurus on this forum.....you have all inspired me to learn more about lisp....and hopefully oneday be able to help others too. I kindly would like to ask if you could amend the slope lisp to do the following: 1. has a multiple line selection option similar to the pdm.lsp 2. all text centred on each line (for single lines and polylines) Hope it’s not too much to ask for? Many thanks Quote
Lee Mac Posted April 24, 2009 Posted April 24, 2009 I must say that iam very impressed and blown away with the lisp commands that you create, they all work great.....and with many thanks for making my work much more easier and faster.......something that would take me hours doing only takes me minutes....and all thanks to you and all the lisp gurus on this forum.....you have all inspired me to learn more about lisp....and hopefully oneday be able to help others too. Thanks for your kind words - its nice to know that the programs are saving time and our work is appreciated. 1. has a multiple line selection option similar to the pdm.lsp This can be achieved, but would tie into the next question: 2. all text centred on each line (for single lines and polylines) I take it you would like the user text placement removed and just have the text on the midpoint of either the line or edge of the polyline? Hope it’s not too much to ask for? We shall see :wink: Quote
Lee Mac Posted April 24, 2009 Posted April 24, 2009 Try this, but will only work with lines: [i][color=#990099];; Slope Text by Lee McDonnell 23.04.2009[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:slp [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ss tStr cAng mPt[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#ff00ff]"LINE"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CTAB"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]410[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"CTAB"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]67[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]-[/color][/b] [b][color=#009900]1[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"TILEMODE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]foreach[/color][/b] cObj [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-remove-if[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]listp[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]mapcar[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=BLUE]cadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]ssnamex[/color][/b] ss[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tStr [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]rtos[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]*[/color][/b] [b][color=#009999]100.[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]sin[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] cAng [b][color=RED]([/color][/b][b][color=BLUE]angle[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] [b][color=#009900]0[/color][/b] [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getFirstDeriv[/color][/b] cObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getParamatPoint[/color][/b] cObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getStartPoint[/color][/b] cObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#009900]2[/color][/b] [b][color=#009900]2[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"% Slope"[/color][/b][b][color=RED])[/color][/b] mPt [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getPointatDist[/color][/b] cObj [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]distance[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getStartPoint[/color][/b] cObj[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getEndPoint[/color][/b] cObj[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#009999]2.0[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]>[/color][/b] cAng [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] pi [b][color=#009900]2[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]<=[/color][/b] cAng pi[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] cAng [b][color=RED]([/color][/b][b][color=BLUE]-[/color][/b] cAng pi[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]>[/color][/b] cAng pi[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]<=[/color][/b] cAng [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]*[/color][/b] [b][color=#009900]3[/color][/b] pi[b][color=RED])[/color][/b] [b][color=#009900]2[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] cAng [b][color=RED]([/color][/b][b][color=BLUE]+[/color][/b] cAng pi[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b]Make_Text mPt tStr cAng[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n<!> No Lines Selected <!>"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] Make_Text [b][color=RED]([/color][/b]pt val rot[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entmake[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] . [b][color=#ff00ff]"TEXT"[/color][/b][b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]8[/color][/b] . [b][color=#ff00ff]"TEXT"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]62[/color][/b] [b][color=#009900]2[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]10[/color][/b] pt[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]40[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"TEXTSIZE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]1[/color][/b] val[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]50[/color][/b] rot[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]7[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getvar[/color][/b] [b][color=#ff00ff]"TEXTSTYLE"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]71[/color][/b] . [b][color=#009900]0[/color][/b][b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]72[/color][/b] . [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009900]73[/color][/b] . [b][color=#009900]1[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cons[/color][/b] [b][color=#009900]11[/color][/b] pt[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] Quote
SEGUL Posted April 28, 2009 Posted April 28, 2009 Good Day Lee Mac Many thanks for the great lisp......it works just as i wanted...... Quote
kenboldt Posted June 11, 2009 Posted June 11, 2009 I am using your slope lisp, and fist off, thank you so much, it is simply amazing, but secondly, I am wondering where in the script the colour is set. I would like to be able to change the colour to something other than Yellow. If you could point me in the right direction, I would appreciate it. Cheers, Ken Quote
Lee Mac Posted June 12, 2009 Posted June 12, 2009 Thanks Ken, I'm glad I could help you out, see the highlighted section for text colour: ;; Slope Text by Lee McDonnell 23.04.2009 (defun c:slp (/ ss tStr cAng mPt) (vl-load-com) (if (setq ss (ssget (list (cons 0 "LINE") (if (getvar "CTAB") (cons 410 (getvar "CTAB")) (cons 67 (- 1 (getvar "TILEMODE"))))))) (progn (foreach cObj (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (setq tStr (strcat (rtos (* 100. (sin (setq cAng (angle '(0 0 0) (vlax-curve-getFirstDeriv cObj (vlax-curve-getParamatPoint cObj (vlax-curve-getStartPoint cObj))))))) 2 2) "% Slope") mPt (vlax-curve-getPointatDist cObj (/ (distance (vlax-curve-getStartPoint cObj) (vlax-curve-getEndPoint cObj)) 2.0))) (cond ((and (> cAng (/ pi 2)) (<= cAng pi)) (setq cAng (- cAng pi))) ((and (> cAng pi) (<= cAng (/ (* 3 pi) 2))) (setq cAng (+ cAng pi)))) (Make_Text mPt tStr cAng))) (princ "\n<!> No Lines Selected <!>")) (princ)) [b][color=Red](defun Make_Text (pt val rot) (entmake (list '(0 . "TEXT") '(8 . "TEXT") ;; <<--- LAYER (cons 62 2) ;; <<--- COLOUR (2 = YELLOW) (cons 10 pt) (cons 40 (getvar "TEXTSIZE")) ;; <<--- TEXT HEIGHT (cons 1 val) (cons 50 rot) (cons 7 (getvar "TEXTSTYLE")) ;; <<--- TEXT STYLE '(71 . 0) '(72 . 1) '(73 . 1) (cons 11 pt))))[/color][/b] Quote
ichlove Posted June 12, 2009 Posted June 12, 2009 Hi ,which line can detele the degree text?and what if I only want to dimension one side of the rectangles by selecting,how can I make it? tks Quote
Lee Mac Posted June 12, 2009 Posted June 12, 2009 Hi ,which line can detele the degree text?and what if I only want to dimension one side of the rectangles by selecting,how can I make it? tks At this point would it not be easier just to draw the dimensions? Quote
ichlove Posted June 12, 2009 Posted June 12, 2009 No,I mean if I have 60 windows,and I only want to dimension on the top of the window,not the four sides,what can I do with it ? At this point would it not be easier just to draw the dimensions? Quote
gordon_Gjs Posted April 28, 2010 Posted April 28, 2010 For the past couple of weeks now I have been searching for a lisp that will show the area of a polyline and so far this one (PDIM.LSP) comes close. Lee Mac you did a good job on writing this one. My question here is would it be possible to give the total area of the polyline instead of measuring turn-by-turn? This picture below will give an example. Also If maybe the total area could appear in the middle of the polyline that would be great. Is this possible? Thanks for any help. I hope this thread is not too old. . Quote
Lee Mac Posted April 28, 2010 Posted April 28, 2010 Thanks Gordon, If its area you are after, I would think Fields would be the way to go, perhaps look at this thread: http://www.cadtutor.net/forum/showpost.php?p=311693&postcount=20 Quote
Least Posted April 29, 2010 Posted April 29, 2010 Lee, I think Gordon means the total length of the polyline not the area. With the length measurement put in the mid point of the polyline. p Quote
Lee Mac Posted April 29, 2010 Posted April 29, 2010 Ok, perhaps something similar to this then: http://www.cadtutor.net/forum/showpost.php?p=319742&postcount=9 Quote
gordon_Gjs Posted April 29, 2010 Posted April 29, 2010 Ok, perhaps something similar to this then: http://www.cadtutor.net/forum/showpost.php?p=319742&postcount=9 Thanks Lee Mac and Least for you're help on getting me to the right lisp. The Plen lisp works great for what I need. Thanks again!!! If it is possible, I do have a request I will post on the "autonumbering and lenght" thread. 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.