If You Want to Experiment...


If You Want to Experiment

With a little help from a Visual Basic macro and OLE, you can have Excel extract attribute data from a drawing and then display that data in a worksheet imported into AutoCAD. The following exercise uses a Visual Basic macro embedded in the 14a-plan.xls file you used in an earlier exercise:

  1. Open the 14a-plan-xls.dwg file in AutoCAD again.

  2. Open the 14a-plan.xls file in Excel.

  3. Repeat the exercise in the "Combining Data from Different Sources" section of this chapter, but stop before exiting the two files.

  4. In AutoCAD, choose Modify   Attribute   Single and then click the door symbol in room 114.

  5. Change the Fire Rating Attribute value to 1 hour and then click OK.

  6. Go to Excel and then choose Tools   Macro   Macros.

  7. In the Macros dialog box, highlight the Extract macro and then click Run. Excel takes a moment to extract the attribute data from the open file; then it displays the data in the worksheet.

  8. Return to AutoCAD and check the Fire Rating Value for room 114 in the imported work- sheet. It reflects the change you made in the attribute in step 4.

  9. Close both files.

The macro you used in the Excel file is a small sample of what can be done using AutoCAD's implementation of Visual Basic Automation. You can learn more about VBA in Bonus Chapter 5, "Exploring VBA"on the CD.

In this chapter, you have seen how AutoCAD enables you to access information ranging from the areas of objects to data from other programs. You might never use some of these features, but knowing they are there could, at some point, help you to solve a production problem.

You've just completed Part III of our tutorial. If you've followed the tutorial from the beginning, this is where you get a diploma. You have reached Expert status in 2D drawing and have the tools to tackle any drawing project thrown at you. You only need to log in some time on a few real projects to round out your experience.

From now on, you won't need to follow the book's chapters in order. If you're interested in 3D, go ahead and continue to Part IV, where you'll get thorough instructions on 3D drawing and imaging with AutoCAD. Otherwise, you can skip to Part V to become a full-fledged AutoCAD power user .

Also, don't miss the appendices and the CD ”they are packed with information that will answer many of your specific questions or problems. Of course, the entire book is a ready reference to answer questions as they arise or to refresh your memory about specific commands.

Good luck!




Mastering AutoCAD 2005 and AutoCAD LT 2005
Mastering AutoCAD 2005 and AutoCAD LT 2005
ISBN: 0782143407
EAN: 2147483647
Year: 2004
Pages: 261
Authors: George Omura

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net