Jump to content

open in autocad *.sv$,*.bak,*.dwg files


Guest

Recommended Posts

Hi i have a problem and i need some help :)

 

Same times when i do right click in mtext editor autocad gives me a FATAL ERROR and then i lose my drawing. The name usually looks something like- my_drawing_1234567_08_04_29.sv$ and my_drawing_1234567_08_04_29.bak and some times to - my_drawing_1234567_08_04_29.dwg

 

All this files are in a hiden file in C:\\Users\\Administrator\\AppData\\Local\\Temp

 

I am searching for a lisp that finds the hiden file and show me only the

*.sv$,*.bak,*.dwg files

 

Then to give the option to open *.sv$,*.bak,*.dwg without rename *.sv$,*.bak to *.dwg

 

1) Give User name (and use as defoult Administrator)

I don't know if it is possible to understand the user name automaticaly

 

2) open *.sv$,*.bak,*.dwg

 

 

Thanks

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

  • ReMark

    9

  • hanhphuc

    6

  • SLW210

    4

  • Dana W

    3

Top Posters In This Topic

Posted Images

Here is a snippet of code to get you started.

 

(setq *acad* (vlax-get-acad-object)) ;Get the acad object

(setq pref (vlax-get-property *acad* 'Preferences)) ;Get the preferences property from the acad object

(setq files (vlax-get-property pref 'Files)) ;Get the files property from the preferences property

(setq tmpfilepath (vlax-get-property files 'TempFilePath)) ;Get the temp file path from the files property

 

Hope that this helps!

 

regards,

 

Hippe013

Link to comment
Share on other sites

None of those files will open in AutoCad, except the *.dwg file. The only one that will open even by renaming is the *.bak file, and it has to be renamed to *.dwg first.

 

The other one, *.sv$ is a temporary automatic save file, and it can only be used through the drawing recover utility. As a matter of fact, the drawing recover utility will find all these files for you and give you a choice as to which one to open. Usually the one with the latest date and time, is the best choice.

Link to comment
Share on other sites

The only one that will open even by renaming is the *.bak file, and it has to be renamed to *.dwg first.

 

The other one, *.sv$ is a temporary automatic save file, and it can only be used through the drawing recover utility.

 

A file with the SV$ extension can be renamed to DWG and be opened in AutoCAD.

 

Sorry Dana, I don't mean to disagree, just wanted to point it out that a SV$ file can also be renamed to DWG.

Link to comment
Share on other sites

A file with the SV$ extension can be renamed to DWG and be opened in AutoCAD.

 

Sorry Dana, I don't mean to disagree, just wanted to point it out that a SV$ file can also be renamed to DWG.

You're probably correct. I am glad someone is. :D I think there is another file created for recovery that can't be renamed because it is a totally different format, and I haven't looked it up, so I don't know what it is right now. I probably have the sv$ file confused with it. For some reason I just don't get a lot pf crashes, so I don't remember if there even is another file.
Link to comment
Share on other sites

There is another file created with the extension .ac$ and it is a temporary file. These types of files will normally be deleted when AutoCAD is closed correctly but may be left behind if AutoCAD crashes or terminates abnormally. Files of this type do not contain any drawing data that can be recovered so consider them useless if discovered and delete them.

Link to comment
Share on other sites

All this files are in a hiden file in C:\\Users\\Administrator\\AppData\\Local\\Temp

I am searching for a lisp that finds the hiden file and show me only the

*.sv$,*.bak,*.dwg files

 

Then to give the option to open *.sv$,*.bak,*.dwg without rename *.sv$,*.bak to *.dwg

 

1) Give User name (and use as defoult Administrator)

I don't know if it is possible to understand the user name automaticaly

 

2) open *.sv$,*.bak,*.dwg

 

 

 

Thanks

 

try this old thread ?

HTH

Link to comment
Share on other sites

Hi I try this but i think i have a problem with the user name . I want to have the option to change it

 

(defun c:fetemp (/ admin)
(setq [color="red"]admin [/color](cond ((getreal  "\n Give user name (example George) : "))(George)))
getfiled "Select a file" "C:\\Users\\[color="red"]admin[/color]\\AppData\\Local\\Temp" "*.sv$,*.bak,*.dwg" 
 (princ)

 

Thanks

Link to comment
Share on other sites

I update the code to

 

(defun c:fetemp (/ admin f)
(setq admin (cond ((getreal  "\n Give user name (example George) : "))(George)))
   (if (setq f (getfiled "" "C:/Users/admin/AppData/Local/Temp" "sv$ bak dwg" 16))
       (startapp "explorer" f)
   )
   (princ)
)

 

But i have this problems

 

1) I canot change the user name in the path

2)How to write this "sv$ bak dwg"

 

Thanks

Link to comment
Share on other sites

1) I canot change the user name in the path

2)How to write this "sv$ bak dwg"

 

Thanks

 

1.getstring & strcat

2.sami colon

 

(defun c:fetemp	(/ admin f)
 (if (eq (setq admin ([color="red"]getstring[/color] t "\n Give user name (example George) : ")) "")
   "George"
   ) ;_ end of if
 (if (setq f (getfiled "" ([color="red"]strcat [/color]"C:\\Users\\" admin "\\AppData\\Local\\Temp") [color="red"]"sv$;bak;dwg"[/color] 16))
  (startapp "explorer" f)
   ) ;_ end of if
 (princ)
 ) ;_ end of defun

;what to do next?
[color="red"][EDIT]: you can't directly open sv$ & .bak ![/color]

 

i prefer this as default temp

  (getfiled ""
     (getvar "tempprefix")
    "sv$;bak;dwg" 16)

Link to comment
Share on other sites

I know ,the only think i whant is to open me the folder and the i will rename the files to dwg to plen the

you can try

vl-file-rename (example in post#6)

or

vl-filename-mktemp

to avoid conflict name

 

good luck:)

Link to comment
Share on other sites

I thy to use

(getfiled ""

(getvar "tempprefix")

"sv$;bak;dwg" 16)

 

but i dont know how !!

 

(defun c:fetemp	
((getvar "tempprefix") "sv$;bak;dwg" 16)
  (startapp "explorer" f)
)
 (princ)

Link to comment
Share on other sites

Can you show me how?

 

Thanks

 


http://www.cadtutor.net/forum/showthread.php?89186-Movebak&p=610918&viewfull=1#post610918
(defun C:bak (/ fn path dwg) ;v1.1
 (if (setq fn (getfiled "Select file" (getvar "tempprefix") "sv$;bak;dwg" 2))
   (setq path (strcat (vl-filename-directory fn) "\\")
  dwg  ([color="blue"]vl-filename-mktemp[/color] [color="red"]"george_"[/color] path ".dwg") ; <--- example george
  fn   (if (/= (strcase (vl-filename-extension fn)) ".DWG")
	 ([color="blue"]vl-file-copy[/color] fn dwg t)
	 dwg
	 ) ;_ end of if
  ) ;_ end of setq
   (princ "Failed! *cancel*")
   ) ;if
 (terpri)
 (if path
   (command "shell" (strcat "explorer \"" path))
   ) ; optional: open the destination folder
 (princ)
 ) ;bak

my apology

vl-file-copy to avoid conflict.

Link to comment
Share on other sites

  dwg  (vl-filename-mktemp "george_" path ".dwg") ; <--- example george

 

1) Is it posiible to keep (the original name of the file _backup.dwg) and nor george001.dwg

2) if the file needs recover can we add a command to do it ?

 

Thanks

Link to comment
Share on other sites


http://www.cadtutor.net/forum/showthread.php?89186-Movebak&p=610918&viewfull=1#post610918
(defun C:bak (/ fn path dwg) ;v1.1
 (if (setq fn (getfiled "Select file" (getvar "tempprefix") "sv$;bak;dwg" 2))
   (setq path (strcat (vl-filename-directory fn) "\\")
  dwg  ([color="blue"]vl-filename-mktemp[/color] [color="red"]"george_"[/color] path ".dwg") ; <--- example george
  fn   (if (/= (strcase (vl-filename-extension fn)) ".DWG")
	 ([color="blue"]vl-file-copy[/color] fn dwg t)
	 dwg
	 ) ;_ end of if
  ) ;_ end of setq
   (princ "Failed! *cancel*")
   ) ;if
 (terpri)
 (if path
   (command "shell" (strcat "explorer \"" path))
   ) ; optional: open the destination folder
 (princ)
 ) ;bak

my apology

vl-file-copy to avoid conflict.

 

Dear hanhphuc.

good idea , only rename ? open the temp folder ? I think can rename it ,and open it ? no need open the temp folder.

Link to comment
Share on other sites

  dwg  (vl-filename-mktemp "george_" path ".dwg") ; <--- example george

 

1) Is it posiible to keep (the original name of the file _backup.dwg) and nor george001.dwg

2) if the file needs recover can we add a command to do it ?

 

Thanks

 

1) george_ replaced

(vl-filename-mktemp  [color="red"](strcat (vl-filename-base fn) "_")[/color] path ".dwg")

 

 

 

2) i dont really understand comment, the routine just create new dwg name (not rename), so i think no conflict. you can keep or delete it safely

 

 

Dear hanhphuc.

good idea , only rename ? open the temp folder ? I think can rename it ,and open it ? no need open the temp folder.

 

replace this

[color="#696969"](if path
   (command "shell" (strcat "explorer \"" path))
  ) ; optional: open the destination folder [/color]

to

[color="red"]  (if path (vla-open (vla-get-Documents (vlax-get-Acad-Object)) dwg :vlax-false))[/color] ;<-- MDI mode

make sure

(vl-load-com)

Edited by hanhphuc
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...