Utility that shows first point of polyline?

Discussion in 'AutoCAD' started by Bert Eding, Nov 13, 2004.

  1. Bert Eding

    Bert Eding Guest

    Is there a utility that shows where the start/end point is of a polyline?
    And also has the possibility to reverse it.
    I use acad to genereate profile for a foam cutting machine and need to
    change the direction
    of the polyline.

    Bert
     
    Bert Eding, Nov 13, 2004
    #1
  2. Bert Eding

    Paul Turvill Guest

    The LIST command will give you the starting and end points (along with other
    data).
    To reverse the direction of a polyline, LWPolyline, or other object, try
    REV.LSP from
    http://www.turvill.com/t2/free_stuff
    ___
     
    Paul Turvill, Nov 13, 2004
    #2
  3. Bert Eding

    CW Guest

    Type pedit at the command line and fallow the promts.
     
    CW, Nov 14, 2004
    #3
  4. Bert Eding

    CW Guest

    Paul, it hs been a while since I used Autocad. Been using Icad. Pedit in
    Acad won't reverse a polyline?
     
    CW, Nov 14, 2004
    #4
  5. Pedit in Acad won't reverse a polyline?

    No.

    Juergen
     
    Jürgen Palme, Nov 14, 2004
    #5
  6. Bert Eding

    Bert Eding Guest

    Hi,

    Thanks for all the info.
    I tried the rev.lsp
    But nothing happens no output error or anything., and no reversing.
    Did I do something wrong or is the tool incompatible with acad 2005?

    Bert
     
    Bert Eding, Nov 14, 2004
    #6
  7. Bert Eding

    CW Guest

    How lame. It will in Intellicad.

     
    CW, Nov 14, 2004
    #7
  8. Bert Eding

    Paul Turvill Guest

    It works with all versions. How are you attempting to use it?
    ___
     
    Paul Turvill, Nov 14, 2004
    #8
  9. Bert Eding

    Paul Turvill Guest

    Are you certain it isn't working? It isn't obvious on polylines using
    CONTINUOUS linetype. Have you tried LISTing the polyline both before and
    after using REV.LSP?
    ___
     
    Paul Turvill, Nov 14, 2004
    #9
  10. Here it also doesn't work, neiter in 2005 nor in 2004.
    Try this: Draw a polyline. Start the pedit command, Edit, the marker is
    visible at the startpoint of the polyline.
    Now start rev.lsp, pick the polyline. No error message, nothing happens.
    Start the pedit command, Edit, and the marker jumps - to the same end of the
    polyline -> not reversed.

    :-(
    Juergen
     
    Jürgen Palme, Nov 14, 2004
    #10
  11. Bert Eding

    Bert Eding Guest

    Did some more experiments with REV.

    First of all rev may conflict with the acad REVOLVE command.

    Second: When drawing a simple poly line with a few segments it works now.

    Third: With a bigger spline consisting out of a lot of segments (+/- 100) i
    get:
    ===============
    Command: (load"rev")
    Command: rev
    Pick an object to reverse:
    At least one break point must be on polyline.*Invalid*
    =================
    Acad 2005

    Bert
     
    Bert Eding, Nov 14, 2004
    #11
  12. Bert Eding

    Paul Turvill Guest

    The conflict with REVolve (not a "vanilla" AutoCAD command) is easily fixed
    by changing the name:
    (defun C:pLREV ...
    or whatever you choose. And, yes it is likely to have problems with very
    complex objects; it's intended mostly for simple pipe runs or contours where
    the user wants to reverse them to properly show text in complex linetypes.
    ___
     
    Paul Turvill, Nov 14, 2004
    #12
  13. Bert Eding

    Paul Turvill Guest

    Sorry, that is to say REV is defined as a shortcut in acad.pgp, and
    therefore isn't a core command; REVOLVE, of course, is. To resolve any
    conflict, two options exist: rename REV.LSP or change acad.pgp.
     
    Paul Turvill, Nov 14, 2004
    #13
  14. Bert Eding

    Jeff Guest

    Here's one that will place an X (just like the pedit/edit vertex command) at
    the beginning of the pline and ask if you want it reversed. The way it is
    written the pline MUST be a LWpolyline, but could be modified to accept all
    types.

    ;;Routine to show start point of pline and optionally reverse the direction
    ;;Jeff Mishler, November 2004
    (defun c:p_check (/ ANS COORDS ENT ENTLST IDX NEWCOORDS OBJ newbulges)
    ;; Marker for point location on the screen
    ;; Oct. 2004 by Jeff Mishler
    (defun Xmarksthespot (x y / leglen start)
    (setq start (list x y)
    leglen (* 0.03 (getvar "viewsize"))
    )
    (grdraw (polar start (angtof "135" 1) leglen)
    (polar start (angtof "315" 1) leglen)
    7)
    (grdraw (polar start (angtof "45" 1) leglen)
    (polar start (angtof "225" 1) leglen)
    7)
    )
    (if (and (setq ent (entsel "\nSelect polyline: "))
    (setq entlst (entget (car ent)))
    (eq (cdr (assoc 0 entlst)) "LWPOLYLINE")
    )
    (progn
    (vl-load-com)
    (setq obj (vlax-ename->vla-object (car ent)))
    (setq coords (vlax-get obj "coordinates"))
    (setq idx 0
    newcoords '()
    newbulges '()
    cnt 0)
    (xmarksthespot (car coords) (cadr coords))
    (initget "Yes No")
    (setq ans (getkword "\nReverse?: [Yes/No]"))
    (if (eq ans "Yes")
    (progn
    (while (< idx (length coords))
    (setq newcoords (append (list (nth idx coords) (nth (1+ idx) coords))
    newcoords))
    (setq newbulges (append (list (- (vla-getbulge obj cnt))) newbulges))
    (setq idx (+ 2 idx)
    cnt (1+ cnt))
    )
    (vlax-put obj "coordinates" newcoords)
    (setq newbulges (append (cdr newbulges) '(0.0)))
    (while (/= -1 (setq cnt (1- cnt)))
    (vla-setbulge obj cnt (nth cnt newbulges))
    )
    (redraw)
    (xmarksthespot (car newcoords) (cadr newcoords))
    )
    )
    )
    )
    (princ)
    )
    (princ "\n P_check loaded, type p_check to run......")
     
    Jeff, Nov 15, 2004
    #14
  15. Here it also doesn't work ...

    Ok, I found the error. In the function (defun prev ...) we see a line
    (setq zoomit (null (ssget "c" final final)))

    I modified this to
    (setq zoomit (null (ssget "_c" final final)))
    and now the rev.lsp works well like expected.


    Juergen
     
    Jürgen Palme, Nov 15, 2004
    #15
  16. Bert Eding

    Paul Turvill Guest

    Thank you, Jürgen,

    That would explain why it worked on *some* installations and not others
    (non-American English). I'll fix the one on my Web site.
    ___
     
    Paul Turvill, Nov 15, 2004
    #16
  17. Bert Eding

    Bert Eding Guest

    Hi,

    I tried it again with modified c to _c
    My poly line changed color from blue to magenta and I got this error:
    ===================
    Command: (load"revline")
    Command: revline
    Pick an object to reverse:
    At least one break point must be on polyline.*Invalid*
    ===================
    (I renamed rev to revline)

    Bert
     
    Bert Eding, Nov 15, 2004
    #17
  18. Bert Eding

    Paul Turvill Guest

    Is this one object in particular, or does this happen with all objects?

    Email me a sample drawing. Please limit the drawing file to contain nothing
    but your polyline that won't reverse.
    Send it to
    ___
     
    Paul Turvill, Nov 15, 2004
    #18
  19. Bert Eding

    Bert Eding Guest

    I know what it is,
    plinetype was zero.
    When change to 3 it works.
    Regards,
    Bert
     
    Bert Eding, Nov 15, 2004
    #19
  20. Bert Eding

    Bert Eding Guest

    Hi All

    Plrev now works, thanks and also thanks to Jeff which posted p_check.
    p_check also works, but nicely shows the begin and then asks wheter to
    reverse or not,
    when reversed it shows the changed beginpoint.

    If plrev is better, could it be changed so that it shows also the begin
    point, then ask whether to reverse,
    then show the new beginpoint?

    Bert
     
    Bert Eding, Nov 15, 2004
    #20
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.