+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Senior Member hosyn's Avatar
    Using
    AutoCAD 2014
    Join Date
    Mar 2011
    Posts
    269

    Question Load again the latest lisp file loaded???

    Registered forum members do not see this ad.

    Hey guys
    Are there approach for load again the latest lisp file loaded from some lsp file??

  2. #2
    Full Member
    Using
    AutoCAD 2014
    Join Date
    Dec 2010
    Posts
    94

    Default

    I have a .lsp file on my desktop that loads other useful lisp files.

    Code:
    (defun openuseful ( / )
      (load "...\\lisp\\cabling\\movetofrom.lsp")
      (load "...\\lisp\\alp\\alp3.lsp")
      (load "...\\lisp\\furn\\furn_v5.lsp")
      ...
    )
    (openuseful)
    You can also make Autocad auto-load a list of files that you provide.

    But lisp does not remember which function is on which file.
    Like you cannot write a function
    (defun detectCurrentLispFile (/) ... ) . That question would not make sense to lisp.

  3. #3
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,591

    Default

    Quote Originally Posted by hosyn View Post
    Hey guys
    Are there approach for load again the latest lisp file loaded from some lsp file??
    What exactly do you mean?

    Are you loading a lisp file, then while you're working, someone is updating the code and you want to load it as soon as the file is updated?
    R.K. McSwain
    CAD Panacea | twitter

  4. #4
    Senior Member hosyn's Avatar
    Using
    AutoCAD 2014
    Join Date
    Mar 2011
    Posts
    269

    Default

    Quote Originally Posted by rkmcswain View Post
    What exactly do you mean?

    Are you loading a lisp file, then while you're working, someone is updating the code and you want to load it as soon as the file is updated?
    Yup, this is exactly what I need. (after updating code)

  5. #5
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,591

    Default

    And you want it to do this automatically, with no human interaction?

    I suppose you'll need a reactor, and a function that can read the file dates. (some examples here possibly)

    1. Load the function, and read/store the file date on the file.
    2. Have the reactor check the file every so often (30 sec?), and if the file date/time is newer, repeat step 1.
    R.K. McSwain
    CAD Panacea | twitter

  6. #6
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Oct 2015
    Posts
    101

    Default

    I use this:


    Code:
    (defun c:appreload ()
    ;;Re-load named LISP files
    
    (setq mylispfolder "c:\\Users\\.....\\......\\")
    
      (setq myfiles (vl-directory-files mylispfolder "*.lsp" nil)) ;;myfiles is list of files in mylispfolder location
      (setq mylistlength (length myfiles)) ;;count of number of lsp files
    
      (setq acount -1)
      (repeat mylistlength
        (setq acount (1+ acount))
        (setq FailedtoLoad (strcat (nth acount myfiles) " failed to load"))
        (load (strcat mylispfolder (nth acount myfiles)) FailedtoLoad) ;;Loads each LISP file
      )
    )

    which will load all the LISP files within a location. I use it when I have updated a LIPS 'appreload' and its reloads (I have a folder with all my LISPS in it)

    However it won't reload a LISP file as soon as its been updated you still need to type in the command. For al the time that takes and the time it would take to research and write a code to do this automatically is it worth the effort?

  7. #7
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,702

    Default

    Registered forum members do not see this ad.

    If your writing and testing just make a temporary defun takes about 30 seconds.

    Code:
    (defun c:aaa ()(load "mynewprogram"))
    A man who never made mistakes never made anything

Similar Threads

  1. load lisp if its not already loaded
    By samifox in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 13th Jul 2017, 08:13 am
  2. Path Lisp File Loaded
    By FELIXJM in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 21st Nov 2012, 01:52 pm
  3. How to detect if a dimstyle is loaded and load if it isn't
    By Grigs in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 12th Dec 2011, 06:55 am
  4. calling commands from loaded arx file using lisp function (command)
    By LibertyOne in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 3rd May 2011, 01:43 pm
  5. can anyone write me a lisp file for opening a latest drawing
    By vnk172004 in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 21st Jul 2009, 08:14 pm

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