I've got a large number of pre-CONNECT Xttribute definitions that I want to "convert" into ItemTypes. I started to manually input the data (mainly strings) and decided it would be less error prone if I could programatically insert them instead of manually entering them. In my app, I've got the ECSchemaPtr to the ItemType library that I want to insert the data into, but there must be more required to add an ItemType to a ItemTypeLibrary than just adding in a ECClass. My app creates the new ECClass in the schema, and completes with any (known) errors, However, when I attempt to open the Item Types dialog, CONNECT crashes.
CreateNewClassECN::ECSchemaPtr schemaPtr); { ECObjectsStatus ecStatus; ECClassP pClass=nullptr; // create a new class ecStatus = schemaPtr->CreateClass(pClass,L"MyFirstClass"); printf("CreateClass(), ecStatus=%d\n",ecStatus); // ecStatus=pClass->SetDescription(L"MyDescription"); printf("SetDescription(), ecStatus=%d\n",ecStatus); ecStatus=pClass->SetDisplayLabel(L"MyDisplayLabel"); printf("SetDisplayLabel(), ecStatus=%d\n",ecStatus); } DgnECManagerR dgnECManager = DgnECManager::GetManager(); SchemaKey schemaKey(L"DgnCustomItemTypes_SRSFeatureTest",1,0); // an ItemType library SchemaInfo schemaToFind (schemaKey, *ISessionMgr::GetActiveDgnFile()); ECN::ECSchemaPtr schemaPtr = dgnECManager.LocateSchemaInDgnFile (schemaToFind, ECN::SCHEMAMATCHTYPE_Latest); CreateNewClass(schemaPtr );
Bruce
Answer Verified By: Bruce Reeves SRNS