Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
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.
Solved! Go to Solution.
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");
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);
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.
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
Can you please explain briefly .I can't understand
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");