Visual Studio
-
In this post we're going to continue the topic started in Part 1 of this series, which looked briefly at metaprogramming with AutoCAD using AutoLISP and VB(A). Now we're going to look at .NET, focusing initially on C# and VB.NET. [I found the inspiration for the code in this post from The Code Project, although I had to update the code to use non-deprecated CLR methods as well as making it work for AutoCAD, of course.] While .NET doesn't provide something as simple as an Eval() function, it actually provides something much more interesting. The CLR exposes the ability to…
-
Microsoft has released Visual Studio 2008 and the .NET Framework 3.5. For the announcement see Soma's blog and for more detailed information see Scott Guthrie's. I haven't yet worked with this version of Visual Studio, but I'm told it installs side-by-side with previous versions of Visual Studio, so I'll be taking a look after AU. Some of the areas I'm especially interested in - and this is not an exhaustive list of all the cool stuff the release includes... 🙂 C#/VB language features, many of which have come from the world of functional programming Automatic properties, extension methods, lambda expressions,…
-
I couldn't resist... I just had to have a play with this technology, today. 🙂 Here are the steps to get your first (very simple) F# application working inside AutoCAD. First we need to download and install the latest F# distributable from here (at the time of writing this was the July 31 release - 1.9.2.9). We create a base F# project, selecting the "F# Project" template: We now add a new item to the project of type "F# Source File" to the project: The file created contains a lot of boilerplate code that is definitely worth looking at to…
-
I've just come across the announcement for F#, and am pretty excited about it. Here's the link to Soma's blog, and here's the Microsoft Research F# site. F# is a functional programming language. Functional programming has a long association with technical computing, one of the reasons LISP was chosen as the initial programming interface for AutoCAD. On a personal note: aside from the work I've done with LISP over the years, I also studied an obscure functional language called Miranda during my university days and have since worked a lot with XSLT (which is at least influenced by functional languages).…
-
[This post continues from the last post, which I've been back and modified slightly since it was posted.] Using the DWG Thumbnail in a simple application Thumbnail images, when they exist inside a drawing, live in a predictable place at the beginning of the file. This makes it possible for a module – such as an ActiveX control – to extract the thumbnail information when pointed at a DWG file and generate an image from it. All done without the need for RealDWG (which also does this, but with a much heavier runtime component). A number of 3rd party tools…
-
[As mentioned in the last post, I'll be publishing chunks of the handouts for my AU classes via this blog over the coming weeks] Introduction This session focuses on downstream technologies that can be used to access DWG content outside of AutoCAD-based products. We're going to start by creating a basic model inside AutoCAD comprised of 3D solid objects, and then look at a simple AutoCAD .NET application to access information about those solids. We will then take the same code and build a non-graphical (in terms of geometry - it does, after all, have a GUI) application around it…
-
I thought I'd bring your attention to this post on Scott Guthrie's blog - this is a really exciting announcement for .NET developers everywhere: Releasing the Source Code for the .NET Framework Libraries
-
In the last post we looked at some of the potential uses for the Reflector application. I didn't end up elaborating on the third reason I stated for the Reflector being a compelling tool - that it can be used to help optimize code based on the resultant IL created. For fun I played around with using the Reflector to compare similarly structured code, and thought I'd use this post to share my approach and the results. Firstly, though, I recommend taking a look at this useful primer on MSIL. Now, let's take some nearly identical code, and compare the…
-
Reflection Now we're finally going to spend some time looking at Reflection. As mentioned in a previous post, .NET assemblies include intermediate language instructions plus metadata about types, members and assembly references. It is possible to access this information through Reflection. For another definition of Reflection, here's what MSDN has to say about System.Reflection: The System.Reflection namespace contains types that retrieve information about assemblies, modules, members, parameters, and other entities in managed code by examining their metadata. These types also can be used to manipulate instances of loaded types, for example to hook up events or to invoke methods. To…
-
In the last-post-but-one we took an introductory look at protecting intellectual property in various types of application modules used with AutoCAD. Thanks to everyone for the subsequent discussion – it's great to see such diversity of opinion out there on this subject. Before moving on to Reflection and the Reflector tool, I thought I'd first follow up on this previous post. So… regarding the various comments - here are the points that resonated particularly with me: It's not always important to obfuscate – much standard implementation work doesn't contain trade secrets, for instance, and some software providers (including Microsoft &…