![]() |
#1
|
|||
|
|||
Batch translate compressed files to DXF
I need a macro that takes all files in a dir and loads them in ME10 and then store them with same name +.dxf.
|
#2
|
||||
|
||||
Re: Batch translate compressed files to DXF
See the recent discussion at http://cocreateusers.org/forum/showthread.php?t=6134
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ |
#3
|
|||
|
|||
Re: Batch translate compressed files to DXF
What I have are directories full of compressed mi files with no mi extension, so I can not use the batch translate MI to DXF in the provided translator. I need a macro that will translate these files to the standard model interface mi file and also add the mi extension. At that point I can use the batch translation function of the translator.
|
#4
|
|||
|
|||
Re: Batch translate compressed files to DXF
Hello,
Test this macro. You must hace a repertory 'C:\temp' Input the macro file and run the macro with a the directory of the drawing for parameter: creerdxf 'C:\xxx\xxx\drawing_repertory' DEFINE net_fin_lig |
#5
|
||||
|
||||
Re: Batch translate compressed files to DXF
Here is a macro which I think will do what you want. It will attempt to load all the files in the current directory and save them as MI with a ".mi" appended to the loaded file name. You can set the current directory by opening any file in a directory before running the macro or using the CURRENT_DIRECTORY command. Or you can replace the '.' in the CATALOG line of the macro with a directory path. If you want to convert directly to DXF then comment the STORE MI... line and uncomment the STORE DXF... line.
It is not very sophisticated. It will convert all the files it can load and does not check the type. But based on your description of what you have I think it will work. It will only convert the files in the specified directory, it will not convert any files in subdirectories under that directory. Edit: The original macro was corrected per the discussion below. Code:
DEFINE Convert_all_to_mi { Convert all files in current directory to MI files} LOCAL Tmp_file_name LOCAL File_name LOCAL Fileline LET Tmp_file_name (MAKE_TMP_NAME) CATALOG_LAYOUT (RPT ' ' 256) END DEFINE_CATALOG 'file_name' 1 1 CATALOG '.' SELECT 'FILE_TYPE' 'Reg' DEL_OLD Tmp_file_name OPEN_INFILE 1 Tmp_file_name { Read and discard the first 4 lines which are header info } READ_FILE 1 Fileline READ_FILE 1 Fileline READ_FILE 1 Fileline READ_FILE 1 Fileline { Attempt to load each file in the list and save as MI if successful } LOOP READ_FILE 1 Fileline EXIT_IF (Fileline='END-OF-FILE') LET File_name (TRIM Fileline) RESET_SYSTEM CONFIRM TRAP_ERROR LOAD File_name IF (CHECK_ERROR) DISPLAY_NO_WAIT ('Could not load file: ' + File_name) ELSE STORE MI ALL DEL_OLD (File_name + '.mi') {STORE DXF V1018 ALL DEL_OLD (File_name + '.dxf')} { to delete the original file uncomment the following line } {PURGE_FILE File_name CONFIRM} END_IF END_LOOP CLOSE_FILE 1 PURGE_FILE Tmp_file_name CONFIRM END END_DEFINE
__________________
John Scheffel |
#6
|
||||
|
||||
Re: Batch translate compressed files to DXF
do you really need a MACRO?
why not using a shell script / Batch_file mode Code:
dxfdwg [-option] [-t] [-k] [-b batch_file] [-e config_file] [-f source [dest [log]]] just tested: dxfdwg.exe -o -f d:\A4 d:\a4.2.dxf works fine. If with the -b batch_file mode its working fine. I assume the -o option is unkown to you?
__________________
|
#7
|
||||
|
||||
Re: Batch translate compressed files to DXF
Quote:
"Not an ascii MI file!'
__________________
John Scheffel |
#8
|
|||
|
|||
Re: Batch translate compressed files to DXF
I tried this macro and it loads the first file in the directory and then saves that file to every other filename in the directory if that makes sense. It never deletes the first file and load the next.
|
#9
|
||||
|
||||
Re: Batch translate compressed files to DXF
Quote:
You did not mention that you wanted to delete the original files. I added a commented line to the macro to do that, but be aware that if the conversion does not work correctly you will still lose the original files. I would recommend against uncommenting it.
__________________
John Scheffel |
#10
|
|||
|
|||
Re: Batch translate compressed files to DXF
Thanks John for all of your help...I have been in an out of town the past few weeks and did not have a chance to try your previous macro until today. Where might I find the updated macro?
Thanks again, Mark |
#11
|
|||
|
|||
Re: Batch translate compressed files to DXF
I see that you updated the original in the previous post. I works great...Thanks again, this will save me a lot of time.
Mark |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|