Hello Friends,
I have use ProSolidFeatureVisit() API to find the component , but it collect component at first level , But I want to find the component at all level in assembly ,Please help me to resolve the issue.
Regards,
Kunal
Solved! Go to Solution.
You should take a look at UtilVisit.c in the examples. Copy/paste ProUtilAsmTravAction(...)
HIH.
A similar question was previously - "Retrieve assembly components on all levels in Creo 2.0": https://community.ptc.com/t5/Customization/Retrieve-assembly-components-on-all-levels-in-Creo-2-0/td-p/14
I have see this post but I am struck in creation of visiting function for this API.
Can you please provide the visiting function for same.
Regards,
Kunal
You should take a look at UtilVisit.c in the examples. Copy/paste ProUtilAsmTravAction(...)
HIH.
You call the visit functions for components, if your component is a PRO_ASSEMBLY you just call your function recursive again. It’s a little bit like traverse a folder structure. But for sure not the same.
An assembly is like folder, but this folder can appear at the same level or in other levels with the same structure and multiple times.
Sample Tcl Code
proc Get_Assy_Names {ASM} {
# Vist the given assembly by components
foreach FID [ps_visit type -model $ASM -- COMPONENT] {
# Get the model name from this feature ID
set MDL [ps_assy component_name -model $ASM -- $FID ]
# If the MDL is an assembly, recursive call
if { [ps_model is_assembly -model $MDL]} {
Get_Assy_Names $MDL
}
}
return
}
BTW: If you export, save the feature ids, you have the component path for each model in the assembly.
Hi Kunal,
Use the function ProSolidFeatureVisit() recursively to collect components from all levels.
Example:
ProSolidFeatureVisit(Parent_asm, visit_action,filter_action,app_data){
ProSolidFeatureVisit(child_asm, visit_action, filter_action, app_data)
{
.........logic
}
}