TheSwamp
Code Red => .NET => Topic started by: Jeff H on January 28, 2016, 09:52:12 AM
-
Here is post from Kean's blog.(Thanks again Kean I enjoy reading it.) Adding a web-page as a document tab in AutoCAD 2015 using .NET. (http://through-the-interface.typepad.com/through_the_interface/2014/04/adding-a-web-page-as-a-document-tab-in-autocad-2015-using-net.html)
In 2016 when I run this or any add any webpage, it will sometimes cause 2 more document tabs to show up where closing one of them first will cause a crash. Other times it will not at tabs but will add them to dropdown list(one at far right clicking down arrows) and again will cause a crash on closing tab.
I do not have 2015 to see if there is a difference but has anyone noticed difference between 2015 and 2016?
-
OH, I want to play!
-
Also I am unable to resize modal windows in 2016 with persistSizeAndPosition set to false.
Displaying Modal and Modeless HTML Pages in AutoCAD (http://adndevblog.typepad.com/autocad/2015/01/displaying-modal-and-modeless-html-pages-in-autocad.html)
-
Kean says he sees it to that something broke in 2016.
http://through-the-interface.typepad.com/through_the_interface/2014/04/adding-a-web-page-as-a-document-tab-in-autocad-2015-using-net.html#comment-2483124200
-
Hi Jeff,
I recall thinking at the time that this would be as useful as teats on a bull.
Care to share your goals with it ... other than geekiness.
Regards,
-
this kind of works, but you have to close the tab before exiting, or acad crashes
public class WebDoc
{
class HeadClient : WebClient
{
protected override WebRequest GetWebRequest(Uri address)
{
var req = base.GetWebRequest(address);
if (req.Method == "GET")
req.Method = "HEAD";
return req;
}
}
public class Commands
{
private static bool PageExists(string url)
{
Uri uriResult;
if (!Uri.TryCreate(url, UriKind.Absolute, out uriResult) || uriResult.Scheme != Uri.UriSchemeHttp)
return false;
try
{
using (var client = new HeadClient())
{
client.DownloadString(url);
}
return true;
}
catch (WebException)
{
return false;
}
}
[CommandMethod("Doit")]
public static void OpenPage()
{
const string url = "http://www.theswamp.org/";
if (PageExists(url))
{
Application.DocumentWindowCollection.AddDocumentWindow("TheSwamp", new System.Uri(url));
}
else
{
var doc = Application.DocumentManager.MdiActiveDocument;
var ed = doc.Editor;
ed.WriteMessage("\nCould not load url: \"{0}\".", url);
}
}
}
}
-
Hi Jeff,
I recall thinking at the time that this would be as useful as teats on a bull.
Care to share your goals with it ... other than geekiness.
Regards,
Not responding for Jeff but I've tinkered with this sort of thing using the web control in .net to create dialogs. I like the idea of using html/css to create dialogs and I guess WPF was designed just for this.
I think html/css with javascript is a lot easier IMO than WPF but that's just me :)
(aside: For some reason MS always has to make their own version of something that already works and is a standard??)
-
Hi daniel,
I can understand using the .net controls but not using a doc page built into AutoCAD.
What happens when a user tries to use the page without an internet connection to honor the href live links for js, bootstrap, jquery etc ?
The fact that it's broken in 2016 without anyone noticing is an indicator of the attention AutoDesk is paying to the technology and a measure of how many developers/clients are using the feature.
-
I suppose we could use a fall-back to a local source in case the CDN fails.
something like
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>if (typeof jQuery === 'undefined') {
document.write(unescape('%3Cscript%20src%3D%22/path/to/your/scripts/jquery-2.1.4.min.js%22%3E%3C/script%3E'));
}
</script>
-
I like the idea of being able to add your own document + tab, it adds a new workspace that’s not intrusive to the drawing editor, and gives more room to work over a palette or dialog.
I hadn’t seen this before, and as soon as I did, a few ideas popped into my head. Bummer, in .NET it seems limited to DocumentWindow(URL) and WPFDocumentWindow as I’m not a fan of either. I see AcApDocWindow in Arx, that may give more control
…
…
If it wasn’t broke lol :|
-
While working at my former employer (large international design firm), I ended up developing a WPF Browser app, which sat on the server and consolidated various pertinent design resources.
Having that 'resource' (WPF) load as a Document tab within CAD in lieu of a web browser *might* be useful - one day - but nowhere as useful as having it (the resource/content) displayed in a window unto itself, either side-by-side CAD, on a second monitor, etc.
Unless Autodesk is going to implement 'tear away' Document windows, each residing in their own process, that can float/minimize/maximize outside of the main application window (like Chrome) - which implicitly requires AutoCAD products to be thread-safe - methinks this is a fruitless API. :-(
-
Been on the road all day, but initial plan was to automate and customize some things with clients that are working on same projects, but see too many things not working and not gonna fool with it.
Here is sample of headache if you used this page the combo box does work in AutoCAD browser
http://hpadwebapplication.azurewebsites.net/WireSizingData/WireSizeCalculator