Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hello all,
I want to know how to define ProAsmComppath used in ProSelectionAlloc for a feature in skeleton used in assembly.
I have feature ID for skeleton as 98 and in this skeleton I have a feature whose path I want to add has feature ID 3560. I saw in knowledge hub mentioned the method as {98,3560}. But when I try in ProSelectionAlloc to mention this way. It shows error
How do I mention correct path in ProSelectionAlloc ().
Thank You.
Hi @Sss4598,.
Thank you for your question!
I’d like to recommend to bring more details and context to your initial inquiry.
It also helps to have screenshot(s) to better understand what you are trying to do in your process.
Please refer to this guideline to make your questions more likely to receive a quick and useful answer.
This will increase your chances to receive meaningful help from other Community members.
Furthermore, please consult this Community Search guideline as well, which boosts up your chances of finding a resolution to your topic(s) much faster, as well as making use of our Knowledge Base.
Thank you for your participation and please let me know if you need further assistance!
Best regards,
A component path is just a list/array of component identifiers from the Root Assembly to the selected component. You need to tell toolkit which level/depth and the identifier. This will enable you to uniquely identify a component in an assembly (max level is 32) even if you have the same component more than once in one level.
The path and/plus the model item together is is always unique. The model item alone may not.
The model item owner must be the same model as specified with your path down.
If you assemble a part, then for this component the path is not needed, this is true as well on assembling an Assembly and you specify model items, like an axis from this assembly.
In most other cases you need to deal with the path.
If you allocate a selection make sure the path match if you specify a model item as well.
Hi,
Can you please provide me correct syntax to provide path to my datum point feature in skeleton as when I give it as an array of feature IDs {skeleton ID, datum feature ID}. It shows error type int incompatible with ProAsmComppath.
Try to learn and copy from working code: lookup the function ProSelectionAlloc() the PTC TOOLKIT API Wizard and see one of the over 100 examples below "Sample Code References:". Near the call to ProSelectionAlloc(), the argument ProAsmcomppath will be prepared in a proper manner.
For example, call ProAsmcomppathInit().
If you can select a modelitem (datum point feature) interactivly, it always (?) can be done via Pro/TOOLKIT, too.
For some cases (and this one I do not remember clearly), the feature ID in the Creo model tree is off by (+ or -) one, compared to the internal feature IDs in Pro/TOOLKIT ProFeature handles.
So you might construct your ProAsmcomppath technically correct with a fixed feature ID as input, but the ID is one off, thus invalid.
To avoid this: A) try your ID +/-1 or B) reveal the correct, TOOLKIT internal feature ID the other way around: use an existing ProSelection (interactively created of the feature in question) -> get the ID of the selected feature.
Again: I'm not too sure about this feature-ID-off-by-one thing.
ProAsmcomppath should contain only components ids, not feature ids. In your case, assuming one-level assembly, the construct should be :
ProIdTable tt;
tt[0]=98;
tt[1]=-1;
//or ProIdTable ttt{98,-1};
ProAsmcomppathInit( asm, tt, 1, &cpath);
a word of warning - quite often selecting a feature won't do anything useful - most likely you would need to descend into feature's geometry and get a ProGeomitem and use it in ProSelection
Maybe this helps,
it may have built in errors, but it's for free 🤣
This shows how to setup "One" axis selection of a component in one sub level, plus some header includes (only for ref, for sure not complete 😀).
See Toplevel Assy Picture (Top Left) and the tkmodel.prt (below) for some details related to the code.
Selection is always fun, but straight forward if you spend time on it ! (I still like the old Pro Develop style more)
Note: If you call for a Solid ProMdlToModelitem, the model item ID is equal to ProMdlIdGet(). There are tone of calls to access the model database and the memory tables, and modelitems are frequently use with different aliases to make it more complex 🙂
And of course no error checking. I compiled this and the selection was valid 🙂
ProAsmcomppath comppath;
ProIdTable comp_id_table;
ProMdl asmModel;
// Set the component path struct
comp_id_table[0] = 40;
comp_id_table[1] = 6;
comp_id_table[2] =-1;
// The Toplevel Assy
ProMdlnameInit (L“TK_TOP_ASSY“, PRO_ASSEMBLY,&asmModel);
ProAsmcomppathInit ((ProSolid)asmModel,comp_id_table,2,&comppath)
ProModelitem modelitem;
ProMdl prtModel;
// Set the model item struct
ProMdlnameInit (L“TKMODEL“, PRO_PART,&prtModel);
ProModelitemInit (prtModel,479,PRO_AXIS,&modelitem);
// The final axis selection in tkmodel.prt for COMPID [40,6]
ProSelection selection;
// In Part Model the comppath may most of the time NULL
ProSelectionAlloc (&comppath,&modelitem,&selection)
ProSelectionVerify (selection)
The PDF may have a better quality,
If you find errors, i will not spend time to update this 🙂And I was wrong with 32, there are only 25 levels allowed.
Feature based assembling, as far I remember, was introduced with approx. Pro/ENGINEER 8, it was not there from the beginning.
Cheers -)