Chapter 2 database basics 2: add custom data
In this chapter, we will create a new dictionary object to represent the Department of The 'acme company '(which, of course, is a fictitious company) where our employees work. This "department" dictionary object will contain a record indicating the department manager. We will also add code to the employee creation process, which will add an index to the employee's department.
We want to explain how to create custom data in the DWG file, including "custom data for each image" and "custom data for each entity. The Custom Data of "each graph" refers to the data that is added only once in the whole graph. It indicates a single type or feature that an object can reference. Custom Data for each object refers to the data that is added to a specific object or an object in the database.
In the following example, we add the custom data of "each graph" to the named object dictionary (NOD ). NOD exists in each DWG file. The custom data of each object is added to an extended Dictionary (optional), which indicates every employee. Each object derived from DBObject has an extended dictionary that stores custom data. In our example, we will include such custom data such as name, salary, and department.
Therefore, this chapter focuses on dictionary objects and extended records, which are containers used to represent custom data.
First, let's create entries that represent the company. In the previous steps of this chapter, we will create the department hierarchy as follows:
NOD-name object dictionary
ACME_DIVISION-custom company dictionary
Sales-department dictionary
Department Manager-department entry
Open the Lab4 project in the Lab4 folder or add the Lab3 code.
<! -- [If! SupportLists] --> 1) <! -- [Endif] --> the first thing we need to do is to define a new function, which is used to create a company dictionary object in the named object dictionary (NOD. Name this function