Skip to main content
10-Marble
Feb 2, 2016 8:40 PM UTC
Question

Access to replace unrelated component API in Toolkit

Asking for enhancement to Creo Parametric to have API access to Replace Unrelated Component:


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

2 replies

2-Explorer
Feb 25, 2016 7:07 PM UTC

Hello Robert,

enhancement requests should be filed as Product Ideas - this will allow other users to vote and comment on the idea.

Thanks,

Gunter


Translate
14-Alexandrite
Mar 31, 2016 5:54 AM UTC

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.

Translate