hosneyalaa Posted November 24, 2018 Posted November 24, 2018 Hello all I have code to draw a perville depending on points But do not complete a rectangular drawing around the resulting text Is it possible to help? (DEFUN c:xx (/ AA DX DX2 DY DY2 END1 END2 GRADE I LEN MID MIX MIY P PTX PTXY PTY PTYY PX PY SLOPE XL1 XL2 XM YL1 YL11 YL2 YM A HT MIX1 MIX2 MIX22 MIY1 MIY2 MIY22 N PT PTX1 YL111 II LL LR NA NAA NPTXY NPTYY NPX NPX1 NPY SS SSN TB TEXTENT UL UR X III) (SETVAR "CECOLOR" "RGB:147,149,152") (SETVAR "OSMODE" 35) (INITGET 7) (COMMAND "PDMODE" 35) (COMMAND "PDSIZE" 1) (SETQ ht (GETREAL "\n-> Enter text height : ")) (SETQ p(GETPOINT "\n-> Choose the starting profile:")) (SETQ pX(CAR P));POINT-X OF BEIGING PROFILE (SETQ pY(CADR P));POINT-Y OF BEIGING PROFILE (SETQ n 0) (command "-osnap" "endpoint,midpoint,center,node,quadrant,tangent,INTersection,PERpendicular") (WHILE (SETQ pT (GETPOINT "\n-> Choose points for drawing:")) (SETQ n (1+ n)) (SETQ pTX(CAR PT));X__point TO DRAWING (SETQ pTY(CADDR PT));Y__point TO DRAWING (setq PTXY (list PTX PTY)) (SETQ A(CONS pTXY A)) ;;; (COMMAND "_.POINT" pTXY "") ;;; (setq PTYY (rtos (CADDR PT))) ;;; (command "text" "j" "ML" PTXY (/ HT 3) 90 PTYY) ;;; (command "._Change" (entlast) "" "p" "color" "80" "") (princ A) );WHILE (SETQ AA(reverse A)) (setq II 0) ; Order of Line (while (AND (< II N ) (/= II N)) (setq END1 (NTH 0 AA)) ; Get Start Point OF Line (setq END2 (NTH II AA)) ; Get End Point OF Line (setq XL1 (car END1)) ; Get X cordinate for START POINT. (setq YL1 (cadr END1)) ; Get Y cordinate for START POINT. (setq XL2 (car END2)) ; Get X cordinate for END POINT. (setq YL2 (cadr END2)) ; Get Y cordinate for END POINT. (setq NpX (+ pX (- XL2 XL1)));Difference between points(X-X) (setq NpX1 (+ 1 NPX)) (setq NpY (+ pY (- YL2 YL1)));Difference between points(Y-Y) (setq NPTXY (list NpX NpY)) (SETQ NA(CONS NPTXY NA)) (COMMAND "_.POINT" NPTXY "") (setq NPTYY (rtos YL2)) (command "text" "j" "ML" NPTXY (/ HT 3) 90 NPTYY) (command "._Change" (entlast) "" "p" "color" "80" "") (setq II (+ II 1)) );while (SETQ NAA(reverse NA)) (command "-osnap" "tangent") (setq I 0) ; Order of Line (while (AND (< I N ) (/= I N)) (setq END1 (NTH I NAA)) ; Get Start Point OF Line (setq END2 (NTH (+ 1 I) NAA)) ; Get End Point OF Line (setq XL1 (car END1)) ; Get X cordinate for START POINT. (setq YL1 (cadr END1)) ; Get Y cordinate for START POINT. (setq YL11 (cadr (NTH 0 NAA))); Get X cordinate for END POINT-1 (setq YL111 (- YL11 1)); Get X cordinate for END POINT (setq XL2 (car END2)) ; Get (X-1) cordinate for END POINT-1. (setq YL2 (cadr END2)) ; Get Y cordinate for END POINT. (setq XM (+ XL1 (/ (- XL2 XL1) 2))) (setq YM (+ YL1 (/ (- YL2 YL1) 2))) (setq MID (list XM YM)) (setq MIx (list NpX YL1));POINT OF AXISS X (setq MIy (list XL2 YL11));POINT OF AXISS Y (setq MIX1 (list XL1 YL11));DIMENSION POINT X1 (setq MIx2 (list XL2 YL11));DIMENSION POINT X2 (setq MIx22 (list XL2 YL111));DIMENSION POINT X3 (command "DIMLINEAR" MIX1 MIx2 MIx22) (command "._Change" (entlast) "" "p" "color" "130" "") (setq MIy1 (list NpX YL1));DIMENSION POINT Y1 (setq MIy2 (list NpX YL2));DIMENSION POINT Y2 (setq MIy22 (list NpX1 YL2));DIMENSION POINT Y3 (command "DIMLINEAR" MIy1 MIy2 MIy22) (command "._Change" (entlast) "" "p" "color" "130" "") (setq dx (- XL1 XL2)) (SETQ dx2 (* dx dx)) (setq dy (- YL1 YL2)) (SETQ dy2 (* dy dy)) (SETQ SLOPE (RTOS (* (/ (/ DY 10.0) DX) 10.0) 2 2)) (SETQ GRADE (RTOS (* (/ (/ DX ) DY)) 2 2)) (command "text" "j" "ML" MID (/ HT 3) 90 (strcat "1:"GRADE)) (command "._Change" (entlast) "" "p" "color" "240" "") (setq len (sqrt(ABS(+ dx2 dy2)))) (command "lwdisplay" "on") (command "pline" END1 END2 "") (command "._Change" (entlast) "" "p" "color" "140" "") (command "._Change" (entlast) "" "p" "lweight" ".5" "") (command "line" END1 MIX "") (command "._Change" (entlast) "" "p" "color" "41" "") (command "._Change" (entlast) "" "p" "ltype" "DASHED2" "") (command "line" END2 MIY "") (command "._Change" (entlast) "" "p" "color" "41" "") (command "._Change" (entlast) "" "p" "ltype" "DASHED2" "") (setq I (+ I 1)) );while (setq ss (ssget "X" '((0 . "TEXT")))) (if (/= SS nil) (progn (repeat (setq III (sslength Ss)) (setq textent (ssname ss (setq III (1- III)))) (command "ucs" "Object" textent) (setq tb (textbox (list (cons -1 textent)))) (setq ll (car tb)) (setq ur (cadr tb)) (setq ul (list (car ll) (cadr ur))) (setq lr (list (car ur) (cadr ll))) (command "pline" ll lr ur ul "Close") (command "ucs" "p") );REAPET );PROGN );IF (princ) );defun Quote
hanhphuc Posted November 26, 2018 Posted November 26, 2018 On 11/25/2018 at 3:50 AM, hosneyalaa said: But do not complete a rectangular drawing around the resulting text Is it possible to help? hi , if you are using PC, in edit mode just click at button <> or [ code ] your code here [/ code ] (brackets without space) Did you try Lee Mac's BoxText ? if you have ET installed, also can try command: TCIRCLE p/s: why not using QDIM? 1 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.