C # for CAD two development environment configuration

Source: Internet
Author: User

Recently the company has been assigned to do CAD two times development. is also the first contact with this aspect of things, in fact, some do not know how to feel. Because no one on this side of the company has time to take me, can only be their own reading, and then write some demo, and then the actual application to a little learning. Needless to say, recommend a book I get started, that is, Mr. Li Guanxi's "deep habitat shallow out of AutoCAD two development", write very good, the book of the demo himself will probably know the CAD two development in the end what is a thing.

Development Environment Configuration development environment
    • WIN10 x64
    • CAD 2010
    • Visual Studio 2012
Environment configuration
    1. First to install CAD software
    2. Create a new Class library project with Visual Studio.
    3. You need to add a common reference, in the CAD directory, the following three main DLL files are described below
    • AcDbMgd.dll is referenced when storing an object in a graphics file.
    • AcMgd.dll is referenced when working with AutoCAD applications and user interfaces.
    • AcGui.dll is referenced when processing a custom file.
Program and debug write the first program
    1. Add a class to the class library that you just created

      public class FisrtCADTest{[CommandMethod("Hello")]public void Hello{    Document acDoc = Application.DocumentManager.MdiActiveDocument;    Editor ed = acDoc.Editor;    ed.WriteMessage("Hello World!");}}
    2. Compile this program
    3. Start CAD Enter netload on the command line and find the DLL for the program you just compiled in the open window, and after loading, enter hello at the command line and guess what will happen? Yes, your first CAD two-time development program has been running flawlessly.

How to debug a program

The book describes a method, no longer repeat, the following is the way I used to
In Solution Explorer, right-click the solution and choose Add-Existing Project

In the dialog box that opens, locate the Acad.exe under the CAD installation path and select Open

Set the project you just added as the startup Project

Set project Properties

Modify the debugger type as shown in

Set breakpoints where needed, start the project, you will find the CAD program will be opened, netload loading the assembly, you can debug

C # for CAD two development environment configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.