Author Topic: Deleting pline vertex  (Read 12786 times)

0 Members and 1 Guest are viewing this topic.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Deleting pline vertex
« 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
Thanks for explaining the word "many" to me, it means a lot.

whdjr

  • Guest
Deleting pline vertex
« Reply #1 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.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Deleting pline vertex
« Reply #2 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.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Deleting pline vertex
« Reply #3 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"))
         )
       )
  )
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Dinosaur

  • Guest
Deleting pline vertex
« Reply #4 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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Deleting pline vertex
« Reply #5 on: May 19, 2005, 08:11:21 AM »
Here's a before and after ..

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Deleting pline vertex
« Reply #6 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!
Thanks for explaining the word "many" to me, it means a lot.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Deleting pline vertex
« Reply #7 on: May 19, 2005, 08:20:33 AM »
My pleasure Tracey.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

whdjr

  • Guest
Deleting pline vertex
« Reply #8 on: May 19, 2005, 08:50:36 AM »
Kool tool Kerry! :D

Kate M

  • Guest
Deleting pline vertex
« Reply #9 on: May 19, 2005, 12:31:59 PM »
There's also the "straighten" option in PEDIT -- I use it all the time.

ML

  • Guest
Deleting pline vertex
« Reply #10 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