leo321 Posted February 5 Posted February 5 I had one than, must selcted one by one and choose the vertex, (attach) I ´ll like to modify to auto (all area in the drawn) alter first vertex on each polygon to vertex more to north.C2V Choose First vertex.lsp thx felas Quote
Emmanuel Delay Posted February 6 Posted February 6 Can you better explain wat must happen? Maybe upload a dwg example? 1 Quote
leo321 Posted February 6 Author Posted February 6 Looks likes easy, but when you have 7000 polygons to do it, the hand Begin shake, kkk Quote
Emmanuel Delay Posted February 6 Posted February 6 (edited) Oh, I see now. There's a function that replaces the list of coordinates (vlax-put (vlax-ename->vla-object ent) 'coordinates coords) So I read the coordinates, set the most North one to 0, then replace the coordinates. Like this: Command MFV for Modify First Vertex (vl-load-com) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; LW Vertices - Lee Mac ;; Returns a list of lists in which each sublist describes ;; the position, starting width, ending width and bulge of the ;; vertex of a supplied LWPolyline (defun LM:LWVertices ( e ) (if (setq e (member (assoc 10 e) e)) (cons (list (assoc 10 e) (assoc 40 e) (assoc 41 e) (assoc 42 e) ) (LM:LWVertices (cdr e)) ) ) ) (defun getVertices ( pline / verts vert res) (setq verts (LM:LWVertices (entget pline) )) (setq res (list)) (foreach vert verts (setq p (cdr (assoc 10 vert))) (setq res (append res (list p))) ) res ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; returns the index of the vertex with the max Y value (defun getMaxYVert ( verts / maxY i ind) (setq maxY nil) (setq ind 0) (setq i 0) (foreach a verts (if (= nil maxY) (setq maxY (nth 1 a)) (if (> (nth 1 a) maxY) (progn (setq ind i) (setq maxY (nth 1 a)) ) ) ) (setq i (+ i 1)) ) ind ) ;; MFV for Modify First Vertex (defun c:MFV ( / ss i j ent verts maxYindex verts2 coords) (setq ss (ssget (list (cons 0 "*POLYLINE") (cons 70 1)))) (setq i 0) (repeat (sslength ss) ;;(princ "\n") (setq ent (ssname ss i)) (setq verts (getVertices ent)) (setq maxYindex (getMaxYVert verts)) (setq coords (list)) ;; new list of coordinates. (list x0 y0 x1 y1 x2 y2...), rearraned to have the most North one first (setq j 0) (princ maxYindex) (repeat (length verts) (setq coords (append coords (list (nth 0 (nth (rem (+ j maxYindex) (length verts)) verts)) (nth 1 (nth (rem (+ j maxYindex) (length verts)) verts)) ))) (setq j (+ j 1)) ) ;; now replace the verices verts by coords (vlax-put (vlax-ename->vla-object ent) 'coordinates coords) ;;(princ coords) (setq i (+ i 1)) ) (princ) ) Edited February 6 by Emmanuel Delay 1 Quote
BIGAL Posted February 6 Posted February 6 (edited) Over at the swamp asked something similar. Look at Dexus solution. https://www.theswamp.org/index.php?topic=57938.0 Edited February 6 by BIGAL 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.