...
Message data sent to iframe is expected to be a JSON object with a messageName string and some message dependent strings.
Code Block |
---|
{
messageName: "nameOfTheMessage",
...
} |
Supported messages
runcommand
Run a command in Kudo:
where resultMessage: if specified, the a message with this name is posted to the iframe parent when command execution is done
and messageId: if specified, it is passed to the resultMessage
Code Block |
---|
varconst message = { messageName: "runcommand", commandString: "_YourCommand", resultMessage: "nameOfPostedResultMessage", //optional messageId: "messageId" ;//optional } window const iframe = document.getElementById("cadcontent"); iframe.contentWindow.postMessage(message, '*'); |
...
Code Block |
---|
commandString: "_YourCommand\nParam1\nParam2" |
Expand | ||
---|---|---|
| ||
|
Info |
---|
Note: Only whitelisted commands are allowed to be run from the client side by runcommand message. To whitelist a command, add it to Default Files\/OEM Commands\/commands.xml (see Customization package and https://graebert.atlassian.net/l/cp/EUUwZ9r2 |
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?> <commands> <OEM name="graebert"> <command name="_XEREPLACEOPEN"/> <command name="_DOATTACHMENT"/> <command name=" _YourCommand"/> </OEM> </commands> |
runlisp
Execute the passed Lisp expression:
where resultMessage: if specified, a message with this name is posted to iframe parent when lisp execution is done
and messageId: if specified, it is passed to the resultMessage
Code Block | ||
---|---|---|
| ||
varconst message = { messageName: "runlisp", lispExpression: "lispExpression", resultMessage: "nameOfPostedResultMessage", //optional messageId: "messageId"; //optional } window const iframe = document.getElementById("cadcontent"); iframe.contentWindow.postMessage(message, '*'); |
eventRegister/eventDeRegister
Event
...
Register for receiving different types of additional events notifications.
types: commandEvent, sysVarEvent, lispEvent, drawingEvent, selectionEvent, drawingModifiedEvent
You can find available events on the event page. See https://graebert.atlassian.net/wiki/x/QAFdRg page for more details about events.
eventRegister
Register for the event:receiving different types of additional events notifications.
where eventName will be the event Type type which you want to register:
Code Block | ||
---|---|---|
| ||
varconst message = { messageName: "eventRegister", eventName: "commandEvent";//one of the above event types } window const iframe = document.getElementById("cadcontent"); iframe.contentWindow.postMessage(message, '*'); |
...
eventDeRegister
Deregister to stop receiving different types of additional events notifications.
You can find available events on the event page. See https://graebert.atlassian.net/wiki/x/QAFdRg page for more details about events.
where eventName will be the event Type type which you want to deregister:
Code Block | ||
---|---|---|
| ||
varconst message = { messageName: "eventDeRegister", eventName: "commandEvent";//one of the above event types } windowconst iframe = document.getElementById("cadcontent"); iframe.contentWindow.postMessage(message, '*'); |
Upgrading/Downgrading
Upgrading: To change from View mode to Edit mode
...
where state can be “view” or “edit”
Code Block | ||
---|---|---|
| ||
varconst message={ messageName= “stateChanged”, state = “view”; } window const iframe = document.getElementById("cadcontent"); iframe.contentWindow.postMessage(message, '*'); |
setvariable **
Info |
---|
Change a variable value |
drawingdescription**
Info |
---|
Trigger creation of drawing description |