TheSwamp
CAD Forums => CAD General => Topic started by: jonesy on May 19, 2005, 05:49:11 AM
-
Lets set the scene first...
We use polylines to create a hatch boundary, and use associative hatch to create areas that need to be excavated to a certain depth. All well and good. Then the engineer comes along and changes his mind. OK thats normal, in fact no problem at all to add vertices to the existing pline, and hatch grows with it. FAB. Then the engineer decides to change his mind on a different area and that needs to be made smaller (less vertices).
My question... what is the best way to get rid of the extra vertices while leaving the correct shape. Up until now I have been dragging with the grips, but this I think puts endpoint on top of endpoint, and would that cause problems if you needed to edit it again?.
I can remember in Mickeystation there was a core command that deleted a selected vertex. Does anyone know if this can be done (and if so, how) in AutoCAD.
Any ideas.
Thanks
-
You would probably need to remove a coordinate point either from the assoc codes or vla commands. It could be done without too much trouble, but have to figure out how to input which point to remove. I don't know how you maintain shape though unless you were talking about duplicate points on top of one another.
-
I wrote a VBA program for doing just that for facilities management. I'll have to see if I still have it.
-
This is a little primative Tracey, but may get you out of trouble ..
(defun c:remove-vertex ( / CNT EPOINT INDEX INDEXLIST NAME NEWLIST OBJENT VERTEXLIST)
;;; kwb 20050519
(and (setq objent (vlax-ename->vla-object (car (entsel))))
(vl-position (setq name (vlax-get objent "ObjectName")) '("AcDbPolyline"))
;"AcDb2dPolyline" "AcDb3dPolyline"))
(setq vertexlist (vlax-get objent "Coordinates"))
(while
(and (setq epoint (getpoint "Select Vertex to remove"))
(setq cnt 0
newlist '()
index (* 2 (fix (+ 0.5 (vlax-curve-getparamatpoint objent epoint))))
)
(setq indexlist (list index (1+ index)))
;;
(foreach ordinate vertexlist
(if (not (vl-position cnt indexlist))
(setq newlist (cons ordinate newlist))
)
(setq cnt (1+ cnt))
)
(not (vl-catch-all-apply 'vlax-put
(list objent "Coordinates" (reverse newlist))
)
)
(setq vertexlist (vlax-get objent "Coordinates"))
)
)
)
)
-
An easy method is to grip the extra vertice and move it to the osnap midpoint between the adjacent vertices. If there are multiple vertices to be eliminated they can be handled in a similar manner or by drawing a temporary construction line between the vertices adjoining the group to be removed.
-
Here's a before and after ..
(http://www.theswamp.org/screens/kerry/rem-vertex.png)
-
Kerry
Thats a great routine.
Thanks very much, it will save me hours of time. I will try and figure out the lisp!
-
My pleasure Tracey.
-
Kool tool Kerry! :D
-
There's also the "straighten" option in PEDIT -- I use it all the time.
-
Keith
I still have The VBA Project (PVD) that you wrote. A matter of fact, I was using it yesterday to do some Space Allocation Plans here at work
Mark