mdchuyen Posted November 19, 2022 Posted November 19, 2022 Hello all I have many polylines that I want to fill in numbers in the same order as the attached drawing. currently i have Vladimir Azarko's code. Can anyone help me to change this code to achieve the result. Thank youtest5.dwgcoorNp.lsp Quote
mhupp Posted November 19, 2022 Posted November 19, 2022 This is just a simple lisp unlike coonp.lsp it will ask for a selection of polylines and then create text middle center on their vertices and on the same layer as the polyline. "i" or the text number is reset for every polyline. So the start of the polyline will always be 1 But two things. Because of the annotative text in another drawing text could be a different size. the text ues the right style but annotative is set to no so you might have to change that after the fact (cant figure it out) ;;----------------------------------------------------------------------------;; ;; Add text to all Polylines Vertices (defun C:PolyNumber (/ SS i lay poly) (if (setq ss (ssget '((0 . "*POLYLINE")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq i 1 lay (cdr (assoc 8 (setq poly (entget ent))))) (foreach pt (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) poly)) (entmake (list '(0 . "TEXT") (cons 8 lay) (cons 10 pt) (cons 11 pt) '(40 . 500) '(41 . 0.85) (cons 1 (rtos i 2 0)) '(72 . 4) '(73 . 2) ) ) (setq i (1+ i)) ) ) ) (princ) ) 1 Quote
mdchuyen Posted November 21, 2022 Author Posted November 21, 2022 On 11/20/2022 at 3:45 AM, mhupp said: This is just a simple lisp unlike coonp.lsp it will ask for a selection of polylines and then create text middle center on their vertices and on the same layer as the polyline. "i" or the text number is reset for every polyline. So the start of the polyline will always be 1 But two things. Because of the annotative text in another drawing text could be a different size. the text ues the right style but annotative is set to no so you might have to change that after the fact (cant figure it out) ;;----------------------------------------------------------------------------;; ;; Add text to all Polylines Vertices (defun C:PolyNumber (/ SS i lay poly) (if (setq ss (ssget '((0 . "*POLYLINE")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq i 1 lay (cdr (assoc 8 (setq poly (entget ent))))) (foreach pt (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) poly)) (entmake (list '(0 . "TEXT") (cons 8 lay) (cons 10 pt) (cons 11 pt) '(40 . 500) '(41 . 0.85) (cons 1 (rtos i 2 0)) '(72 . 4) '(73 . 2) ) ) (setq i (1+ i)) ) ) ) (princ) ) thank you very much Quote
Tsuky Posted November 21, 2022 Posted November 21, 2022 I have this code which is very similar to your request. It numbers with a block but also informs the cumulated length of the vertex, its position in X,Y,Z. This can allow data to be extracted to a block attribute file for external processing. BlockAtt2Vtx.lsp 1 Quote
mdchuyen Posted November 21, 2022 Author Posted November 21, 2022 58 minutes ago, Tsuky said: I have this code which is very similar to your request. It numbers with a block but also informs the cumulated length of the vertex, its position in X,Y,Z. This can allow data to be extracted to a block attribute file for external processing. BlockAtt2Vtx.lsp 18.9 kB · 1 download Great, thank you 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.