Skip to main content
1-Visitor
April 7, 2017
Solved

Regenrate the model

  • April 7, 2017
  • 2 replies
  • 3372 views

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.

Best answer by sjuraj

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");

2 replies

15-Moonstone
April 17, 2017

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);

ddhini1-VisitorAuthor
1-Visitor
April 18, 2017

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.

15-Moonstone
April 18, 2017

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

ddhini1-VisitorAuthor
1-Visitor
April 18, 2017

Can you please explain briefly .I can't understand

sjuraj15-MoonstoneAnswer
15-Moonstone
April 19, 2017

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");

ddhini1-VisitorAuthor
1-Visitor
April 19, 2017

Thanks a lot skvarka juraj‌.It works fine.