[Connect Update 16] Does MicroStation works in background mode?

Hi everybody,

We had developed for MicroStation V8i an application who works with MicroStation with no graphic interface. This application is designed to read a large quantity of dgn file to produce a unique dgn file containing a selection of some elements from the source files.
So we need to open in external mode the source file and create new elements in the destination file.
We have migrated this application on Connect Platform. Our problem with Microstation Connect is that we have an exception while creating a new element.

Below an example which crashes on the line mdlShape_create(...):

extern "C" DLLEXPORT  void  MdlMain(
  int         argc,   /* => Number of arguments passed in pargv */
  WCharCP     argv[])  /* => Array of pointers to arguments */
{
  BeFileName repAppli;
  for (int i = 0; i < argc; ++i)
  {
    if (i == 0)
      repAppli.assign(argv[i]);
  }
  mdlSystem_enterGraphicsExtended(1);
  BeFileName dgnWorkFile;
  BeFileName seedFile;
  seedFile.BuildName(NULL, BeFileName::GetDirectoryName(repAppli).GetWCharCP(), L"vide", L"dgn");
  if (BeFileName::DoesPathExist(seedFile) == true)
  {
    dgnWorkFile.BuildName(NULL, BeFileName::GetDirectoryName(repAppli).GetWCharCP(), L"test", L"dgn");
    BeFileName::BeCopyFile(seedFile, dgnWorkFile);
  }
  DgnModelRefP modelRefDepart = MODEL_REF_NULL;
  if (mdlWorkDgn_openFile(&modelRefDepart, NULL, NULL, dgnWorkFile, NULL, FALSE) == SUCCESS)
  {
    DPoint3d tabPoint[MAX_VERTICES];

    tabPoint[0].x = tabPoint[0].y = tabPoint[0].z = 0.0;
    tabPoint[1].x = 0.0;
    tabPoint[1].y = 1000.0;
    tabPoint[1].z = 0.0;
    tabPoint[2].x = 1000.0;
    tabPoint[2].y = 1000.0;
    tabPoint[2].z = 0.0;
    tabPoint[3].x = 1000.0;
    tabPoint[3].y = 0.0;
    tabPoint[3].z = 0.0;
    tabPoint[4] = tabPoint[0];
    MSElement Elm;
    mdlShape_create(&Elm, NULL, tabPoint, 5, 0);
    mdlElement_add(&Elm);
    mdlWorkDgn_closeFile(modelRefDepart);
  }
}

Can you help me?
Is there any other solution for our need?

Regards,

Hervé

Parents Reply Children