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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Substitute part in simplified representation

frage12358
6-Contributor

Substitute part in simplified representation

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 🙂

2 REPLIES 2

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.

 

2019-12-22 at 10.10 AM.png

 

 

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.

 

2019-12-22 at 10.06 AM.png

 

2019-12-22 at 10.05 AM.png

 

 

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.

 

2019-12-22 at 10.07 AM.png

 

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.

Top Tags