Author Topic: edit lwpolyline with coincental vertexes  (Read 2087 times)

0 Members and 1 Guest are viewing this topic.

curmudgeon

  • Newt
  • Posts: 194
edit lwpolyline with coincental vertexes
« 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"
Never express yourself more clearly than you are able to think.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: edit lwpolyline with coincental vertexes
« Reply #1 on: June 23, 2009, 12:13:44 PM »
Sorry but I don't follow your explanation of the problem.  :-(
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

curmudgeon

  • Newt
  • Posts: 194
Re: edit lwpolyline with coincental vertexes
« Reply #2 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
Never express yourself more clearly than you are able to think.

ScottMC

  • Newt
  • Posts: 191
Re: edit lwpolyline with coincental vertexes
« Reply #3 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..

« Last Edit: July 15, 2022, 02:52:30 PM by ScottMC »