Javascript Acad.Application.activedocument.addPalette function does not exist??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm following this documentation:
I've created a file called loadCapturePalette.js with this content to reference an html file on my local server:
try{
Acad.Application.activedocument.addPalette("Capture Image", "http://acadjs.local/capture.html");
}
catch (e){
alert(e.message);
}
It errors out saying that the function Acad.Application.activedocument.addPalette does not exist!
I have AutoCAD 2016. Does the Javascript API v2 load upon start by default or do I have to load the API library manually? I tried loading manually and it still didnt work.
I also tested by running these JS commands:
alert('activedocument '+Acad.Application.activedocument);
alert('addPalette '+Acad.Application.activedocument.addPalette);
The first alert shows a valid object. The second alert shows undefined. It seems that Acad.Application.activedocument is a recognized object, but Acad.Application.activedocument.adPalette is not a function!
Any idea how to set up AutoCAD 2016 to recognize the Javascript objects properly?
The tutorial I listed above seems to be lacking more steps to correctly setting the Javascript API up.
