Skip to main content
1-Visitor
April 11, 2016
Question

Jlink freezes on regenerate (async mode)

  • April 11, 2016
  • 1 reply
  • 1444 views

I'm running a macro to regenerate the model after parameters are set, but sometimes it freezes until I end my asynchronous jlink program. I tried adding connection.EventProcess() commands after everything but it doesn't help.

 

Parameter p;

  p = creo.solid.GetParam("A");     

  p.SetValue (pfcModelItem.CreateIntParamValue(a));

  p = creo.solid.GetParam("NAME");

  p.SetValue (pfcModelItem.CreateStringParamValue(name));

  session.RunMacro("~ Command `ProCmdRegenPart` ");

  connection.EventProcess();

 

 

I've also tried to disconnect and reconnect in order to reset the state to no avail.

1 reply

cscholtz1-VisitorAuthor
1-Visitor
April 11, 2016

Ah I fixed it. I was running a regenerate macro in the first place instead of

solid.Regenerate(null);

Because it was throwing an inexplicable 'badcontext' error message. But re-reading the documentation, it says:

"Pro/ENGINEERWildfire5.0introducestheNo-Resolvemode,whereinifa modelandfeatureregenerationfails,failedfeaturesandchildrenoffailedfeatures arecreatedandregenerationofotherfeaturescontinues.However,J-Linkdoesnot supportregenerationinthismode.Themethod pfcSolid.Solid.Regeneratethrowsanexception pfcExceptions.XToolkitBadContext,ifPTCCreoParametricis runningintheNo-Resolvemode.TocontinuewiththePro/ENGINEERWildfire 4.0behaviorintheResolvemode,settheconfigurationoptionregen_ failure_handlingtoresolve_modeinthePTCCreoParametricsession."

Adding this config option allowed the original code to run.