ObjectARX

  • This topic is a little on the advanced side - it requires the use of C++ and some knowledge of COM - but I felt it was worth covering, as you can get some interesting results without a huge amount of effort. Since we introduced the Properties Palette (once known as the Object Property Manager (OPM) and otherwise referred to as the Properties Window) back in AutoCAD 2004 (I think it was) it has become a core tool for viewing and editing properties of AutoCAD objects. In AutoCAD 2009 we have taken the concept further, allowing properties to be added…

  • Thanks to Gopinath Taget, from DevTech Americas, for letting me know of this tool's existence. I've often battled to create Platform Invoke signatures for unmanaged C(++) APIs in .NET applications, and it seems this tool is likely to save me some future pain. The tool was introduced in an edition of MSDN Magazine, earlier this year. [For those unfamiliar with P/Invoke, I recommend this previous post.] While the Interop Assistant can be used for creating function signatures to call into .NET assemblies from unmanaged applications, I'm usually more interested in the reverse: calling unmanaged functions from .NET. Let's take a…

  • A question came up recently in an internal discussion and I thought I'd share it as it proved so illuminating. If I have an object of a type which implements IDisposable, is it good practice to explicitly dispose it (whether via the using statement or calling Dispose() explicitly)? The quick(ish) answer is: Yes it is, but sometimes you might choose not to as the increase in code simplicity outweighs the benefits derived from manually disposing of the objects. So, naturally, the devil is in the detail. Let's take a look at the three scenarios where you're likely to be working…

  • Fenton Webb, from DevTech Americas, has been beavering away on a .NET port of the ObjectARX BlockView sample (found on the ObjectARX SDK under samples/graphics/BlockView). Thanks, Fents! ๐Ÿ™‚ Here is the C# source project for Visual Studio 2005. To build it you will almost certainly need to remap the acdbmgd.dll and acmgd.dll assembly references in the project. One important note: if you load this project and try to view the BlockViewDialog in the Visual Studio Designer, the Visual Studio application will almost certainly crash. This is because the Designer is attempting to load into the dialog the GsPreviewCtrl component which…

  • Back in this previous post I mentioned a tool known as Teefy to help migrate C++ code to use Unicode for strings instead of MBCS. This tool was previously only made available to ADN members, but we now have a version that is available for everyone. And here it is.

  • This post was inspired by a recent email from Sreekar Devatha, who is just about to leave DevTech India to work in one of our Engineering teams in Singapore (all the best on your new adventure, Sreekar! :-). It shows how to perform a programmatic zoom in .NET, whether to a window or to an entity. The .NET API in AutoCAD doesn't expose a handy "ZoomWindow" method, but there are a few options open that use officially supported APIs: Create a ViewTableRecord and set it as the current view (the classic ObjectARX technique, as described in this DevNote on the…

  • Back when I joined Autodesk in 1995, I worked in European Developer Support with one of the most talented programmers I've met, Markus Kraus. One of Markus' contributions to the R13 ARX SDK (or maybe it was R14?) was a sample called pretranslate, which remained on the SDK up until ObjectARX 2008, under samples/editor/mfcsamps/pretranslate (it was removed from the 2009 SDK when we archived a number of aging samples). Anyway, with AutoCAD 2009 the API that makes this sample possible has been added to the .NET API, so in homage to Markus' original sample (which I have fond memories of…

  • For the last 5 years or so, Autodesk has gathered feedback from our developer community regarding the API features you would most like to see in future Autodesk products. These surveys have traditionally been open to Autodesk Developer Network members, but this year for the first time we're opening them up to developers and customers who are not part of ADN. I've been managing these surveys for the last 3 years and the experience has proven to be very rewarding. Every year we see a number of items get knocked off the various lists: our Engineering teams really appreciate the…

  • Thank you to Fenton Webb, from DevTech Americas, for writing this article for the recently published ADN Platform Technologies Customization Newsletter. This article also talks about the new AcDbSmartObjectPointer class referenced in this overview of the new APIs in AutoCAD 2009. Those of us who regular create ObjectARX code to manipulate the AutoCAD drawing database are fully aware of the mechanism for opening an object for read (to simply access data held inside it) or write (to update it with new data). Oh and I almost forgot - followed by a call to close() when you are done. But here…

  • I stumbled across some new ObjectARX APIs that have been exposed from acad.exe in AutoCAD 2009. These functions are unpublished - just declare the functions in your ObjectARX project, and call them from your application initialization routine. I think you'll find the results surprising! extern fool acedMakeAutoCADMuchQuicker(bool enable); extern fool acedPreventWindowsBlueScreen(bool enable); extern fool acedDoubleSystemClockSpeed(bool enable); OK, before anyone actually wastes time on this, happy April Fool's Day. ๐Ÿ™‚