+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14
  1. #11
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,745

    Default

    Registered forum members do not see this ad.

    Do you want in one drawing, rather than multiple ?

    Will try to find time to do something.
    A man who never made mistakes never made anything

  2. #12
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Sep 2015
    Posts
    15

    Default

    In multiple drawings ideally. I really appreciate your help, the majority of this sort of thing is lost on me at the moment

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

    Default

    Ok this is very first step get the read file working, next will be to write a script and repeat for multiple files. Try it by just changing the file name at end. Thanks also to lee-mac.

    Code:
    ; tunnel takes a txt file ignores lines that are not xy description
    (vl-load-com)
    ;;-------------------=={ Parse Numbers }==--------------------;;
    ;;                                                            ;;
    ;;  Parses a list of numerical values from a supplied string. ;;
    ;;------------------------------------------------------------;;
    ;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
    ;;------------------------------------------------------------;;
    ;;  Arguments:                                                ;;
    ;;  s - String to process                                     ;;
    ;;------------------------------------------------------------;;
    ;;  Returns:  List of numerical values found in string.       ;;
    ;;------------------------------------------------------------;;
    
    (defun LM:ParseNumbers ( s )
      (
        (lambda ( l )
          (read
            (strcat "("
              (vl-list->string
                (mapcar
                  (function
                    (lambda ( a b c )
                      (if
                        (or
                          (< 47 b 58)
                          (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
                          (and (= 46 b) (< 47 a 58) (< 47 c 58))
                        )
                        b 32
                      )
                    )
                  )
                  (cons nil l) l (append (cdr l) (list nil))
                )
              )
              ")"
            )
          )
        )
        (vl-string->list s)
      )
    )
    
    (defun tunnel (fname / x xyzlist xyz)
    (setq fo (open fname "R"))
    (command "_pline")
    (while (= (getvar "cmdactive") 1 )
    (while (setq newline (read-line fo))
    (if (or (= (substr newline 1 1 ) "+")(= (substr newline 1 1 ) "-"))
    (progn
    (setq xyzlist (LM:ParseNumbers newline))
    ;(setq xyz (strcat (rtos (nth 0 xyzlist)2 4) "," (rtos (nth 1 xyzlist)2 4))) 
    ;(command xyz) ; co-ords of line
    (command (list (nth 0 xyzlist) (nth 1 xyzlist) 0.0))
    );progn
    (princ "skip")
    );if
    ); while read file
    (command "") ; end line
    ) ; end pline while
    );defun
    
    ; run code
    (tunnel "C:\\acadtemp\\175475BK.txt")
    ;(command "saveas" "c:\\cadtemp\\175475BK" "close")
    Last edited by BIGAL; 8th Oct 2015 at 11:04 pm.
    A man who never made mistakes never made anything

  4. #14
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Sep 2015
    Posts
    15

    Default

    Registered forum members do not see this ad.

    When running that .lsp it returns an error:

    first test.lsp successfully loaded.
    Command: _pline
    Specify start point: ; error: bad argument type: FILE nil
    Specify start point:
    Command:
    Specify start point: *Cancel*
    Command: *Cancel*
    Any ideas?

Similar Threads

  1. AutoLisp Error Handling - Command in Custom Error Causes Error
    By RonnieMoore in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 8th Nov 2013, 05:28 pm
  2. Tutorial: Create a custom command for AutoCAD using AutoLISP
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 16th Jul 2012, 08:50 pm
  3. Custom Command in Command line
    By goonkt in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 4
    Last Post: 6th Jul 2012, 06:37 pm
  4. Replies: 6
    Last Post: 15th Nov 2011, 02:27 pm
  5. Autolisp for custom blocks.
    By cadsultant in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 8th Apr 2005, 08:24 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