Any way to remove vertices in an existing p-line?

Discussion in 'AutoCAD' started by J C C, Jun 11, 2004.

  1. J C C

    J C C Guest

    I have a contour map from the surveyor, with plines consisting of a straight
    segment, then an arc segment, then repeat...etc.

    It would be very helpful to:

    1. Get a routine to delete vertices, one by one, similar to Pedit Edit
    vertex Add, only in reverse
    The ultimate goal for this is to smooth out the contours, so they appear not
    so jagged, and reduce overhead and file size

    2. Help with converting the Plines mentioned above to all straight segments

    Thanks in advance,

    John Cole
     
    J C C, Jun 11, 2004
    #1
  2. Both of these things can be done using the Straighten option in the Edit
    function of the Pedit command. If you move more than one vertex down the
    line, it will remove the intermediate vertex/vertices and put a straight
    line from where you typed S to where you typed G (replacing any number of
    straight-line and/or arc segments). If you move across a single arc
    segment, it will replace it with a straight-line segment.

    It's not clear to me whether you want to do this manually (which I think you
    might because of the "one by one" wording), or automate it (which I think
    you might at least for your item 2). Maybe you want to do each category
    differently....

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Jun 11, 2004
    #2
  3. Hi,

    If you have Map there is an inbuilt command to do this.


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Jun 11, 2004
    #3
  4. J C C

    CAB2k Guest

    CAB2k, Jun 11, 2004
    #4
  5. J C C

    TCEBob Guest

    Take a look at Dotsoft.com (home of ToolPac). There is a freebee page that might
    have it. It does come with TP and you can also purchase subsets such as Text
    tools.

    rs
     
    TCEBob, Jun 12, 2004
    #5
  6. J C C

    TCEBob Guest

    Upon reflection, I think what you are looking for is a Weed command. Same
    recommendation: DotSoft. Laurie is right. If you have LDT, Terrain also has one.
    (it says Contours but it will weed any polyline. The best appearance for
    contours is usually achieved by splining after weeding, but this affects the
    accuracy as the splined line misses virtually all the points. So it depends on
    whether you are striving for beauty or accuracy. There is another kind of spline
    that does respect the points, called a Bicubic Spline.

    rs
     
    TCEBob, Jun 12, 2004
    #6
  7. J C C

    BTO Guest

    A good starting point of weed function :

    TIP914.LSP de la revue US Cadlyst
    ; Eliminate Unnecessary Vertices (c)1993, de Skyler Mills
    http://www.google.fr/search?sourceid=navclient&hl=fr&ie=UTF-8&oe=UTF-8&q="
    TIP914%2ELSP%22

    or read (not tested, i use my own lisp but I can't give it to you) :

    Bruno Toniutti

    ; récupéré sur ng le 26/06/2003
    ; the first is from Rudy Tovar, and qon´t work in r14, the other is
    ; from Frank Oquendo, I find it posted here from 1999.


    (defun c:rv (/ pt ln lt np lg po cn nl)
    (setq pt (getpoint "\nSelect vertex to remove: "))
    (if pt
    (progn
    (setq ln (entget (car (nentselp pt)))
    lt (cdr (assoc 0 ln))
    np (cons 10 (reverse(cdr(reverse pt))))
    )
    (if (= lt "LWPOLYLINE")
    (progn
    (setq lg (- (length ln) 1)
    cn 0
    )
    (setq po (- (vl-position np ln) 1))
    (repeat lg
    (if (nth cn ln)
    (setq nl (append nl (list (nth cn ln))))
    )
    (setq cn (+ cn 1))
    (if (= cn po)
    (setq cn (+ cn 3))
    )
    )
    (entmod nl)
    )
    )
    )
    )
    (princ)
    )

    ;;; RV
    ;;; Removes the selected vertex from a lightweight polyline
    (defun c:rv (/ ss pt e elist)
    (setq pt (getpoint "\nSelect vertex to remove: ")
    e (car (nentselp pt))
    pt (cons 10 (list (nth 0 pt) (nth 1 pt)))
    elist (drop pt (entget e))
    )
    (if (= (cdr (assoc 0 elist)) "LWPOLYLINE")
    (progn
    (setvar "cmdecho" 0)
    (command "undo" "begin")
    (entmod elist)
    (command "undo" "end")
    (setvar "cmdecho" 0)
    )
    (princ "\nThat object is not an lwpolyline.")
    )
    (princ)
    )

    ;;; DROP
    ;;; Use: (drop item lst)
    ;;; Arguments: item - the element to remove from the list
    ;;; lst - the list to remove the element from
    ;;; Returns: the list minus the selected element
    (defun drop (item lst)
    (append (reverse (cdr (member item (reverse lst))))
    (cdr (member item lst))
    )
    )
     
    BTO, Jun 14, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.