Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello all,
I am trying to register the server, create dummy workspace, checkout model and open the model in creo.
I am able to checkout the objects and retrieve in Creo using below code.
// here is necessary declaration
status = ProMdlnameRetrieve(lclmdlName, (ProMdlfileType)mdlType, &retrieveModal);
if (status == PRO_TK_NO_ERROR)
{
Logger::LogInfo("Model retrieved successfully");
}
/* Display the object */
status = ProObjectwindowMdlnameCreate(lclmdlName, (ProType)mdlType, &w_id);
status = ProWindowCurrentSet(w_id);
status = ProMdlDisplay(retrieveModal);
status = ProMdlWindowGet(retrieveModal,&w_id);
status = ProWindowCurrentSet(w_id);
status = ProWindowActivate(w_id);
After this code, some where in my code when I use "ProMdlCurrentGet" -> it doen't give me Promdl handle.
Am I doing wrong thing?
Thanks for the help in advance.
Harsh Patel
Hello,
the problem is that ProMdlCurrentGet grabs the model pointer from the current native Creo window. Even if no model is displayed in session, there's still such a base window. ProMdlCurrentGet doesn't consider other windows like the object window you create to display the model. Also even setting the object window to be the current window, this fact doesn't change.
What you could do:
Thanks for your explanation and prompt reply @FabianWolf
Can you please guide me how can I display the retrieved model within a Creo window ?
Regards,
Harsh Patel
This always seems to get the job done for me. I create a window, set it current, then retrieve.
strcpy(strname, AssyName);
strcpy(strname_ext, AssyName);
strcat(strname_ext, ".asm");
ProStringToWstring(name, strname);
ProStringToWstring(name_ext, strname_ext);
ProObjectwindowCreate(name_ext, PRO_MDL_ASSEMBLY, &WindowId1);
ProWindowCurrentSet(WindowId1);
tkerr = ProMdlRetrieve (name_ext, PRO_MDL_ASSEMBLY, &mdlSeriesAssy);
ProMdlDisplay(mdlSeriesAssy);
ProMdlCurrentGet does not get the handle to the model you need in session. Does it by chance return PRO_TK_BAD_CONTEXT?
If yes then the following article may apply: https://www.ptc.com/en/support/article/cs123972
Depending on the mode, the call sequence may differ (like it has been uttered by other posts).
If ProMdlCurrentGet returns another status, feel free to share it.
This is why:
try to build a simple async app.
HIH.