+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Forum Newbie
    Using
    LDD 2009
    Join Date
    Oct 2012
    Posts
    5

    Default Help draw line from point # to #

    Registered forum members do not see this ad.

    I am completely new to autolisp. I am simply trying to figure out how to write a lisp that will use existing point numbers to draw a poly line to. for example, if i bring in point numbers into a drawing always numbered 1-10, no matter what coordinates they contain when they are inserted into the drawing, i would like the lisp to draw a poly line from point # 1, to 2, to 3.... etc. I know there is a macro built in to LDD that allows you to draw a line from # to # but i would like the lisp to customize myself. I also do not want to have to physically pick the points i want, i want the lisp to find the points by number. thanks in advance for any help at all.

  2. #2
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    How is the point data being imported into AutoCAD?

    -David
    R12 (Dos) - A2K

  3. #3
    Forum Newbie
    Using
    LDD 2009
    Join Date
    Oct 2012
    Posts
    5

    Default

    I am importing them using a .csv file PNEZD

    point #, northing, easting, elevation, description

  4. #4
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    You may want to post a sample of the data to ensure what are REAL numbers and what are STRings

    I would assume:
    • Point# to be an INTeger
    • northing, easting and elevations to be REAL numbers
    • Description to be a STRing

    -David
    R12 (Dos) - A2K

  5. #5
    Forum Newbie
    Using
    LDD 2009
    Join Date
    Oct 2012
    Posts
    5

    Default

    I'm not at my computer but yes you can assume exactly that.
    1, 200.44, 300.56, 256.43, Edge
    2, 212.32... Etc

  6. #6
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    This does absolutely no error checking, data checking, nada thing

    Code:
    (defun c:pt23dpl (/ file rf nl i cl pl)
    
      (while (not file)
             (setq file (getfiled "CSV Point Data File" "" "csv" 8)))
    
      (setq rf (open file "r"))
    
      (while (setq nl (read-line rf))
             (setq i 1 cl nil)
             (repeat (strlen nl)
                     (if (= "," (substr nl i 1))
                         (setq cl (cons i cl)))
                     (setq i (1+ i)))
             (setq cl (reverse cl))
             (setq pl (cons (list (atof (substr nl (1+ (nth 1 cl))
                                                   (- (nth 2 cl) (nth 1 cl) 1)))
                                  (atof (substr nl (1+ (nth 0 cl))
                                                   (- (nth 1 cl) (nth 0 cl) 1)))
                                  (atof (substr nl (1+ (nth 2 cl))
                                                   (- (nth 3 cl) (nth 2 cl) 1)))) pl)))
      (close rf)
    
      (command "_.3DPOLY")
      (apply 'command (reverse pl))
      (command "")
    
    (prin1))

    The data must be in the exact order as described and without any blank lines. AS IS!

    Have fun! -David
    Attached Files
    R12 (Dos) - A2K

  7. #7
    Forum Newbie
    Using
    LDD 2009
    Join Date
    Oct 2012
    Posts
    5

    Default

    INCREDIBLE! i appreciate all of the help, i realize how time consuming that must have been. i will play with it and come back with questions. thank you thank you!

  8. #8
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,799

    Default

    Throw your csv into excel and make a script 1st pass is insert points 2nd pass join lines 3rd pass insert blocks on certain points. this is known as stringing and their are commercial packages available.
    A man who never made mistakes never made anything

  9. #9
    Super Member David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    1,926

    Default

    Quote Originally Posted by BELIEW View Post
    INCREDIBLE! i appreciate all of the help, i realize how time consuming that must have been. i will play with it and come back with questions. thank you thank you!
    I'm glad it worked. There would be a good many things needed to be added in order to be considered a robust routine. -David
    R12 (Dos) - A2K

  10. #10
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,799

    Default

    Registered forum members do not see this ad.

    Using excel could be done here is a snap shot of how to just copy column to command line

    Excel stringer.png
    A man who never made mistakes never made anything

Similar Threads

  1. Draw a line from points divided to a point that i pick.
    By j_spawn_h in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 27th Nov 2011, 07:07 pm
  2. Replies: 1
    Last Post: 29th Aug 2011, 10:00 pm
  3. Replies: 0
    Last Post: 29th Aug 2011, 09:52 pm
  4. draw perpendicular line by giving point
    By vivekgrs in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 20th Nov 2009, 09:56 am
  5. how to draw line from base point
    By smiles in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 10th Oct 2007, 01:55 am

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