Select Page

Now that you’ve got database links established, you can begin to make use of them. In the following exercise, you’ll see how you can locate a database record by selecting an object in your drawing.

1. Go to the top of the table by clicking the first record button at the bottom of the Data View dialog box.

2.Click the View Linked Record in Table button in the Data View toolbar. The dialog box disappears.

3. Click the telephone in the upper-left comer of room 122, then click room numbers 114 and 116.

4. Press ↵ when you’ve completed your selections. The Data View Dialog box appears again with the records for employees 1020, 1022, and 2000 highlighted.

As you can see from step 3, you can select several objects. AutoCAD isolates all of the records that are linked to the selected objects. You can go a step further and have AutoCAD display only the records associated with the linked objects.

1. Right-click the Room Number link template in the dbConnect dialog box, then select Link Select. The Link Select dialog box appears.

2. Click the Select in Drawing < radio button near the top of Dialog Box.
3. Click the Select button. The dialog box disappears to all of you to select objects in the drawing.
4. Select room number 116, then press ,i. The Link Select dialog box reappears,
5. Click Finish. The Data View dialog box now displays only the record linked to the room number you selected.

The Link Select dialog box offers many more features that allow you to locate data either within your drawing or in your database.

Finding and Selecting Graphics through the Database

You’ve just seen how you can use links to locate records in a database. Links can also help you find and select objects in a drawing that are linked to a database. The next exercise shows, in a simplified way, how this works.

1. Click the Employee listing in the dbConnect dialog box, then click the Edit Table tool to open the entire table.
2. In the Data View dialog box, select the record for employee 2000. You can use the Last Record button to take you there.
3. Click the View Linked Objects in Drawing tool in the toolbar. The display shifts to center the linked object in the AutoCAD window.

4. Move the Data View dialog box out of the way temporarily so you can view your drawing. Notice that the room number 122 and the telephone are highlighted and their grips are exposed:

Once these steps have been taken, you can use the Previous Object Selection option to select those objects that were highlighted in step 3.

In this example, you only selected objects in one office.However, you can create a record called Vacant, and then link all the vacant offices to this one record. When a new employee is hired, you can then quickly locate all the vacant rooms in the floor plan to place the new employee. If you continue to link each database record with rooms in the drawing, you can then later locate a person’s room through the same process.

Adding Labels with Links

Database links can help you add labels to a drawing by using the data from a database table for the label text. The following exercise will show you how you can add the employee name and telephone extension number to the sample drawing.

1. In the Data View dialog box, click the Link and Label Settings tool in the toolbar and make sure that the Create Freestanding Labels option is selected. When you do this, the tool to the left changes to the Create Freestanding Label tool.

2. Click the button to the right of employee number 2000 to select that record.

3. Click the Create Freestanding Label tool in the toolbar. The New Label Template dialog box appears .

4. Enter the name Employee Names, then click Continue. The Label Template dialog box appears.

Notice that it looks quite similar to the Multi line Text Editor.

5. Click the Character tab and highlight the text in the text box.

6. Click the Text Height drop-down list and enter 6↵.

7. Click the Label Fields tab.

8. Select Last Name from the Field drop-down list, then click Add the LAST_ NAME entry appears in the text box.

9. Select Title from the Field drop-down list, then click Add again. The TITLE entry appears in the text box.

10. Click OK. The dialog box disappears and the point selection cursor appears in the AutoCAD window.

11. Click a clear location in room 122. The last name a-id title of employee 2000 appear as text in the drawing. Notice that these are the actual field values from the record you selected in step 2 and that they are the values from the fields you selected in steps 5 and 6.

Notice that now you have a listing in the dbConnect dialog box called Employee Names. This is the Label template you created in steps 4 through 10.

Next, you’ll add a few more employee name labels to the floor plan. First you’ll turn on the AutoView Linked Objects in Drawing tool so you can pan to the selected room number automatically. Then you’ll proceed to add the new labels.

1. In the Data View dialog box, click the AutoView Linked Objects in Drawing tool.

2. In the Data View dialog box, click the button to the far left of the record for employee number 1020.Your view of the drawing pans to the link in room 114 that is already established in the drawing.
3. Click the Create Freestanding Label tool.
4. In the drawing, click a clear space in room 114 to place the label.
5. In the Data View dialog box, select the record for employee number 1022,then click the Create Freestanding Label tool.
6. In the drawing, click a free space in room 116 to place a label there .

Each label you add is linked to its corresponding record in the database. Notice that the label template appears just below the link template in the dbConnect dialog box. This tells you that the label template is dependent on the link template.

If you want to create labels based on different field data, you can create other label templates that include different sets of field values.

Adding Linked Labels

1. In the dbConnect dialog box, highlight the Employee listing, then dick the New Label Template tool or right-click and select New Label Template from the popup menu .
2. In the New Label Template dialog box, enter Extension in the input box, then click Continue.
3. In the Label Template dialog box, select the Character tab.
4. Highlight the value in the Font Height drop-down list and enter 8↵.
5. Select the Label Fields tab and select Ext from the Field drop-down list.
6. Click Add, then click OK to exit the dialog box.

You now have a label template for the telephone extension numbers. This label template is also dependent on the link template you created earlier In this set of exercises. You can use this template to automatically add phone extension labels to the drawing.

1. In the Data View dialog box, make sure the Extension label template shows in the Label Template drop-down list.
2. Click the Link and Label Settings tool and select Create Attached Labels.
3. Select the record for employee number 1020, then click the Create Attached Label tool. Extension number labels appear on each item that is linked to the record. The labels are placed on top of the object they are linked to.
4. Click the extension label that is on top of the employee name, then use its grip to move it away from the name. This shows you that the labels can be adjusted to a new position once they are placed.
5. Repeat steps 3 and 4 for employee numbers 1022 and 2000.

Each label you add with the Create Attached Label tool is linked to its associated record in the database.

Hiding Labels

You can edit the label in your drawing as you would any other multi line text object. Another characteristic of database labels is that you can control their visibility.

1. Right-click the Extension label template listed in the dbConnect dialog box, then select Hide Labels. The labels associated with the extension label template disappear.
2. Right-click the link template again and click Show Labels. The label reappears.

If you want to delete all of the labels associated with a label template, right click the label template’S name in the dbConnect dialog box, then select Delete Labels from the popup menu. Once you’ve done this, you can delete the label template as well by right-clicking the label template name and selecting Delete from the popup menu.

Editing Links

People and databases are always changing, so you need a way to update the links between your database and objects in your drawing. AutoCAD offers the Link Manager for this purpose.

Suppose you want to delete the link between the room number 116 in your drawing and the record for employee 1022.

1. Choose dbConnect > Links > Link Manager.
2. Click the room number 116 in your drawing. The Link Manager dialog box appears.

3. Click the Delete button.
4. Click OK. The link is removed and the linked label disappears.

You can also delete all the links associated with J link table by choosing dbConnect > Links )- Delete Links. A dialog box appears, displaying ↵ list of link tables.

Where to Go from Here

You’ve seen how you can access and link your drawing to a database. This brief tutorial can help you find the information you will need to develop your own database needs.

If you understand SQL, you can take advantage of it to perform more sophisticated searches. You can also expand the functionality  of the basic ASE package included with AutoCAD. These topics are, unfortunately, beyond the scope of this book. For more detailed information about dbConnect and SQL, refer to the AutoCAD SQL Extension reference manual.

If You Want to Experiment

Attributes can be used-to help automate data entry into drawings. To demonstrate this, try the following exercise.

Create a drawing file called Record with the attribute definitions shown.Note the size and placement of the attribute definitions as well as the new base point for the drawing. Save and exit the file, and then create a new drawing called Schedule containing the schedule shown. Use the Insert command and insert the Record file into the schedule at the point indicated. Note that you are prompted for each entry of the record. Enter any value you like for each prompt. When you are done, the information for one record is entered into the-schedule.

Share This