Autodesk's latest. NET Tutorial (1) (VB. NET)

Source: Internet
Author: User
Tags wrapper hosting
 
Chapter 2 "Hello World": creating a project
In this chapter, we will not use the ObjectARX wizard to create a new project. We will use Visual Studio. NET to create a new class library project. Through this project, you can create a. NET dll file that can be loaded by AutoCAD. This dll file will add a new command named "HelloWorld" to AutoCAD. After you run this command, the "Hello World" text is displayed on the AutoCAD command line.
1) start Visual Studio. NET and select "File> New> Project" (File> New> Project ). In the Create project dialog box, select Visual Basic project as the project type, select the class library template, enter Lab1 in the project name box, and select the project storage location. Click OK to create a project.
2) in the Class1.vb file of the project, a public class "Class1" has been automatically created by the system. Next, add the command to this class. To add commands, you must use AutoCAD. NET to host the encapsulation class. These managed encapsulation classes are included in two managed modules. To add references to these two managed modules, right-click "reference" and select "Add Reference ". In the Add reference dialog box that appears, select browse ". In the select component dialog box, select the installation directory of AutoCAD 2006 (C: Program FilesAutoCAD 2006), and find "acdbmgd. dll "and then select and open it. Select browse again, find acmgd. dll in the installation directory of AutoCAD 2006, and open it. After these two components are added, click "OK" in the "Add reference" dialog box. As their names indicate, acdbmgd. dll contains the ObjectDBX hosting class, while acmgd. dll contains the AutoCAD hosting class.
3) use the object browser (Visual Studio. NET's "View> Other Windows> Object Browser" menu item) to browse the classes provided by the added two managed modules. Expand the "AutoCAD. NET Managed Wrapper" object (displayed as acmgd in the object browser), and we will use the class in this object throughout the tutorial. In this chapter, we will use an instance of the "Autodesk. AutoCAD. EditorInput. Editor" class to display text in the AutoCAD command line. Expand "ObjectDBX. NET Managed Wrapper "object (displayed as acdbmgd in the object browser ), the classes in this object will be used to access and edit entities in the AutoCAD drawing (this part will be described in later sections ).

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.