Need to recover code from an open dwg HELP

Need to recover code from an open dwg HELP

Anonymous
Not applicable
1,505 Views
14 Replies
Message 1 of 15

Need to recover code from an open dwg HELP

Anonymous
Not applicable

This was what happened: i was editing an AutoLISP code, when the text file had an error and closed. When i open it again, it was empty, it was all gone... Thing is, the previous code is loaded on AutoCAD and works, but i cant manage to recover the code from the running program before it close (when i close CAD and open another instance of it, the code will be loaded again, but the empty version of the file). Someone have any ideas, or i will have to code all of it again? Im a lil bit desesperated 😞

 

Sorry for my english, and thanks

0 Likes
Accepted solutions (2)
1,506 Views
14 Replies
Replies (14)
Message 2 of 15

Kyle.para
Advocate
Advocate

If you go to the folder where the code is can you right click it and open it up with notepad?

0 Likes
Message 3 of 15

Anonymous
Not applicable

Yes i can. But its empty, a 0kb file

0 Likes
Message 4 of 15

mdhutchinson
Advisor
Advisor

check the folder were your lsp file is... is there a file with file extension _LS

Type column would show _LS File

Make a copy and rename the copy to .lsp

then open that copy.

 

 

0 Likes
Message 5 of 15

john.uhden
Mentor
Mentor

If the code your were writing (and loaded) begins with (defun-q ...) then we can get it back for you.  But if it begins with (defun ...) then there's no way.  I am truly sorry about that.  The only other hope is that you loaded the code by copying and pasting into the command line, AND had LOGDILEMODE turned on.  If by some miracle that is the case, then all your code will be in a .LOG file.

 

At the command prompt, enter the name of the function preceded by an exclamation point, e.g. !myfunc, and see what it returns.

John F. Uhden

0 Likes
Message 6 of 15

Anonymous
Not applicable

There isnt any _ls file in the folder, only a few older lisp's and bak's. I have never seen that kind of extension... I was thinking, isnt there any way to get the function definition (code) of, for example, "_line"?  

0 Likes
Message 7 of 15

Anonymous
Not applicable

All of them returns nil... I did them with Defun, not defun-q (i didnt know about its existence until now)... Well, seems it has no solution 

0 Likes
Message 8 of 15

mdhutchinson
Advisor
Advisor

So let me get this right.

 

If you launch another instance of AutoCAD... the code loads and works?

0 Likes
Message 9 of 15

Anonymous
Not applicable

If i open a new tab, yes. But if i close the application and open it again, it loads the empty file, so no

0 Likes
Message 10 of 15

john.uhden
Mentor
Mentor
Accepted solution

This may be a lesson for all of us.  During program development, maybe we should all use (defun-q myfunc) so if our editor blows up at least we can retrieve all our code by writing the function's contents to a new file.  We can remove the "-q" when it's working properly.  I'm going to start with that approach from now on.  My client (singular) just authorized some new work.  I'll be &*^#ed if I'm going to lose one character of it.

 

I am always in the habit of copying and pasting my code-in-progress into the command line, rather than loading it.  So I'm going to turn on LOGFILEMODE permanently.

 

First thing to do is see if TextPad has an autosave setting.

John F. Uhden

0 Likes
Message 11 of 15

Anonymous
Not applicable

Its a hard lesson 😛 ill have to start again from the last backup tomorrow... Thank you all anyways. How do i close the thread?

0 Likes
Message 12 of 15

john.uhden
Mentor
Mentor

There's a button on each response that says something like "Accept Response as Solution."  Just pick whichever response you think applies.  After that, the topic is still open for discussion, but it will have a green checkmark next to it so that others will know a solution was found (even though in this case we couldn't "solve" your problem).

John F. Uhden

0 Likes
Message 13 of 15

Anonymous
Not applicable
Accepted solution

I came to work today and started to seek for some kind of automatic backup to prevent anything like this happens again... Im using Notepad++ to code, so i opened Preferences and started searching... There was a chequed option of autobackup every 7 seconds, and a backup path, so i opened that path and there was a backup of my code!!! Im breathing again. Thank you all Smiley Happy

0 Likes
Message 14 of 15

stevor
Collaborator
Collaborator

A rule from the beginning of computers is to BACK UP everything.

 

And, you can easily load a lsp file via a defined command,

from the command line, or from a button; quicker

 

I use Notepad2.exe, and occasionally the VLIDE  to learn,

or find some errors.

S
0 Likes
Message 15 of 15

john.uhden
Mentor
Mentor

YAY!!!

 

I also found that TextPad has an automatic save option which I turned on and set to 5 minutes.  It also has a .BAK option with every save, which is good because you never know how much I can screw up in 5 minutes.  Of course it would take me until 10am to realize I had made an error at 9am.  :[

John F. Uhden

0 Likes