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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Regenrate the model

ddhini
14-Alexandrite

Regenrate the model

I have a model.I update some parameter and when i click the Regenerate Button then the model gets regenerated and displayed.But i did something in my tool ,I give input through my tool.Its affect the parameter and updates the value.Now I want to regenerate the model by J-Link.

model mode;

model=Session.getCurrentModel();

model.RegenarateRelation();

model.display();

But it wont regenerate the model.Please help me to solve my problem.Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
sjuraj
13-Aquamarine
(To:ddhini)

Do following:

Solid solidModel = (Solid) session.GetCurrentModel();

session.SetConfigOption("regen_failure_handling", "resolve_mode");

solidModel.Regenerate(null);

session.SetConfigOption("regen_failure_handling", "no_resolve_mode");

View solution in original post

6 REPLIES 6
sjuraj
13-Aquamarine
(To:ddhini)

Regenerate method is allowed only for solid object. You need to cast your Model object to Solid object. Try this:

Solid solidModel = (Solid) session.GetCurrentModel(); //this will cast Model to Solid

RegenInstructions ri = pfcSolid.RegenInstructions_Create(null, null, null);

solidModel.Regenerate(ri);

ddhini
14-Alexandrite
(To:sjuraj)

Solid solidModel = (Solid) session.GetCurrentModel(); //this will cast Model to Solid

RegenInstructions ri = pfcSolid.RegenInstructions_Create(null, null, null);

solidModel.Regenerate(ri);

i exactly use the code that you suggest .But it is not working . Don't know what the problem.

sjuraj
13-Aquamarine
(To:ddhini)

there must be set regen_failure_handling resolve_mode in the config.pro

If you do not want to keep resolve_mode option after regeneration change it to no_resolve_mode using method session.SetConfigOption("regen_failure_handling", "no_resolve_mode"); after regenerating by j-link app

by the way, you do not have to create regen instructructions, just pass null as parameter in Regenerate method

ddhini
14-Alexandrite
(To:ddhini)

Can you please explain briefly .I can't understand

sjuraj
13-Aquamarine
(To:ddhini)

Do following:

Solid solidModel = (Solid) session.GetCurrentModel();

session.SetConfigOption("regen_failure_handling", "resolve_mode");

solidModel.Regenerate(null);

session.SetConfigOption("regen_failure_handling", "no_resolve_mode");

ddhini
14-Alexandrite
(To:sjuraj)

Thanks a lot skvarka juraj‌.It works fine.

Top Tags