Jump to content

Is it possible to help FOR CODE?


Recommended Posts

Posted

 

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?

 

  1. (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)
  2.   (SETVAR "CECOLOR" "RGB:147,149,152")
  3.   (SETVAR "OSMODE" 35)
  4.   (INITGET 7)
  5.   (COMMAND "PDMODE" 35)
  6.   (COMMAND "PDSIZE" 1)
  7.   (SETQ ht (GETREAL "\n-> Enter text height : "))
  8.   (SETQ p(GETPOINT "\n-> Choose the starting profile:"))
  9.   (SETQ pX(CAR P));POINT-X OF BEIGING PROFILE 
  10.   (SETQ pY(CADR P));POINT-Y OF BEIGING PROFILE 
  11.   (SETQ n 0)
  12.   (command "-osnap" "endpoint,midpoint,center,node,quadrant,tangent,INTersection,PERpendicular")
  13.   (WHILE 
  14.     (SETQ pT (GETPOINT "\n-> Choose points for drawing:"))
  15.     (SETQ n (1+ n))
  16.     (SETQ pTX(CAR PT));X__point TO DRAWING
  17.     (SETQ pTY(CADDR PT));Y__point TO DRAWING
  18.     (setq PTXY (list PTX PTY))
  19.     
  20.     (SETQ A(CONS pTXY A))
  21. ;;;    (COMMAND "_.POINT" pTXY "")
  22. ;;;    (setq PTYY (rtos (CADDR PT)))
  23. ;;;    (command "text" "j" "ML" PTXY (/ HT 3) 90 PTYY)
  24. ;;;    (command "._Change" (entlast) "" "p" "color" "80" "")
  25.     (princ A)
  26.   );WHILE
  27.   (SETQ AA(reverse A))
  28.    (setq II 0) ; Order of  Line
  29.     (while (AND (< II N ) (/= II N))
  30.     
  31.     (setq END1 (NTH 0 AA)) ; Get Start Point OF Line
  32.     (setq END2 (NTH II AA)) ; Get End Point OF Line
  33.      (setq XL1 (car END1)) ; Get X cordinate for START POINT.
  34.     (setq YL1 (cadr END1)) ; Get Y cordinate for START POINT.
  35.     (setq XL2 (car END2)) ; Get X cordinate for END POINT.
  36.     (setq YL2 (cadr END2)) ; Get Y cordinate for END POINT.
  37.     (setq NpX (+ pX (- XL2 XL1)));Difference between points(X-X)
  38.     (setq NpX1 (+ 1 NPX))
  39.       
  40.     (setq NpY (+ pY (- YL2 YL1)));Difference between points(Y-Y)
  41.         (setq NPTXY (list NpX NpY))
  42.         (SETQ NA(CONS NPTXY NA))
  43.     (COMMAND "_.POINT" NPTXY "")
  44.     (setq NPTYY (rtos YL2))
  45.     (command "text" "j" "ML" NPTXY (/ HT 3) 90 NPTYY)
  46.     (command "._Change" (entlast) "" "p" "color" "80" "")
  47.            
  48.   (setq II (+ II 1))    
  49. );while
  50. (SETQ NAA(reverse NA))
  51.     (command "-osnap" "tangent")
  52.   
  53.         (setq I 0) ; Order of  Line
  54.     (while (AND (< I N ) (/= I N))
  55.     
  56.     (setq END1 (NTH I NAA)) ; Get Start Point OF Line
  57.     (setq END2 (NTH (+ 1 I) NAA)) ; Get End Point OF Line
  58.      (setq XL1 (car END1)) ; Get X cordinate for START POINT.
  59.     (setq YL1 (cadr END1)) ; Get Y cordinate for START POINT.
  60.     (setq YL11 (cadr (NTH 0 NAA))); Get X cordinate for END POINT-1
  61.     (setq YL111 (- YL11 1)); Get X cordinate for END POINT
  62.     (setq XL2 (car END2)) ; Get (X-1) cordinate for END POINT-1.
  63.     (setq YL2 (cadr END2)) ; Get Y cordinate for END POINT.
  64.     (setq XM (+ XL1 (/ (- XL2 XL1) 2)))
  65.     (setq YM (+ YL1 (/ (- YL2 YL1) 2)))
  66.     (setq MID (list XM YM))
  67.       (setq MIx (list NpX YL1));POINT OF AXISS X
  68.       (setq MIy (list XL2 YL11));POINT OF AXISS Y
  69.       
  70.       (setq MIX1 (list XL1 YL11));DIMENSION POINT X1
  71.       (setq MIx2 (list XL2 YL11));DIMENSION POINT X2
  72.       (setq MIx22 (list XL2 YL111));DIMENSION POINT X3
  73.          (command "DIMLINEAR" MIX1 MIx2 MIx22)
  74.       (command "._Change" (entlast) "" "p" "color" "130" "")
  75.       
  76.     (setq MIy1 (list NpX YL1));DIMENSION POINT Y1
  77.     (setq MIy2 (list NpX YL2));DIMENSION POINT Y2
  78.     (setq MIy22 (list NpX1 YL2));DIMENSION POINT Y3
  79.     (command "DIMLINEAR" MIy1 MIy2 MIy22)
  80.     (command "._Change" (entlast) "" "p" "color" "130" "")  
  81.     (setq dx (- XL1    XL2))        (SETQ dx2 (* dx dx))
  82.     (setq dy (- YL1 YL2))        (SETQ dy2 (* dy dy))
  83.     (SETQ SLOPE (RTOS (* (/ (/ DY 10.0) DX) 10.0) 2 2))
  84.     (SETQ GRADE (RTOS (* (/ (/ DX ) DY)) 2 2))
  85.     (command "text" "j" "ML" MID (/ HT 3) 90 (strcat "1:"GRADE))
  86.         (command "._Change" (entlast) "" "p" "color" "240" "")
  87.     (setq len (sqrt(ABS(+ dx2 dy2))))
  88.      (command "lwdisplay" "on")
  89.     (command "pline" END1 END2 "")
  90.       (command "._Change" (entlast) "" "p" "color" "140" "")
  91.       (command "._Change" (entlast) "" "p" "lweight" ".5" "")
  92.     (command "line" END1 MIX "")
  93.       (command "._Change" (entlast) "" "p" "color" "41" "")
  94.       (command "._Change" (entlast) "" "p" "ltype" "DASHED2" "")
  95.         (command "line" END2 MIY "")
  96.       (command "._Change" (entlast) "" "p" "color" "41" "")
  97.       (command "._Change" (entlast) "" "p" "ltype" "DASHED2" "")
  98.      
  99.   (setq I (+ I 1))    
  100. );while
  101.   (setq ss (ssget "X" '((0 . "TEXT"))))
  102.     (if (/= SS nil)
  103.     (progn
  104.   (repeat (setq III (sslength Ss))
  105.   (setq textent (ssname ss (setq III (1- III))))
  106.    (command "ucs" "Object" textent)
  107.   (setq tb (textbox (list  (cons -1 textent))))
  108.        (setq ll (car tb))
  109.        (setq ur  (cadr tb))
  110.        (setq ul  (list (car ll) (cadr ur)))
  111.        (setq lr (list (car ur) (cadr ll)))
  112.  
  113.   (command "pline" ll lr ur ul "Close")
  114.   (command "ucs" "p")
  115.     );REAPET
  116.   );PROGN
  117.   );IF
  118.   (princ)
  119.   
  120.   
  121. );defun 
  122.   

  

التقاط.PNG

التقاط0.PNG

Posted
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?

 

  • Like 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...