Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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, '*');

...

Expand
titleExample message to add a line
Code Block
varconst message = {
  messageName: "runcommand",
  commandString: "_LINE 0,0 10,10  "
}
window
const iframe = document.getElementById("cadcontent");
iframe.contentWindow.postMessage(message, '*');

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/wikil/spaces/KUDOPARTNER/pages/1162674228/Customization#commands.xmlcp/EUUwZ9r2

Code Block
languagexml
<?xml version="1.0" encoding="UTF-8"?>
<commands>
 <OEM name="graebert">
   <command name="_XEREPLACEOPEN"/>
   <command name="_DOATTACHMENT"/>
   <command name=" _YourCommand"/>
 </OEM>
</commands>

...

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
languagejs
varconst message = {
  messageName: "runlisp",
  lispExpression: "lispExpression",
  resultMessage: "nameOfPostedResultMessage", //optional
  messageId: "messageId"; //optional
}
window
const iframe = document.getElementById("cadcontent");
iframe.contentWindow.postMessage(message, '*');

...

where eventName will be the event type which you want to register:

Code Block
languagejs
varconst message = {
  messageName: "eventRegister",
  eventName: "commandEvent";//one of the above event types
}
windowconst iframe = document.getElementById("cadcontent");
iframe.contentWindow.postMessage(message, '*');

...

where eventName will be the event type which you want to deregister:

Code Block
languagejs
varconst message = {
  messageName: "eventDeRegister",
  eventName: "commandEvent";//one of the above event types
}
windowconst iframe = document.getElementById("cadcontent");
iframe.contentWindow.postMessage(message, '*');

...

where state can be “view” or “edit”

Code Block
languagejs
varconst message={
  messageName= “stateChanged”,
  state = “view”;
}
window
const iframe = document.getElementById("cadcontent");
iframe.contentWindow.postMessage(message, '*');

...