hosneyalaa Posted November 7, 2018 Posted November 7, 2018 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. (defun c:DTP (/ AP AT DD END1 END2 H HH HTT I II J LEN NP NT XL1 XL2 YL1 YL2 ZND2) ; *************************************** (ALERT "Required number of points = number of writings") (command "layer" "m" "NEW_TXT" "") (command "color" "t" "253,176,23") (command "CMDECHO" "0") (princ "\nSelect POINT :") (SETQ AP (SSGET (LIST(CONS 0 "POINT")))) (princ "\nSelect POINT :") (setq NP (sslength AP)) ; No of POINT (princ "\nSelect TEXT :") (SETQ AT (SSGET (LIST(CONS 0 "TEXT,MTEXT")))) (princ "\nSelect TEXT,MTEXT :") (setq NT (sslength AT)) ; No of TEXT ;****************************************************************** (setq I 0) ; Order of POINT (setq II 0) ; Order of TEXT (setq DD 100) ; No. of Intersection (while (< I NP ) (while (< II NT ) (setq END1 (cdr (assoc 10 (entget (ssname AP I ))))) ; Get Point (setq END2 (cdr (assoc 10 (entget (ssname AT II ))))) ; GetTEXT (setq ZND2 (ATOF(cdr (assoc 1 (entget (ssname AT II )))))) ; GetTEXT (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 TEXT. (setq YL2 (cadr END2)) ; Get Y cordinate for END TEXT. (setq len (sqrt (ABS(+ (expt(- YL2 YL1) 2) (expt(- XL2 XL1) 2))))) (if (< LEN DD) (progn (setq hh (list XL1 YL1 ZND2)) (setq DD LEN)) (progn (setq h (list XL1 YL1)))) (SETQ II(+ 1 II)) );while (SETQ htT (RTOS(CADDR HH) 2 2)) (command "._Text" "j" "mc" HH 2 "0" htt) (command "._point" hh) ;;; (command "._Change" (entlast) "" "p" "ELEV" "ZND2" "") (setq II 0) (SETQ I (+ 1 I)) (setq DD 100) );while ) Quote
hanhphuc Posted November 8, 2018 Posted November 8, 2018 (edited) 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 November 8, 2018 by hanhphuc 1 Quote
hosneyalaa Posted November 15, 2018 Author Posted November 15, 2018 Is it possible to choose points and numbers at once? 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.