|
JavaScript Application Programming Interface (API) for AutoCAD
|
This guide documents the JavaScript Application Programming Interface (API) for AutoCAD®.
Using the acedInvoke(…), you can call the JavaScript functions from your C++/.NET/LISP code. You can call the JavaScript functions by registering them using this global JavaScript function syntax:
defun(string name, callback)
Acad::ErrorStatus acjsLoadJSScript(const ACHAR* uriOfHTML)Loads an HTML file in a hidden window and executes the Javascript. This function is also exposed as WEBLOAD command in AutoCAD.
Acad::ErrorStatus acjsDefun(const ACHAR* name, JsCallbackType callback);Registers a callback that JavaScript code can call.
Where JsCallbackType is defined as follows:
typedef JSON (*JsCallbackType)(const JSON* params)
where JSON is defined as follows:
JSON is a class/structure type that can represent JSON in C++.
Assembly: accoremgd.dll
Namespace: Autodesk.AutoCAD.ApplicationsServices.Core Class: Application
Methods:
void LoadJSScript(System.Uri uriOfHTML)Loads the HTML file specified and executes JavaScript code.
If you want to call .NET function in JavaScript, you can define the function in .NET using this syntax:
[JavaScriptCallback("DotNetCallbackFunc")]
public string DotNetCallbackFunc(string json)where:
DotNetCallbackFunc is the user defined function.
(webload, uriOfHtml )
Loads an HTML page and executes JavaScript code.
|
Copyright (c) 2012. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|