Jump to content

Help ME re - format code


hosneyalaa

Recommended Posts

  1. I have a code that gives the point the height of the nearest TEXT of the point
    Is it possible to choose points and numbers at once?
    And the requirement that the number of Texts equal the number of characters until the code works
    
    Thanks a lot to everyone.
    
      
  2. (defun c:DTP (/ AP AT DD END1 END2 H HH HTT I II J LEN NP NT XL1 XL2 YL1 YL2 ZND2)
  3. ; ***************************************
  4.   (ALERT "Required number of points = number of writings")
  5. (command "layer" "m" "NEW_TXT" "")
  6. (command "color" "t" "253,176,23")
  7. (command "CMDECHO" "0")
  8.  (princ "\nSelect POINT :")
  9. (SETQ AP (SSGET (LIST(CONS 0 "POINT"))))
  10.  (princ "\nSelect POINT :")
  11. (setq NP (sslength AP)) ; No of POINT
  12.  
  13. (princ "\nSelect TEXT :")
  14. (SETQ AT (SSGET (LIST(CONS 0 "TEXT,MTEXT"))))
  15.  (princ "\nSelect TEXT,MTEXT :")
  16. (setq NT (sslength AT)) ; No of TEXT
  17.  
  18. ;******************************************************************
  19.  
  20. (setq I 0) ; Order of POINT
  21. (setq II 0) ; Order of TEXT
  22. (setq DD 100) ; No. of Intersection
  23.  
  24. (while (< I NP )
  25.  
  26. (while (< II NT )
  27. (setq END1 (cdr (assoc 10 (entget (ssname AP I ))))) ; Get Point
  28. (setq END2 (cdr (assoc 10 (entget (ssname AT II ))))) ; GetTEXT
  29.        (setq ZND2 (ATOF(cdr (assoc 1 (entget (ssname AT II )))))) ; GetTEXT
  30.  
  31.        (setq XL1 (car END1)) ; Get X cordinate for START POINT.
  32. (setq YL1 (cadr END1)) ; Get Y cordinate for START POINT.
  33. (setq XL2 (car END2)) ; Get X cordinate for END TEXT.
  34. (setq YL2 (cadr END2)) ; Get Y cordinate for END TEXT.
  35.  
  36.        (setq len (sqrt (ABS(+ (expt(- YL2 YL1) 2) (expt(- XL2 XL1) 2)))))
  37.  (if (< LEN DD)
  38.      (progn
  39. (setq hh (list XL1 YL1 ZND2))
  40. (setq DD LEN))
  41.      (progn
  42. (setq h (list XL1 YL1))))
  43.  
  44.  (SETQ II(+ 1 II))
  45.  
  46.  );while
  47.  (SETQ htT (RTOS(CADDR HH) 2 2))
  48.  (command "._Text" "j" "mc" HH 2 "0" htt)
  49.  (command "._point" hh)
  50. ;;;  (command "._Change" (entlast) "" "p" "ELEV" "ZND2" "")
  51.  (setq II 0)
  52.  (SETQ I (+ 1 I))
  53.  (setq DD 100)
  54.  
  55.  );while
  56.  
  57.  )
Link to comment
Share on other sites

 

format code? 

hi you can edit it with proper code tags

1.In PC, while editing tool bar just click  '<>' (before a smiley sign) then paste your code 

2.in mobile  [ code ] without spacing..

[code] your code bla bla [/code]

 

Edited by hanhphuc
  • Like 1
Link to comment
Share on other sites

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...