Getting data of the active creo model is most basic thing in Creo Customization. Here I considering to get the data of the Creo model which opened in active window.
- Create a function named getActiveModel(). The return type ProError can be modified by user as per their requirement.
- Declare the Variables required
- The creo API Enumerated type to return function calls whether it is failed or succeed.
- ProError declared to return the function status
- The top level object in the Creo parametric.
- In Part Mode the ProMdl is Part
- In Assembly Mode the ProMdl is Assembly
- We will use the ProMdl to handle the Currently active model
- Used to refer the address of the model name
- For Any Creo parametic name property, we can use ProName
- The Size of the ProName is 32
- char* & char are C/C++ datatypes to hold characters
- Call the API function ProMdlActiveGet to get the Creo model
- return the ProError value , if it is PRO_TK_NO_ERROR then the function successfully got the model else it failed.
- If model got successfully then call the API function to get the model name (model data) to verify the model is active model
- Here the consolidated code
Hope it would be useful for beginners in Creo toolkit to access the model data.
Thanks & Regards