Autodesk's latest. NET tutorial (III) (vb.net)

Source: Internet
Author: User

Chapter 4 database basics: create our own Employee object
 
Open the Lab3 project file in the Lab3 folder, or run the Lab2 code.
In this chapter, we will create a 'employee object' (including a circle, an ellipse, and a multiline text object ), this object belongs to a custom employeeblock' block (this block resides in the 'emptyayer' layer. When this block is inserted in the model space, the 'ployeelayer' layer will have a block index for this block ). The code in each step in this chapter can be run, so that you can better understand the functions completed by each part of the code. The first step briefly describes how to create a circle in the model space.
 
<! -- [If! Vml] --> <! -- [Endif] -->
 
This chapter focuses on accessing the database in AutoCAD. The main contents include Transaction, ObjectId, symbol tables, block table BlockTable and layer table LayerTable, and object reference. Other Objects used, such as Color, Point3d, and Vector3d, are related to their respective steps, but the focus should be on the database.
1) CREATE a command named 'create', which calls the CreateEmployee () function (). This function is used to create a circle with a radius of 2.0 at (10, 10, 0) points of the model space (MODELSPACE:
 
<CommandMethod ("CREATE")> _
Public Function CreateEmployee ()
'First declare the object we want to use
Dim circle As Circle 'is the circle we want to add to the model space.
Dim btr As BlockTableRecord 'to add a circle, we must open the model space
Dim bt As BlockTable to open the model space, we must access it through the block table.
 
'Let's use an object named 'Transaction' to encapsulate database operations in the function.
Dim trans As Transaction
 
'Use the StartTransaction () Member of TransactionManager to start transaction processing.
Trans = HostApplicationServices. WorkingDatabase (). TransactionManager. StartTransaction ()

Related Article

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.