Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hello everyone!
When I try to regenerate my assembly, an exception is thrown:
My code:
.....
Solid assembly = (Solid)asm;
assembly.Regenerate(null);
} catch (XToolkitBadContext e) {
session.UIShowMessageDialog("Error XToolkitBadContext: " + e, null);
}
The documentation for the exception says:
"This exception is thrown when there is an error of type PRO_TK_BAD_CONTEXT in a Creo Parametric TOOLKIT function called by PFC."
But how to fix this error is not said.
Does anyone know the reason?
Thanks in advance.
Respectfully!
Solved! Go to Solution.
Hi
| PRO_TK_BAD_CONTEXT | Invalid regen flags and/or combination of regeneration flags if mixed with PRO_REGEN_FORCE_REGEN. |
You need to define the regeneration flags. You set it to null and that's not possible here.
Also there could be a problem with "unlicensed ObjectJava" and the regeneration if the regen_failure_handling config option ist set to no_resolve_mode. So in J-Link and Web-Link you need to set the configoption regen_failure_handling = resolve_mode to regenerate in the free API's. I don't know the feedback that you get if this isn't given.
Br,
Eike
Hi
| PRO_TK_BAD_CONTEXT | Invalid regen flags and/or combination of regeneration flags if mixed with PRO_REGEN_FORCE_REGEN. |
You need to define the regeneration flags. You set it to null and that's not possible here.
Also there could be a problem with "unlicensed ObjectJava" and the regeneration if the regen_failure_handling config option ist set to no_resolve_mode. So in J-Link and Web-Link you need to set the configoption regen_failure_handling = resolve_mode to regenerate in the free API's. I don't know the feedback that you get if this isn't given.
Br,
Eike
I agree, set config.pro option regen_failure_handling to resolve_mode
See https://www.ptc.com/en/support/article?n=CS294270
Thanks, that helped!
