cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Access to replace unrelated component API in Toolkit

rstreet
6-Contributor

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
gkoch
1-Newbie
(To:rstreet)

Hello Robert,

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

Thanks,

Gunter


sully7
13-Aquamarine
(To:rstreet)

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.

President & Founder
CadActive Technologies - www.cadactive.com
Top Tags