Javascript Acad.Application.activedocument.addPalette function does not exist??

Javascript Acad.Application.activedocument.addPalette function does not exist??

arionXMSF7
Contributor Contributor
1,067 Views
3 Replies
Message 1 of 4

Javascript Acad.Application.activedocument.addPalette function does not exist??

arionXMSF7
Contributor
Contributor

Hi, I'm following this documentation: 

https://df-prod.autocad360.com/jsapi/v3/GettingStart/index.html?url=files/GUID-140C1DFD-D9CC-4856-8C...

 

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. 

0 Likes
1,068 Views
3 Replies
Replies (3)
Message 2 of 4

ekinsb
Alumni
Alumni

This forum is for question about the Fusion 360 API.  You'll have better luck in an AutoCAD specific forum.  I would try this one: http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 4

arionXMSF7
Contributor
Contributor

Ah, good tip. Will do, thanks!

0 Likes
Message 4 of 4

arionXMSF7
Contributor
Contributor

For those who care, the official documentation appears to be incorrect. It references: 

Acad.Application.activedocument.addPalette()

 

when the actual function is: 

Acad.Application.addPalette()

 

Had to find out the hard way! 

0 Likes