Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hey everybody,
I have the following problem:
I want to substitute a part in a simplified representation with another member of the familiy table. However, due to a lack of programming skills, I am unable to do this.
Currently I have to following code to exclude a feature, given its ID:
var simp_rep = solid.GetActiveSimpRep();
var simp_rep_instructions = simp_rep.GetInstructions();
var item_path = pfcCreate ("intseq");
item_path.Append(FEAT_ID); //currently I set the feature Id manually
simp_rep_comp_item_path = pfcCreate("pfcSimpRepCompItemPath").Create(item_path);
simp_rep_item = pfcCreate("pfcSimpRepItem").Create(simp_rep_comp_item_path);
simp_rep_action = pfcCreate("pfcSimpRepExclude").Create();
simp_rep_item.Action = simp_rep_action;
simp_rep_instructions.Items.Append(simp_rep_item);
simp_rep.SetInstructions(simp_rep_instructions);
Can somebody help me to modifiy this code to substitute a part (e.g. prt0001.prt) with a family table member (e.g. simplified<prt0001.prt>)?
Any help is greatly appreciated and happy holidays 🙂
Not sure if there is a substitute call available in what you are doing... I would look for that first... because you can manually force that via the UI.
However, one quick way to be a bit more dynamic - would be to use Pro/PROGRAM to create a variable (parameter) for that location in your assembly structure. This assumes a bit of a consistent process on your end, but works like a charm.
Then a simple parameter change should cause the replacement of the family table item at that location - assuming all the constraints are there for any dependent assembled/referenced components.
Hope that helps.
Dave
Thank you very much for your reply and sorry for my late response.
Unfortunately this solutions seems to be not viable for my use case, as I have to apply this script to numerous assemblies. Because of this it would be great to solve this problem using the Creo Web.Link API.
I know from the documentation that this should be possible to do.
Any help from you, or anybody else, to be able to implement this functionality in Web.Link is again greatly appreciated.