Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1677

Re: [V8i C++] using FileOpenDialogPreprocess() hook to save a DWG file as DGN format.

$
0
0

Jon Summers:

Post a bit of code so we can see how you set up everthing.

else if ( (fopenParamsP->openCreate == FILELISTATTR_CREATE )  &&
         (DEFSAVEASFILE_ID == fopenParamsP->defFileId) )
{
  char    dialogTitle[128], filterString[256] /*,fileName[MAXFILELENGTH]*/;
  FileOpenExtraInfo extraInfoP;
  strcpy_s( dialogTitle, sizeof(dialogTitle), "File Save-As" );
  mdlResource_loadFromStringList(filterString, 0L, MESSAGELISTID_Filters, MSGID_FileOpenFilterString);  memset (fopenParamsP, 0, sizeof(FileOpenParams));
  fopenParamsP->openCreate     = FILELISTATTR_CREATE;
  fopenParamsP->openCreate |= FILELISTATTR_ALWAYSUSEWINOPEN;
  fopenParamsP->defaultFilterP = "*.dg8;*.dgn;*.dwg;*.dxf";
  fopenParamsP->defaultDirP    = "MS_DEF";
  fopenParamsP->titleP         = dialogTitle;
  fopenParamsP->filterInfoStrP = filterString;

  /* Set def file id so that design file history is populated in the menu */
  //fopenParamsP->defFileId      = DEFDGNFILE_ID;
  fopenParamsP->defFileId= DEFV8DGNFILE_ID;  // Saves R2013 dwg as R2010 DWG
  //fopenParamsP->defFileId= DEFV7DGNFILE_ID;  // Saves R2013 dwg as R2010 DWG
  if ( ACTIVEMODEL )
  {
    char  currentFilename[256];
    mdlModelRef_getFileName( ACTIVEMODEL, currentFilename, sizeof(outputFilename) ); // drive+folders+filename+extension
    char device[MAXDEVICELENGTH]={0}, dir[MAXDIRLENGTH]={0}, name[MAXNAMELENGTH]={0}, ext[MAXEXTENSIONLENGTH]={0};
    mdlFile_parseName(currentFilename, device, dir, name, ext );
    int  format;
    mdlDgnFileObj_getVersion( &format, NULL, NULL, mdlModelRef_getDgnFile(ACTIVEMODEL) );
    if ( format == DGNFILE_FORMAT_V8 )
        sprintf(outputFilename,"%s-copy.dg8", name );
    else if ( format == DGNFILE_FORMAT_DWG )
        sprintf(outputFilename,"%s-copyDwg.dgn", name );
    else
        sprintf(outputFilename,"%s-copy.dgn", name );
    fopenParamsP->suggestedFileNameP = outputFilename;
  }
  else
  {
    fopenParamsP->suggestedFileNameP = "c:\\newfile.dg8";
  }
}

Bruce


Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>