java_exec
Run custom Java code in Creo using the full Object TOOLKIT API on the main thread to handle tasks no existing tool covers.
Instructions
Run Java code inside Creo with the full Object TOOLKIT Java API (pfc + wfc packages, all imported) on Creo's main thread: the escape hatch for anything no tool covers.
code is the body of static Object run(Session session, Map<String,Object> args); return a
JSON-able value (Map/List/String/number/boolean). System.out is captured. Helpers:
Api.solid(session, file|null), Api.item(solid, ref, type), Api.select(solid, ref, type),
Api.feature(solid, nameOrId), Api.describe(item), Api.tree(session, solid, jsonTree).
Example: Solid s = Api.solid(session, null); return s.ListFeaturesByType(true, null).getarraysize();
API docs: Creo's Object TOOLKIT Java APIWizard (Common Files/otk_java_doc). Long loops block Creo.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "java_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | ||
| code | Yes | ||
| timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||