Alex Charles
Guest
|
Posted:
Sun Mar 13, 2005 10:42 pm Post subject:
Drafix Macro Help |
|
|
I need some help using a Macro to run in Drafix Cad to convert .cad
files to .dwg. I found a pretty close example in the help menu and tried to
modify it to do a mass convert and it almost works. It converts the files
and I can read the resulting .dwg in Quickcad but AcadLT97 and
VoloviewExpress 2.01 both complain about invalid file format. Now here is
the kicker, If I convert the files individually in Drafix all three apps can
open the resulting .dwg no problem. Any help appreciated. (macro below)
Thanks
Alex
Macro below:
______________
NUMBER nLengthLessExtension;
STRING sImportFileSpec, sImportFullPath, sImportFileName, sImportFilter;
STRING sConvertDirectory, sExportFileName, sExportFilter, sExportExtension;
HANDLE hPath, hFile;
sConvertDirectory = "C:\\CAD\\CONVERT\\"; //NOTE: "\\" enters "\"
sImportFileSpec = "*.CAD";
sExportExtension = ".DWG";
sImportFilter = "cad";
sExportFilter = "dwg";
sImportFullPath = sConvertDirectory + sImportFileSpec;
SetData("PathDrawing", sConvertDirectory);
procedure PROC_OpenConvertClose()
{
hFile = Import("drawing", sImportFileName, sImportFilter);
nLengthLessExtension = StringLength(sImportFileName) - 4;
sExportFileName = StringMiddle(sImportFileName, 1, nLengthLessExtension) +
sExportExtension;
Export("drawing", sExportFileName, sExportFilter);
Execute("menu", "FileClose");
}
if(hPath = Open("directory", sImportFullPath, "normal"))
{
while (GetNextFile(hPath, &sImportFileName))
PROC_OpenConvertClose();
Close("directory", hPath);
}
Exit(%ok, "Finished running macro.");
|
|