- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone, I would like to know how to start numbering the point at any point on a polyline, since my version only starts and ends where the object was created.
sequence, select the object, and specify a point where the numbering should start.
I appreciate everyone's contribution.
(defun c:Vertices (/ pl ent data pts pnt-pontos i pnt norte sorted-pts az txt txt-height text-style ent-text)
(setq pl (car (entsel "\nSelecione a polilinha: ")))
(if (and pl (= (cdr (assoc 0 (entget pl))) "LWPOLYLINE"))
(progn
;; Obtém os dados da entidade
(setq data (entget pl))
;; Filtra os pontos dos vértices (grupo 10)
(setq pts (vl-remove-if-not '(lambda (x) (= (car x) 10)) data))
(setq pnt-pontos (mapcar 'cdr pts))
(setq norte (car (vl-remove-if-not
(function
(lambda (pt)
(equal (cadr pt) (apply 'max (mapcar 'cadr pnt-pontos)))
)
)
pnt-pontos
))
)
(setq sorted-pts
(vl-sort
pnt-pontos
(function
(lambda (p1 p2))
)
)
)
)
;; Define estilo e tamanho do texto
(setq text-style "Standard") ;;
(setq txt-height 2.5)
;; Insere numeração perto de cada ponto
(setq i 1)
(foreach p sorted-pts
(setq txt (strcat (if (< i 10) "0" "") (itoa i)))
(setq ent-text (entmakex
(list
(cons 0 "TEXT")
(cons 10 (list (+ (car p) 0.3) (+ (cadr p) 0.3)))
(cons 40 txt-height)
(cons 1 txt)
(cons 7 text-style)
)
)
)
(setq i (1+ i))
)
)
)
(princ)
)
Solved! Go to Solution.