Commands
-
I received this question from Vikas Hajela a few days ago: I am developing a plugin in C#, which will add a link in Quick Access Toolbar in AutoCAD. […] My problem is that I don't know how to add a link into existing Quick Access Toolbar and Menu Bar in AutoCAD using ObjectARX SDK and C#. Also I want that on click of that link it should open a new window. We're going to look at some code that – on initialization of the application – adds an item to AutoCAD's "Big A" Application Menu and to the Quick…
-
In the last post we looked at a command to allow importing of Photosynth point clouds into AutoCAD. In this post we'll put a GUI on the front end, to avoid people having to sniff network traffic to determine the location of the appropriate files on the Photosynth servers. The application is actually relative simple: it hosts a browser control that gets pointed at the Photosynth web-site, allowing the user to browse through Photosynths. As point clouds are detected (as the browser has some handy events notifying of the HTTP traffic generated by the embedded Photosynth application, and we know…
-
This week I'm going to posting a few topics related to F#, as it feels as though I've been neglecting it, of late. And as this technology is going to hit the mainstream very soon – when Visual Studio 2010 ships – it seems all the more important to keep one's F# skills honed. We're going to start the week with an F# equivalent to the code shown in this previous post, where we go through and reflect on the commands exposed by an assembly in order to create corresponding demand-loading Registry keys automatically. We've shipped VB.NET and C# versions…
-
I received a really intriguing question by email from Dave Wolfe on Friday afternoon: Due to your post on the topic, I wanted to improve my installation method for .Net modules. While examining the topic, I ran into a few concerns that shaped my development process. The game changer is that I couldn't find a way to use reflection to check a .net module for the CommandMethodAttributes without being in an AutoCAD session. The CommandMethodAttribute crashes on initialization outside of AutoCAD. Dave went on to describe a couple of ways he'd found to work around this problem by driving AutoCAD,…
-
A big thanks to Tony Tanzillo for providing some tips to help improve the implementation of the application we saw in these previous posts: in particular Tony pointed out the ability of AutoCAD 2010 to generate a thumbnail image for a document in the editor programmatically (something I had forgotten was possible… at least I think I knew it existed – it certainly seemed familiar once I saw it :-S). Anyway, the version of the code in this post will only work from AutoCAD 2010 onwards because of the use of this function, Document.CapturePreviewImage(). Tony's code also showed some interesting…
-
This post carries directly on from the last one, which implemented a rudimentary "Quick SaveAs" capability in AutoCAD. Much of the explanation behind the design of today's code is there, so please do read it first (if you haven't already). Today we're taking the code further by automatically creating an item on a tool palette with the thumbnail of the recently-saved drawing which, when used, will run a script created when we saved the drawing. Here's the updated code with the new or modified lines in red. You can download the C# source file from here. 1 using Autodesk.AutoCAD.ApplicationServices;…
-
I had a fun request, earlier in the week, that I thought worth turning into a couple of blog posts. The problem itself is quite specific, but some of the techniques shown – especially in the second of the two posts – seemed worth sharing. The basic request was this: to implement a "quick SaveAs" command which will – the first time it's run – ask for a file location and name and will then – each time it's called subsequently – simply save the current drawing into the same folder with a filename based on the original with a…
-
Some of you may remember a philosophical question I raised in a post some time ago. The overall consensus of the feedback we received was to prioritise delivering code samples (given a choice between code samples and wizard-like code-generation tools). Which we are doing, both via the ADN site and our developer blogs… but that doesn't mean some investment in code-generation tools isn't also appropriate, from time-to-time. 🙂 Cyrille Fauvel, who manages the Media & Entertainment arm of DevTech but also occasionally works on technical activities that relate to our other products, has put together a new (currently draft) version…
-
While I was preparing this recent post I put together a simple project which registered localized names for commands, to make sure they were picked up and used to create the appropriate demand-loading Registry keys. It was a little tricky to do this from the current documentation, so thankfully I had access to this DevNote on the ADN site which helped a great deal (this is only available to ADN members but don't worry if you're not one: this post should provide equivalent information and in certain ways goes beyond the original example). Anyway, it seemed a relevant topic to…
-
This post extends the last one which looked at a basic implementation to allow AutoCAD's standard OFFSET command to work on the contents of external references. I haven't flagged the specific changes, but the old code (which is almost identical to that in the last post) starts with the Initialize() function. The previous example created geometry on a temporary layer that exists only as long as the source xref is attached: detaching the xref generally caused dangling layer references. This post evolves the approach and provides a choice to the user (via the XOFFSETLAYER command): to either create the geometry…