Learning AutoCAD two times has been developed for some time, bumps, very hard boring. But I think there will be some small excitement, hey! Recently this time has been a thought, that is, I learn CAD two times the process of development with text recorded, form a series, and regularly updated. The main content is to record their daily learning process encountered in the problem and sentiment, and summed up the content learned today. The goal is to motivate themselves to adhere to, look at their own step-by-step improvement, more than a sense of accomplishment. There is a positive communication with everyone, hoping to correct my mistakes, reduce my detours. Moreover is the hope can give the back study the person a little experience, good actually also a bit to install B's heart. No more nonsense to get to the point of today:
? Working with tools: Visual Studio 2013 and AutoCAD2010
? Learning tools: AutoCAD VBA and VB.net development Fundamentals and Examples tutorial, C # Edition, autocad.net two development, AutoCAD. NET Developer's manual and network (current)
? Operating system: WIN10 64-bit
? Development language: C #
? Software Settings:
1. Open Visual Studio 2013 and create a new class library project;
2. On the right side of the software, in Solution Explorer (if not, select the first option in the view), find references within the project, right-click to select Add Reference, and then select the Browse tab. Then find the CAD installation directory of the Acdbmgd.dll and Acmgd.dll these two files, "OK";
3. In "References" find the two files just referenced acdbmgd.dll and Acmgd.dll, right-click to select Properties, set their "Copy Local" value to "False", double-click to change. As the name implies, if the "Copy Local" value is "True", the two files will be copied to the currently created project, causing an unknown error in the AutoCAD runtime (as I have never tried), in Solution Explorer can contain multiple class library files, Multiple class files (. cs) can also be added to each class library. Each time you add a new class library, you refer to the two files Acdbmgd.dll and Acmgd.dll.
4. Right-click the class library name, select Properties, change the contents of "Target Framework" in "Application" to ". NET Framework 3.5", change "target platform" in "Build" to "X64" (this is selected according to the operating system, X86 is 32 bit, X64 is 64 bit, It doesn't seem to change.
4
AutoCAD. NET corresponds to the version of Visual Studio |
autocad version |
. NET version |
Visual studio version |
2010-2011 (r18.0-r18.1) |
3.5 |
VS2008 SP1 |
(R18.2) |
4 |
VS2010 |
(R19.0) |
VS2010 SP1 |
5. Add the namespace, the purpose is to facilitate the invocation of the namespace of the integration functions, just see this time is not very understanding, but to the concrete example of the later, hands-on experiment, I understand. A few days ago just watched the teaching video, which has a sentence on my influence is very big, he is said do not love the keyboard of the computer, learning programming will continue to tap the keyboard, when you hit a keyboard, you get started, when you hit the code has 10G Hou, you apprenticeship. Here are a few common namespaces:
Autodesk.AutoCAD.DatabaseServices: Classes in namespaces include lines, circles, arcs, and so on, as well as layers, linetypes, and styles.
Autodesk.AutoCAD.Runtime: Classes in namespaces provide system-level functionality, such as common Commandmethod properties. (actually I don't understand)
Autodesk.AutoCAD.ApplicationServices; A class in a namespace is used to define and register new AutoCAD commands.
Autodesk.AutoCAD.EditorInput; namespaces provide classes related to user interaction, such as prompting for user input, and so on. The function of a namespace can be understood through this sentence.
Autodesk.AutoCAD.Colors; namespaces provide a color-related class.
Autodesk.AutoCAD.Geometry, classes in namespaces are used to perform 2D and 3D geometric operations.
6. To enable a method that can invoke commands in AutoCAD (such as a command "L" to draw a line), execute the code by adding the Commandmethod attribute at the beginning of the class code.
public class class1{ [Commandmethod ("HW")] public void HW () { }}
7. Open AutoCAD, enter netload, browse project directory ... Project name \bin\debug the DLL file under the folder, and then enter the appropriate command.
Thank you: "AutoCAD VBA and VB.net Development Foundation and Example Tutorial" C # Edition of the author only Bird, which most of the knowledge is learning this book, thanks again. I learned not to study next to each other, but based on specific examples to jump learning, specific examples will be explained in the future diary.
. NET AutoCAD Two development path (I., basic article)