AutoCAD Javascript API load html page

AutoCAD Javascript API load html page

Anonymous
Not applicable
4,074 Views
4 Replies
Message 1 of 5

AutoCAD Javascript API load html page

Anonymous
Not applicable

Hi,

 

I'm simply trying to get started with the Javascript API, by following this tutorial: https://www.youtube.com/watch?v=PZKKJwcke2k

However I cannot get what has to be done in order to load the HTML page into AutoCAD!

In the tutorial video in minute 19:29 he uses an adnjs command which seems to be previously defined somewhere, but I cannot figure out where. So very simple question here: how can I load the HTML sample pages into AutoCAD?

 

Many thanks in advance,

Dennis

0 Likes
4,075 Views
4 Replies
Replies (4)
Message 3 of 5

Anonymous
Not applicable

Thank you for your reply Paul Li. In fact it seems that I need to code a .NET loader module that adds this palette into an AutoCAD-resident PaletteSet. Probably using PaletteSet.Add() or something similar. I don't have a clue about .NET coding yet. Do you know by chance if there is a easy way to write something like this in C#?

0 Likes
Message 4 of 5

paullimapa
Mentor
Mentor

Unfortunately, I don't know .NET or C#.  Perhaps someone else who does will jump in here...

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 5

Anonymous
Not applicable

You don't have to use .NET to load your palette if you don't want to. You can do load your HTML page with javascript too.

 

In a separate javascript file, put one of these lines of code in:

 

Acad.Application.addPalette("Name of palette", "c:/path/to/my/webpage.html");

// OR

Acad.Application.addPalette("Name of palette", "http://somehost.com/my/webbapge.html");


depending on if your using a local file or a hosted webpage.

 

Then from inside AutoCAD, use the WEBLOAD command to load up the javascript file containing the call to addPalette. The webload command will execute everything in the file. The addPalette command should make the new palette you created visible. That's all you have to do.