Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Asking for enhancement to Creo Parametric to have API access to Replace Unrelated Component:
Hello Robert,
enhancement requests should be filed as Product Ideas - this will allow other users to vote and comment on the idea.
Thanks,
Gunter
Although you can't really do this as easily as you would in the GUI, you can already do this using functions already in the API.
When you get a chance, check the feature element tree for a ProAsmcomp. (/protoolkit/protkdoc/api/proasmcomp_h.html)
Essentially, once you have a selection to a component in your tree, you could use
- Get the current constraints of the ProAsmComp
- ProFeatureElemtreeExtract to get the feature element tree
- Change the element for PRO_E_COMPONENT_MODEL using ProElementSpecialvalueSet
- change the elements for the constraints as-needed to be references from the new model instead of from the old model
- use ProFeatureWithoptionsRedefine to "finish" the feature
Its a bit of a pain... but I believe it can technically be done . Let me know if you need more-specific pseudo-code. It can be done similarly using the OTK APi if you need that one instead, but I don't have as much personal experience with that APi yet.