Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hello,
I have multiple skeleton in my assembly. I use to ProAsmSkeletonGet() to retrieve skeleton as ProMdl Skel. It retrieves first skeleton from model. I want to get also the next skeletons to perform operations on feature in it. Can anyone one suggest how do I retrieve second skeleton with help of ProAsmSkeletonGet() or any similar function to perform operation on feature in other skeleton in same assembly.
there is a function ProMdlIsSkeleton - the user guide has a sample code TestAsm.c - copy/paste
To get all skeletons, traverse your assembly (only one level or recursively) using ProSolidFeatVisit(): use the following filter function to visit only components that are skeletons:
ProError MdlSkelettonFind_FeatFiltAct(ProFeature* pFeature, ProAppData pAppData){
ProError iStatus = PRO_TK_CONTINUE; // Default filter result: deny visiting this feature (filtered out)
ProError pErr;
ProFeattype pFeattype;
ProFeatStatus pFeatStatus;
ProMdl pModel;
ProBoolean bIsSkeleton;
if (pFeature->type == PRO_FEATURE){
pErr = ProFeatureTypeGet(pFeature, &pFeattype);
if (pErr != PRO_TK_NO_ERROR) { return PRO_TK_CANT_ACCESS; }
if (pFeattype != PRO_FEAT_COMPONENT){ // Feature is a component?
return iStatus; // Skip non-component features
}else{
pErr = ProFeatureStatusGet(pFeature, &pFeatStatus);
if (pErr != PRO_TK_NO_ERROR) { return PRO_TK_CANT_ACCESS; }
// Optional: filter for features that are in the state "active" or "active but unregenerated" (skip visiting others)
if ((pFeatStatus != PRO_FEAT_ACTIVE) && (pFeatStatus != PRO_FEAT_UNREGENERATED)){
return iStatus; // Skip feature
}
// Filter for skeletons
pErr = ProAsmcompMdlGet(pFeature, &pModel);
if (pErr != PRO_TK_NO_ERROR) { return PRO_TK_CANT_ACCESS; }
pErr = ProMdlIsSkeleton(pModel, &bIsSkeleton);
if (pErr != PRO_TK_NO_ERROR) { return PRO_TK_CANT_ACCESS; }
if (bIsSkeleton == PRO_B_TRUE){
iStatus = PRO_TK_NO_ERROR; // Allow visiting this feature
}
}
}
return iStatus;
}
Another Code sample 😀 (Und einen netten Gruß!)
# Return all active Skeletons by name and the Component/Feature ID
# in the given assembly
# Defaults to Status Active
proc GetSkeletons {Assy} {
set retData [list]
foreach {model cid} [ps_visit components -model $Assy] {
if {[ps_model is_skeleton -model $model] } {
lappend retData [list $model $cid]
}
}
return $retData
}
# Call GetSkeletons ASM0001.ASM
# will return
# => retVals {ASM0001_SKEL0001.PRT 42}
# ps_visit components will return
# => ASM0001_SKEL0001.PRT 42 BOX.PRT 41
Interesting! In what environment can this (i assume it is Tcl) code be used/run? Do you use C wrapper tools to utilize TOOLKIT API and compile Tcl-code to a TOOLKIT-DLL?
Either asynchronous by loading the Tcl/Creo DLL, connect to Creo, and just continue with Calls to Creo, like ps_visit or other ps* commands, which will directly call toolkit functions on the fly. Or synchronously, by a menu definition callback, where a Tcl Script will be executed and you can use the same Creo calls. This is faster due to the fact that no RPC is in use. Type checking is done inside of Tcl, and for example the model string token, has a pointer in the background. You can load any other Tcl DLLs like SQLite, Oratcl during runtime. Any time a function can be entered and tested, live. Another important feature, you can protect your source code, so the clear text is only available for the developer, nuff said 😉
Hi @SS4598,
I wanted to follow up with you on your post to see if your question has been answered. If so, please mark the appropriate reply as the Accepted Solution for the benefit of other members who may have the same question.
Of course, if you have more to share on your issue, please let the Community know.
Thanks!