TheSwamp

CAD Forums => CAD General => Topic started by: jonesy on May 19, 2005, 05:49:11 AM

Title: Deleting pline vertex
Post 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
Title: Deleting pline vertex
Post by: whdjr on May 19, 2005, 07:49:16 AM
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.
Title: Deleting pline vertex
Post by: Keith™ on May 19, 2005, 07:54:34 AM
I wrote a VBA program for doing just that for facilities management. I'll have to see if I still have it.
Title: Deleting pline vertex
Post by: Kerry on May 19, 2005, 08:02:17 AM
This is a little primative Tracey, but may get you out of trouble ..
Code: [Select]

(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"))
         )
       )
  )
)
Title: Deleting pline vertex
Post by: Dinosaur on May 19, 2005, 08:04:21 AM
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.
Title: Deleting pline vertex
Post by: Kerry on May 19, 2005, 08:11:21 AM
Here's a before and after ..

(http://www.theswamp.org/screens/kerry/rem-vertex.png)
Title: Deleting pline vertex
Post by: jonesy on May 19, 2005, 08:15:06 AM
Kerry

Thats a great routine.

Thanks very much, it will save me hours of time. I will try and figure out the lisp!
Title: Deleting pline vertex
Post by: Kerry on May 19, 2005, 08:20:33 AM
My pleasure Tracey.
Title: Deleting pline vertex
Post by: whdjr on May 19, 2005, 08:50:36 AM
Kool tool Kerry! :D
Title: Deleting pline vertex
Post by: Kate M on May 19, 2005, 12:31:59 PM
There's also the "straighten" option in PEDIT -- I use it all the time.
Title: Deleting pline vertex
Post by: ML on May 19, 2005, 01:47:02 PM
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