[ProStructures CE (local build from latest code from RE repo as of 12/27/2021), C#] Error attaching ECData to Element.

Hi, I am trying to attach data of an ECClass to an element and keep getting this exception:

Bentley.Exceptions.EnvironmentalException : CreateInstanceOnElement failed with error code: 6

This is NOT my first ECData class or schema. I have created 3 others (about 2 years ago) that work fine. 1 is ECXAttrubutes and it attached to the DgnFile, the other 2 are ECXData and are attached to Elements.

This new Schema  imports successfully, but throws the exception when I try to attach to an element as follows:

DgnECInstanceEnabler instanceEnabler = DgnECManager.Manager.ObtainInstanceEnabler(ActiveDgnFile, baseDataClass);
if (instanceEnabler.SupportsCreateInstanceOnElement)
StandaloneECDInstance instance = instanceEnabler.SharedWipInstance;
IDgnECInstance dgnInstance = instanceEnabler.CreateInstanceOnElement(callout, instance, false); // <<-- exception is thrown HERE
SetProperties(dgnInstance, bData);

callout is a TextNodeElement

instance is the correct ECClass from my schema

I modeled this new Class and the import and attachment process after one of my existing ECXData classes and for whatever reason it is not working?

I have tried stripping my Class down to barebones and still I get this exception.

I feel like I'm missing something small but, unfortunately, "failed with error code: 6" is not very helpful?

Parents Reply
  • ECClass mainClass = new ECClass(DataClassName, true); 

    It would help if the documentation were more complete.  DgnPlatformNet help fails to document the ECClass constructor and its arguments.


    The SDK examples don't help: ..\examples\IModels\DgnIModelNETExample\src\SampleECProvider.cs uses an undocumented interface IECClass, which has only one argument (the class name).

    How about better documentation, ?

    Using good old Bentley Class Editor from V8i SDK to check whether schema is correct. Even though this tool is obsolete, designed for V8i, is still valuable for these types of analysis

    Good suggestion!  Can anyone explain why there isn't a CONNECT version of the Class Editor?

    Regards, Jon Summers
    LA Solutions

No Data