Drafix Macro Help

Discussion in 'AutoCAD' started by Alex Charles, Mar 13, 2005.

  1. Alex Charles

    Alex Charles Guest

    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.");
     
    Alex Charles, Mar 13, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.