最好能有代码样例
To iterate models in a design file, you can use mdlDgnFileObj_traverseModelIndex function.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Answer Verified By: Actual Yang
Is there any example that use this function. I can't find information from the help docs.
I am not aware of any example using this function, but a proper code can be derived from other functions using callbacks ... they are more of them in MDL API and it's quite standard approach in C programming.
The code should be something like
// Callback function int traverseModelIndexCallback ( int* pMayContinue , MSWChar* modelName , MSWChar* modelDesciption , int modelType , BoolInt is3D , BoolInt isLocked , ModelID modelID , BoolInt isDefault , BoolInt isHidden , DgnFileObjP dgnFileObj , void* pUserData ) { // Do whatever need here *pMayContinue = TRUE; return SUCCESS; } { // in code mdlDgnFileObj_traverseModelIndex (traverseModelIndexCallback, NULL, mdlModelRef_getDgnFile(ACTIVEMODEL)); }
pCallbackArg parameter is often used to pass pointer to e.g. own structure (e.g. array, list or smilar), so inside callback function it's possible to access this structure (through pUserData) and no global (bad dirty) variable(s) is needed.
Thanks. I also find the doc in MDL function reference.