cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Get the ProMdl handle of an embedded part of an inseparable assembly using Pro/Toolkit

hkunze
2-Guest

Get the ProMdl handle of an embedded part of an inseparable assembly using Pro/Toolkit

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

5 REPLIES 5

Hi,

please ask PTC Support.


Martin Hanák
RPN
17-Peridot
17-Peridot
(To:hkunze)

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😉

hkunze
2-Guest
(To:RPN)

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...

  1. Start with the assembly's ProMdl handle,
  2. and iterate its features with ProSolidFeatVisit with a filter for type PRO_FEAT_COMPONENT and name PRT0001<<ASM0001>>,
  3. and then retrieve that component feature's model using ProAsmcompMdlGet,

...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

RPN
17-Peridot
17-Peridot
(To:hkunze)

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.

 

 

RPN
17-Peridot
17-Peridot
(To:RPN)

Here the reason for ProAsmcompExtract() 

 

The Box is not in session, this is fun 🙂

 

doc00242.png

 

Top Tags