Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
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.
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.