list file creation

Discussion in 'AutoCAD' started by Tomwin, Dec 30, 2004.

  1. Tomwin

    Tomwin Guest

    We have a lisp routine that we use for our dimensioning program. When we run it, it creates a file called LST.FL in the same folder of the drawing that we are working on. Is there some sort of simple command line we could add to the lisp file to specify where LST.FL is created?

    The lisp routine has us pick 2 points and a location for the dimension that is placed in the drawing using attdef. When we pick the points it creates the LST.FL file with the data and uses the data from it to populate the attdef fields.

    I can't post the actual code from our lisp file, hopefully someone knows an easy way to specify where to create files to be used in the lisp though.
     
    Tomwin, Dec 30, 2004
    #1
  2. You could move it:

    (vl-file-rename (strcat (getvar "dwgprefix") "LST.FL")
    "your_new_fully_qualified_file_name)

    run it, it creates a file called LST.FL in the same folder of the drawing
    that we are working on. Is there some sort of simple command line we could
    add to the lisp file to specify where LST.FL is created?
    that is placed in the drawing using attdef. When we pick the points it
    creates the LST.FL file with the data and uses the data from it to populate
    the attdef fields.
    an easy way to specify where to create files to be used in the lisp though.
     
    Eric Schneider, Dec 30, 2004
    #2
  3. Tomwin

    Paul Turvill Guest

    All you need to do is to hard-code the path wherever the filename is
    specified in the original code. Find the reference to "LST.FL" and change it
    to "D:/MyPath/LST.FL" where D:/MyPath/ is the actual path where you want the
    file to go.

    BTW, what's preventing you from posting the actual code?
    ___
     
    Paul Turvill, Dec 30, 2004
    #3
  4. The system variable "DWGPREFIX" contains the path to the drawing.
    Assuming that there is a line like

    (setq fname (strcat (getvar "DWGPREFIX") "LST.FL"))

    in your program, you can change the line to include a global variable (say
    LSTFLPath)
    and change the line above to:

    (setq fname (strcat LSTFLPath "LST.FL"))

    And create another lisp program to prompt for the path

    (defun c:LSTPath (/ flag)
    (if (not LSTFLPath) (setq LSTFLPath "C:/zzz"))
    (while (not flag)
    (setq LSTFLPath (getstring (strcat "\nEnter path to store LST.FL ["
    LSTFLPath "]: " )))
    (Prompt (if (setq flag (vl-file-directory-p lstflpath))"\nFolder Exists"
    "\nNo Folder" ))
    )
    (princ)
    )
     
    Allen Johnson, Dec 30, 2004
    #4
  5. Tomwin

    Tomwin Guest

    the only reference that i can find to LST.FL is when it says (OPEN "LST.FL" "w")

    Other than that, I can't find where it is actually being created.

    I can't post the code because it's the property of my employer and I don't want to get fired for trying to fix their problem by posting it or information that is property of them... heh
     
    Tomwin, Dec 30, 2004
    #5
  6. Tomwin

    Paul Turvill Guest

    That's the line you need to change. The (open ... "w") function in LISP
    creates a new file for writing...and overwrites an old one if it's found.
    ___
     
    Paul Turvill, Dec 30, 2004
    #6
  7. Tomwin

    MP Guest

    well, that line is where it's being created.
    see the help for Open function
    Paul's suggestion was to hard code the path at that point.

    want to get fired for trying to fix their problem by posting it or
    information that is property of them... heh
     
    MP, Dec 30, 2004
    #7
  8. Tomwin

    Tomwin Guest

    Thank you, that fixed it. I tried to path it to C:\TEMP\LST.FL but for some reason it created a file on C:\ called TEMPLST.FL

    I changed it to say just C:\LST.FL and it is working fine and creating the file on the root C:\
     
    Tomwin, Dec 30, 2004
    #8
  9. HI,

    When you define a path in lisp you need to use double backslashes, or
    forward slashes.

    eg C:\\TEMP\\LST.FL or
    C:/TEMP/LST.FL

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au

    some reason it created a file on C:\ called TEMPLST.FL
    file on the root C:\
     
    Laurie Comerford, Dec 30, 2004
    #9
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.