TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: curmudgeon on June 23, 2009, 11:06:55 AM

Title: edit lwpolyline with coincental vertexes
Post by: curmudgeon on June 23, 2009, 11:06:55 AM
first, if I am reinventing the wheel, feel free to tell me.....

I have drawings where I represent circuits with lwpolylines. wiring to an isolated device means that the path "out" to the device is repeated to get back to the junction box and further on down the circuit. but the editing tools I have are limited. I love grips, but when one vertex is exactly the same as another, grabbing at grips return both.

I know what I can do, and I am doing it. further, it's fun. but I will feel silly if I spend too much time I can't bill directly. so, if you have one in your pocket, don't let me go on too long remaking it. maybe.

what I will do, unless I think of something better, is pick the polyline in question, make a list of vertexes, and check to see which pair of vertexes my pick point is between. then check to see which vertex it is nearest to, get a new point from the user, me, and substitute the new point for the old vertex.

(entmod ent)

it could end up as a total rework of pedit, based on the way I prefer to work, which is to not work so much.
( I am still on autocad 2000 - maybe you guys already have better tools )

thanks

roy

oops
"coincidental" - >> "at the same x y z"
Title: Re: edit lwpolyline with coincental vertexes
Post by: CAB on June 23, 2009, 12:13:44 PM
Sorry but I don't follow your explanation of the problem.  :-(
Title: Re: edit lwpolyline with coincental vertexes
Post by: curmudgeon on June 23, 2009, 01:00:43 PM
I want to be able to edit a lwpolyline in a grip-like manner. when the vertexes are on top of each other, autocad wants to stretch both vertexes. I just want one at a time.

so far I have this:

Code: [Select]
(defun c:polygrip (/)
  (setq x      (entsel "\nPick polyline to edit near vertex: ")
pt     (osnap (cadr x) "nea")
ent    (entget (car x))
pt_lst nil
  )

  (foreach z ent
    (if (= (car z) 10)
      (setq pt_lst (append pt_lst (list (cdr z))))
    )
  )
  (setq cnt 0)
  (repeat (- (length pt_lst) 1)
    (setq a (nth cnt pt_lst)
  b (nth (+ 1 cnt) pt_lst)
    )
    (if (= (+ (distance a pt) (distance pt b)) (distance a b))
      (setq seg (append seg (list a b cnt)))
    )
    (setq cnt (+ 1 cnt))
  )
  (if (> (distance (car seg) pt) (distance (cadr seg) pt))
    (setq vert (cadr seg))
    (setq vert (car seg))
  );; old vertex
  (setq vurt (getpoint "\n Pick new vertex. ")
vurt (list (car vurt)(cadr vurt))) ;; new vertex

(setq ent (subst (cons (cons 10 vurt) (cdr (member (cons 10 vert) ent))) (member (cons 10 vert) ent) ent))
  (entmod ent)
  (entupd (cdr (assoc -1 ent)))

)

and I think my subst command is failing.
but it's lunch time here, and roy is hungry.
the code is ugly, I know. but I can make it prettier after I get it running.

thanks
Title: Re: edit lwpolyline with coincental vertexes
Post by: ScottMC on July 12, 2022, 06:00:57 PM
 After you single click in the Vertex dock in the properties window, tap the arrow needed to get there, then, key in a different X or Y coord than what's seen. that will make it EASILY mod/accessible. As well by selecting one of the coords just below, pick the mouse arrow and/then you can pick a new point on the screen..