[AECOsim V8i SS6 C++ TriForma] Adding a DataGroup[DG] to an existing element leads to Access Violation.

Hi,
There are still a lot of V8 installation in the world, so I would like to extend some Elements with DG in V8. There is a sample “DGExamples” of low quality (unused functions, magic texts, link issues, etc.) as documentation. After reading and understanding (hopefully) the core of this sample, I got these few lines to add something to an existing element:


if (SUCCESS == mdlAssoc_getElementDescr(NULL, &ulFilePos, ullSchaleElmId, pModelRef, TRUE))
{
   ElementRef ElmRef = mdlModelRef_getElementRef(pModelRefReal, ulFilePos);

   if (NULL != ElmRef)
   {
      Bentley::Building::Elements::BuildingEditElemHandle beeh(ElmRef, pModelRef);
      std::wstring _catalogTypeName;
      std::wstring _catalogInstanceName;

      _catalogTypeName = L"Door";
      _catalogInstanceName = L"x_Single Flush Panel";

      beeh.GetCatalogCollection().InsertDataGroupCatalogInstance(_catalogTypeName, _catalogInstanceName);
      beeh.GetCatalogCollection().UpdateInstanceDataDefaults(L"Door");


      //std::wstring const itemXPath = L"Door/Door/@DoorMaterial";
      //std::wstring const itemValue = L"Wood";
      //CCatalogSchemaItemT* pSchemaItem = NULL;
      //if (NULL != (pSchemaItem = beeh.GetCatalogCollection().FindDataGroupSchemaItem(itemXPath)))
      //   pSchemaItem->SetValue(itemValue);

      nRetErfolg = beeh.Rewrite();;
   }
}

This is just to test, and yes, ElementHandle and ModelRefP are valid, and I know, I uses magic-text, too Blush


Beeh seems to contain something, and beeh.GetCatalogCollection() does not return NULL or something funny.


But InsertDataGroupCatalogInstance() will throw a really heave exception with memory violation at 0x05.


Seems there is missing some initialization, but I did not find something in the help or sample.

What could I do?

Parents Reply
  • could you send unreleased ABD SS6 SDK to me also?

    Your Forum biography is empty!  We don't know who you are.  is a member of the BDN, has a bio and contributes regularly to this Forum. 

    If you want Bentley Systems to treat you in a special way, such as handing out an unpublished SDK, then you should at least complete your bio.  That doesn't guarantee you special treatment, but at least will give Bentley Systems an idea about your motives behind your request.

    Volker and I are independent software developers (ISDs); we don't work for Bentley Systems.

     
    Regards, Jon Summers
    LA Solutions

Children