Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Does anyone know the context argument (third argument) of ProParameterTableExport using the toolkit that match looking at an assembly's parameters using the filter "Current and all assembly features and components" in Creo Parametric 10.0.4.0? I am having issues trying to get all of the parameters using PRO_PARAMTABLE_EXPORT_XML.
Do you want to export only solid parameters? All the options are interesting for parameter not created by Model2Modelitem, for example feature parameter. In Assembly Mode, Component parameter may interesting. It depends what you want to parse later in the xml file. As written in the header file, this option is used if the modelitem is NULL, and you don’t want to visit the parameter by your. Which one you are interested in?
I don't think I just want solid parameters. I am not a CAD person (software developer) so I am not sure. I really want all of the parameters for a component.
🙂
I see that you need to develop a piece of software without having a clue what the audience need, maybe I’m wrong
An assembly is just a special folder,
If you assemble a component, this is a feature, but also a component feature, where the feature may have parameters. This is crucial if you assemble the same component more than once. A component parameter is a feature parameter, here a find number may relevant for example.
I would suggest to parse or visit each feature in the assembly and check if the feature is a component. If true, it is a component (part or assembly), visit the parameter of this model, and forget the xml output and do it by yourself. You can do that recursive, here keep an eye on the feature ID and Path. The model name is unique in a Creo session, and I would ignore flexible component parameter at the beginning and bulk feature 😀
A model in session is unique, the parameters are the same regardless where the model is used. Just one unique link.
I would do it myself, but I don't see a mechanism to see the parameter name and value together. I already have the assemblies, and their related components, but it seems that I am not getting one of them correctly. When I go into Creo, and right-click on the part I see a set of parameters. However, when I click on Tools/Parameters, choose Component in the "Look In" drop-down, and then choose the same part in the assembly I see another set of parameters. I need both sets, but I am not sure why I am not getting them both.
I would specify that I am using the C toolkit for this.
Yes this is exactly what I was talking about.
The most important stuff is, that you can have Parameter only for some specific model items
For the first parameter you saw in Creo:
1. Visit the assembly feature
2. Check for the feature type and make sure it’s a component.
3. For this feature ID get the model handle, see the assembly header files for this
4. Now that you have the model handle, convert the model handle to a model item.
5. Use this model item to visit all parameter. Note: The unique ID for a parameter is the name, not an ID. From the parameter handle get the value based on the parameter type.
For the second type use on step 3 the model item, the feature ID and the feature type is a component, all may depend on your filter during the visit function.
If you would visit this model item you get all component parameter.
Don‘t forget there are a lot of example code given by PTC for this stuff.
Just search the example folder.
Have Fun and Good Luck 😉 of course.
I'm already doing steps 1-4. Do you have a function or functions for step 5? I see ProParameterVisit(), but I don't see how to get the details about the parameter (name, value).
I appreciate your help on this.
It looks like the id member of the structure is the name that I am looking for. I'll take a look at this in a bit.
OK, I wrote the Visit logic, and I'm still not getting the extra parameters for that one component. It's like I'm getting the part as the component as opposed to the assembly component. By the way, the visit logic is way more coding than just getting the XML dump, and parsing that. 😁
😅
But you can filter upfront and not during xml parsing 😉 and for me it’s more flexible.
For the component parameter see the comments and use the component feature id and the the component type, owner is the assembly. Just the model item is different for visiting the parameter!
But if you understand now the logic behind it may easier to understand the bit settings on xml export only! 👍😎
Is there a way to get the parameters for a component by the component feature ID? Here's what I'm doing right now:
You asked:
Is there a way to get the parameters for a component by the component feature ID?
Your question is about, get the name and values of component parameter?
A component parameter can be created after a model has been assembled. Deleting the model from the assembly structure will delete the component parameters as well.
I’m not at my desk, but as far I remember if you know the feature ID, getting the feature parameter is the same as getting the component parameter if the feature type is a component.
Only for a component feature you can get the model handle. And don’t forget to check the status of the feature!
Yes you can parse the session list, but I would just use the current model.
At the end it is like parsing a folder structure. There are some pitfalls.
1. Always check the feature status
2. A model (Part or Assembly) can be assembled multiple times, but you will have always the some solid parameter.
3. You may end up passing an assembly more than once.
Why are you calling ProSolidFeatVisi twice?
I'm calling it twice to get the root assembly. The first time I call it only looking for assemblies, and the second time I call it for each assembly. I didn't see a way to find the root assembly otherwise.
Why should I check the feature status?
Because of suppressed, simplified reps and family table, in some case the assembly is not loaded after retrieving failed.
But after ProSessionMdlList an assembly is the root one.
Only to clarify. An assembly by a given name is always only one time in memory even if part of other parent assemblies. Before retrieving Creo will check if the given name is loaded and skip that read.
Note: There is another visit method, here you may on the save side.
ProSolidDispCompVisit ( ProSolid handle,
ProSolidDispCompVisitAction visit_action,
ProSolidDispCompFilterAction filter_action,
ProAppData app_data);
/*
Purpose: Visits all the displayed components in the solid handle.
Input Arguments:
handle - The solid handle.
visit_action - Visiting function applied to a displayed component
solid. See comments for ProSolidDispCompVisitAction.
filter_action - The filter function. If NULL, all displayed
components in the solid handle are visited using
the action function.
app_data - The application data to be passed to the filter and
visiting functions.
*/
typedef ProError (*ProSolidDispCompVisitAction) (ProAsmcomppath *p_path,
ProSolid handle,
ProBoolean down,
ProAppData app_data);
/*
Purpose: This is used to visit assembly components. If it returns anything
other than PRO_TK_NO_ERROR, assembly traversal stops.
typedef ProError (*ProSolidDispCompFilterAction) (ProAsmcomppath *p_path,
ProSolid handle,
ProAppData app_data);
/*
Purpose: This is used to filter assembly components. If it returns
PRO_TK_CONTINUE, all the SUB-COMPONENTS of handle will not
be visited.
Input Arguments:
p_path - The assembly component path
handle - The component solid handle
app_data - The application data passed to the function
<b>ProSolidDispCompVisit()</b>
Output Arguments:
None
Return Values:
PRO_TK_CONTINUE - Skip visiting this assembly component and go to the next.
Other - Call the visit action for this assembly component. The
return value is passed as input to the visit action.
* Input Arguments:
p_path - The assembly component path
handle - The component solid handle
down - Use PRO_B_TRUE when going down to this component and
PRO_B_FALSE when going up from this component.
app_data - The application data passed to the function
<b>ProSolidDispCompVisit()</b>
*/
Get the model by path:
extern ProError ProAsmcomppathMdlGet (ProAsmcomppath *p_path,
ProMdl *p_model);
/*
Purpose: Retrieves the model specified by the component path.
Input Arguments:
p_path - The component path
Output Arguments:
p_model - The model found at the end of the component path
Return Values:
PRO_TK_NO_ERROR - The function successfully retrieved the model.
PRO_TK_BAD_INPUTS - The input argument is invalid.
PRO_TK_GENERAL_ERROR - The specified component path was wrong, or
contained missing members.
*/
Thanks for your input. I'll take a look at these options.
I think I am getting the correct components when I traverse the tree because the feature ID of the component in question is the same as in Parametric. Here is the crux of my issue:
When I go into Creo, and right-click on the part I see a set of parameters. However, when I click on Tools/Parameters, choose Component in the "Look In" drop-down, and then choose the same part in the assembly I see another set of parameters. I need both sets, but I am not sure why I am not getting them both.
Here is what I am seeing in Parametric:
Again 😉, you can have Parameter only for some specific model items.
As far I see your image, you are showing the relations, pick the Button for parameter.
If your assembly on root level contains an feature type - component - you will get the component parameter
Example Assembly with one model assembled. Feature ID of the assembled Box is 29.
TOP.ASM
29 BOX.PRT
Assume the call ProMdlIdGet ( BOX.PRT,&ID) would fill ID with 10
Your model item for the component/feature parameter is
ID 29
TYPE PRO_COMPONENT
OWNER TOP.ASM
Note: This may different for each assembly where box.prt is assembled.
If you get the model handle from the path, in this case just 29, you will get the model handle to BOX.PRT
Now if you use modeltomodelitem you will get the solid parameter, same as open the part and check the parameter.
The Call ProModelToModelitem would set the modelitem to
ID 10
TYPE PRO_PART
OWER BOX.PRT
You may get a complete different set of parameters for each model item here, if you visit the parameter.
I hope that makes it clear, and I’m not sitting in front of one PC😀
I'll visit this some more. Thanks for the reply.
I'm getting the ProMdl object by calling ProAsmcompMdlGet in my Visit function. That's what I'm using to get the parameters. Is there a function to get the other ProMdl object? Even though I'm getting a PRO_FEAT_COMPONENT type of feature I am getting the part's parameters, and not the component's.
Which component identifiers are used below? The internal feature ID? The component number? The feature number?
Yes component path are just the feature ids. And if the size is greater than one the second to last should be assembly.
Side note: The model item has just one id, no path. So the owner of the component feature is always the an assembly, the second to last one.
Hello @JC_IN_KC,
It looks like you have some responses from a community member. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Vivek N.
Community Moderation Team.
What it seems like is happening is that I'm getting the PART parameters, and not the COMPONENT parameters. I'm using ProSolidFeatVisit to get the components of the assembly, and only filtering on PRO_FEAT_COMPONENT. I am getting the assemblies in the drawing by using ProSessionMdlList. From that list I get the root assembly which I use to call ProSolidFeatVisit.
Please review the reply from Oct 31, 2025 07:12 PM and write some test function to validate your assumptions. Just do it hardcoded for one test assembly. The modelitem is the important variable, this should be debugged and see the reply, they are different. You can even hardcode the modelitem, and debug the result for one test assembly.
Use:
ProDrawingSolidsVisit (
ProDrawing drawing,
ProSolidVisitAction visit_action,
ProSolidFilterAction filter_action,
ProAppData app_data);
/*
Purpose: Visits models in the specified drawing.
Input Arguments:
drawing - the drawing
visit_action - visit action
filter_action - filter action. If NULL, visits
all drawings using the action function.
app_data - data for this action
Output Arguments:
None
… to get the attached model files.
To get the relations line by line, which is a different topic, check the relset header files.
