+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Forum Newbie
    Using
    AutoCAD 2009
    Join Date
    Mar 2014
    Posts
    7

    Default Draw polyline and write text above/under/near with lenght

    Registered forum members do not see this ad.

    Hello.

    I'm looking for a way to draw a polyline, where i enter the points with mouse clicking and when i click the final point and enter button, it writes in text the total lenght of polyline.

    I know that i can go to the properties and see the total lenght of the polyline and then i can use mtext to write that value near my polyline, but because i have to do that more than 1000s times, i was wondering if there is a faster way or a lisp routine.

    All ideas are welcome.
    P.S. I'm using Autocad 2009 and i'm beginner/medium user.

    Thank you

  2. #2
    Luminous Being RobDraw's Avatar
    Using
    MEP 2017
    Join Date
    Apr 2007
    Location
    Connecticut, USA
    Posts
    5,161

    Default

    There are plenty of LISPs to get the length or even total length of multiple polylines and/or lines. Additional code would be needed to add text. It won't be dynamic though. Any time the length changed, you would have to run the code again. For that reason, you would probably want something that you do after the lines are drawn and not a part of the actual drawing process.
    Drafting is a breeze.

  3. #3
    Forum Newbie
    Using
    AutoCAD 2009
    Join Date
    Mar 2014
    Posts
    7

    Default

    Thanks. I did a google search and found these lisps:

    MIDLEN - http://www.lee-mac.com/midlen.html
    LPL - http://www.kimprojects.com/sum-polyl...-autocad-lisp/
    ADDLINES - https://sites.google.com/site/cadkits/home/addlines

    Not exactly what i'm looking because i would like to that with only one command, but its better than before, because now i only have to do first the pline command and after i use one of those lisp to automatically place the text with the lenght.

  4. #4
    Forum Newbie
    Using
    AutoCAD 2009
    Join Date
    Mar 2014
    Posts
    7

    Default

    So its better first to draw the polyline and then use a lisp routine to automatically place the text label. Found this one: http://www.lee-mac.com/midlen.html
    Tried and worked like a charm

  5. #5
    Luminous Being RobDraw's Avatar
    Using
    MEP 2017
    Join Date
    Apr 2007
    Location
    Connecticut, USA
    Posts
    5,161

    Default

    I would stick with that. Any more automation might over complicate it.
    Drafting is a breeze.

  6. #6
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,723

    Default

    You can certainly change lee's code to recognise the last object created by amending the code to check if the variable SEL exists something like this but I have not changed lee's code, it would be better if he could do that, so a strange version doesn't exist, you could put the ssget part outside of the C:midline defun and pass it the SEL (defun c:midlen (SEL / *error* ......

    lee's Code has some nice stuff in it like readability

    Code:
    ; create pline by picking points press enter when finished
    (command "_pline")
    (while (= (getvar "cmdactive") 1 ) (command pause)
    )
    
    (setq sel (ssget "l"))
    (if (not c:midlen) (load "MidLenV1-1.lsp"))
    (c:midlen Sel)
    A man who never made mistakes never made anything

  7. #7
    Forum Newbie
    Using
    AutoCAD 2009
    Join Date
    Mar 2014
    Posts
    7

    Default

    Registered forum members do not see this ad.

    Thanks, BIGAL Will do that

Similar Threads

  1. Polyline lenght in block attribute
    By sakinen in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 30th May 2016, 08:14 am
  2. Draw polyline from a text file data
    By duanzhuanming in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 5th Apr 2014, 07:07 am
  3. How I can write text and that text cover all area of rectangular ?
    By wanted90 in forum Student Project Questions
    Replies: 11
    Last Post: 24th Feb 2014, 12:03 pm
  4. How to draw line to extact cordinate and exact lenght?
    By dedreux in forum AutoCAD Beginners' Area
    Replies: 13
    Last Post: 16th Feb 2012, 04:25 pm
  5. Create array from text to draw polyline
    By Nugg in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 8th May 2007, 02:29 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts