Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
We are using Creo Parametric Release 10.0 and Datecode10.0.0.0
How can we get the `ProMdl` handle of an embedded part (the part itself, not of the part occurrence) using the Pro/Toolkit API?
I know that we can get the `ProMdl` handle of the part occurrence in the assembly via the assembly `ProMdl` --> `ProSolidFeatVisit` --> filter for `PRO_FEAT_COMPONENT` --> `ProAsmcompMdlGet`.
But we need the `ProMdl` handle of the actual part, not of the occurrence - in order to inspect the geometry before assembly-level features were applied.
For normal (non-embedded) parts, we would use:
ProMdl mdl;
ProError err = ProMdlFiletypeLoad(path, PRO_MDLFILE_UNUSED, PRO_B_FALSE, &mdl);
This works fine for normal paths like "C:\models\PRT0001.prt.1", but for an embedded component's virtual path like "C:\models\PRT0002<<ASM0001>>.prt", it returns `PRO_TK_INVALID_NAME`.
In the Creo Parametric UI, one can right-click the embedded part and click "Open" to see it in its own window.
Is there a way to do this via the Toolkit? Then we could get the `ProMdl` handle via `ProMdlActiveGet`.
~~ Samuel Scharrer
Hi,
please ask PTC Support.
Due to the component path the Model Handel is persistent, the model is always unique in session. Maybe you explain your embedded model, and what you trying to do here😉
Hello @RPN, thank you for your response. I will try to explain it using two screenshots.
The first attached screenshot shows an assembly "ASM0001.asm.1", which contains one embedded part and one assembly-level borehole feature.
When I right-click the embedded part component "PRT0001<<ASM0001>>" there and select "Open", it opens the embedded part by itself in a new window, as shown in the second screenshot. As you can see, it does not have a borehole, because that is part of the assembly and not the part itself.
Now, in the Pro/Toolkit API, if I...
...then I get a ProMdl handle which represents the part occurrence in the assembly.
Querying its faces returns the geometry which has the assembly-level borehole feature already applied.
Instead, I would like to get the ProMdl handle which represents the part by itself, as shown in the second screenshot, so that my software can inspect that part's original geometry before assembly-level features were applied.
~~ Samuel Scharrer
Okay, could you share your sample? No forget it, I did it by myself 🙂
And this Function is not useful?
extern ProError ProAsmcompExtract(ProSelection comp_sel, ProMdlName newMdlName);
Purpose: Extract selected component with input new name.
extern ProError ProAsmcompEmbeddedOwnerMdlGet(ProMdl embedded_mdl, ProMdl *p_owner_mdl);
Purpose: Returns non embedded owner model handle for the input embedded model.
But your Assembly does contain the hole as an assembly feature, so this is true even if not using separable models.
Here the reason for ProAsmcompExtract()
The Box is not in session, this is fun 🙂