24.5 Extra Steps

 < Day Day Up > 



24.4 Working with Linked Objects – Object Linking and Embedding (OLE)

Let's begin with the obvious: Exactly what is OLE? You've probably heard the term since you began using computers, but what does it mean?

OLE stands for Object Linking and Embedding. It refers to the method of creating a compound document – a document that requires more than one application (program) to create. In other words, you might use OLE to show a bill of materials on an AutoCAD drawing by linking directly to the Excel spreadsheet or MS Access database file where the information is stored. (These are Microsoft examples; other programs can be used as well.)

The Object part of OLE refers to something that you'll add to your drawing (or other Windows program file). The object is actually a file, part of a file, or graphic image that originated in another program.

Note 

There are actually three Object terms. The first – OLE Object – I explain below. The second – OLE Server – refers to the source program that originated the object. The third – OLE Container – refers to the program to which you wish to link or embed the object.

The Linking and Embedding part of OLE refers to how you wish to attach the OLE Object from the OLE Server to the OLE Container document. A linked document maintains its ties with the server file. Any changes made to it'll reflect in the original linked document. An embedded document has no ties with the server file. Changes made to it are unique within your compound document.

Both linked and embedded documents require the OLE Server application (program) for editing.

24.4.1 Inserting Other Application Data into AutoCAD Drawings

Microsoft and AutoCAD each provide a method for inserting an OLE Object into a document/drawing. The Microsoft method utilizes the clipboard and an AutoCAD dialog box. It gives greater control over exactly what will be inserted but requires that the server file be opened in the server application. The AutoCAD method utilizes two dialog boxes and doesn't require that the server application be opened, but it doesn't offer as much control over what will be inserted.

We'll see each of these methods in our exercise. But first, let's take a look at the AutoCAD dialog boxes.

AutoCAD presents the Insert Object dialog box (Figure 24.4.1a) when you enter the InsertObj command. Here you find two options for creating the image you wish to insert, and a Display As Icon check box.

click to expand
Figure 24.4.1a

  • When you place a check in the Display As Icon box, AutoCAD displays the server application's icon in the drawing instead of the file itself. Double-clicking on the icon calls the object file for editing. This can speed display time.

  • A bullet in the Create New option causes the Object Type list box to display a list of all the programs on the computer available for OLE communication. Use this approach when an OLE Object doesn't exist and you want to create one. Objects created using this method are automatically embedded into the drawing.

  • A bullet in the Create from File option will cause AutoCAD to switch the Object Type list box with the File text box, Browse… button, and Link check box shown in Figure 24.4.1b.

    click to expand
    Figure 24.4.1b

You'll use the File text box to enter the name and location of the file you wish to insert. Alternately, you can pick the Browse… button to use a Windows standard Open File dialog box to select the file you wish to insert.

A check in the Link box will link the object to your drawing rather than embedding it.

If you're embedding an object (regardless of whether you've used the Create New or Create from File method for inserting your OLE Object), AutoCAD will present the OLE Properties dialog box next (Figure 24.4.1c – next page).

click to expand
Figure 24.4.1c

  • The Size, Scale, and Text size frames provide three methods for sizing the old Object.

    • In the Size frame, AutoCAD displays the object's current Height and Width. Resize the object by entering a new Height and Width.

      Pick the Reset button to return the object to its original size (its size when it was inserted).

    • In the Scale frame, you can resize the object by percentages. A check in the Lock Aspect Ratio box means that AutoCAD will scale the object proportionally. For example, a 50% change in height will automatically cause a 50% change in width as well.

    • Changes in the Text size frame may or may not cause a resize of the entire OLE object. It depends on whether all of the text is resized and whether that resizing requires the size of the OLE object to change.

      The first text box in the frame indicates the font (if any) used in the object. Pick the down arrow to see other fonts used in the same object.

      The next text box indicates the font sizes used.

      When you place the size you wish the text to be – in drawing units – in the third text box, AutoCAD will adjust the size of the OLE Object as necessary. (We'll see this in our next exercise.)

  • Below the frames, you'll find the OLE plot quality control box. Here you have options (Figure 24.4.1d) for controlling the quality of the OLE bject at plot time. When making a selection here, keep in mind the capabilities of your printer/plotter. Most plotters don't have Photograph or High quality photograph capabilities.


    Figure 24.4.1d

  • Leave the check in the Display dialog when pasting new OLE Objects box unless you're sure the size and default settings are what you want, or if you wish to insert several objects and change the properties later. (We'll see how to manually call the OLE Properties dialog box in Section 24.4.2.)

Let's insert an Excel spreadsheet into our cutting table drawing. (Note: This exercise requires the use of MS Excel – Office 97 Release or better. If you don't have this software on your computer, read through the exercise, but don't try to do it.)

Note 

The Object Properties Manager won't recognize OLE Objects.

OLE Objects are hidden in a rendered drawing.

You can also access the Insert Object dialog box using the OLE Object… selection on the Insert pull-down menu.

Additionally, you can access the OLE Properties dialog box using the cursor menu when the OLE object has been selected.

Do This: 24.4.1.1 Inserting OLE Objects

  1. Reopen the cutting table24.dwg file in the C:\Steps\Lesson24 folder. If you haven't completed work on that drawing, open the cutting table-done.dwg file in the same folder.

    We'll insert the OLE Object (the Excel spreadsheet) twice to see both methods of insertion and both types of insertion.

    • Using the AutoCAD method, we'll embed the object.

    • Using the Microsoft method, we'll link the object.

  2. Zoom extents.

  3. Follow these steps.

    TOOLS

    OMMAND SEQUENCE

    STEPS

    OLE Object Button

    Command: io

    1. Enter the InsertObj command by typing insertobj or io at the command prompt. Alternately, you can pick the OLE Object button on the Insert toolbar.

     

    2. On the Insert Object dialog box, pick the Create from File option. AutoCAD presents the dialog box you saw in Figure 24.4.1b.

     

    3. Pick the Browse… button.

    click to expand

    4. AutoCAD presents the rowse dialog box (a indows Select File dialog box). Select the Cutting List.xls file (an Excel spreadsheet) in the :\Steps\Lesson24 folder.

    Pick the Open button to continue.

     

    5. AutoCAD returns to the Insert Object dialog box. We'll embed the spreadsheet object into our drawing, so be sure the Link check box is clear.

     

    6. Pick the OK button to complete the command. AutoCAD places the OLE Object in the upper left corner of the screen and presents the OLE Properties dialog box.

    7. Notice the Height and Width in the Size frame, and then change the Width to 5.5. Pick any of the other text boxes and watch as AutoCAD automatically updates the Height and Width in both the Size and Scale frames.

    Pick the OK button to complete the command. Your drawing looks like Figure 24.4.1.1.7a.

     

    click to expand
    Figure 24.4.1.1.7a

      

    8. Move your cursor over the object. Notice that it changes into something like the icon on the Move button. In fact, it's the icon used for moving an OLE Object. Pick on the object and drag it (holding down the left mouse button) to the open area on the right side of the drawing (Figure 24.4.1.1.8a).

     


    Figure 24.4.1.1.8a

    Microsoft Excel Shortcut

     

    9. Open the Cutting List.xls file in Excel.

     

    10. Return to AutoCAD. (You can pick the AutoCAD button on the task bar or hold down the Alt key while tabbing to AutoCAD.)

    click to expand

    11. Double-click on the OLE Object to edit it. Notice that the object opens in Excel for editing. But notice also that the name of the file being edited is Worksheet in Cutting Table.dwg.

    Change the value of cell A3 to read Red Oak. (Be sure to hit enter to finish the procedure.)

      

    12. Repeat Step 10. Notice that the value of the material in the first row has changed (Figure 24.4.1.1.12a). (You may need to Regen the drawing to see the change.) This is how you'll edit embedded OLE Objects.

     


    Figure 24.4.1.1.12a

     

    13. Return to Excel and close the Worksheet in cutting table.dwg file. Excel then presents the original Cutting List.xls file. Notice that it hasn't changed. Remember that the OLE Object was embedded into the OLE Container, not linked to the original file.

    Command: u

    14. Leave Excel running, but return to AutoCAD and undo all the changes (until the OLE Object is no longer in the file).

    click to expand

    15. Now we'll use the Microsoft method for inserting an OLE Object. Return to the spreadsheet and highlight the data cells (A1:F10) as shown.

     

    16. On Excel's Edit pull-down menu, select Copy to copy the highlighted section to the Windows clipboard.

     

    17. Return to AutoCAD.

    Command: pastespec

    18. On AutoCAD's Edit pull-down menu, select Past Special…. (Notice that there is also a Paste option. This one will embed the clipboard material into the document/drawing.) Alternately, you can enter the Pastespec command at the command prompt.

      

    19. AutoCAD presents the Paste Special dialog box (Figure 24.4.1.1.19a). By default, it'll embed the objects. Notice the formats available for embedding objects.

    Pick the Paste Link option. Notice that, when linked, the image must be in the format of the OLE Server application (Figure 24.4.1.1.19b).

     

    click to expand
    Figure 24.4.1.1.19a

     

    click to expand
    Figure 24.4.1.1.19b

     

    20. Pick the OK button to link the clipboard object (the Excel spreadsheet) into your AutoCAD drawing.

    21. AutoCAD places the OLE Object in the upper left corner of the graphics screen. This time, notice that it doesn't open the OLE Properties dialog box. We can, however, open it with a cursor menu.

    Right-click in the OLE Object and select Properties… from the cursor menu.

    22. AutoCAD presents the OLE Properties dialog box. We could resize our OLE Object as we did in Step 7, but this time we'll size the text to be consistent with the rest of the text in our drawing. Enter .125 in the Text size frame as indicated.

     

    23. Pick the OK button to complete the command.

      

    24. Repeat Step 8 to reposition the text. Notice how much better it fits (Figure 24.4.1.1.24a).

     


    Figure 24.4.1.1.24a

     

    25. Return to Excel and exit the program.

      

    26. Now let's see what happens when we edit a linked object. Double-click on the OLE Object. AutoCAD opens the OLE Server application (Excel) with the appropriate file. (Notice that the name of the file is Cutting List.xls – our original file, not an embedded copy.)

    27. To make our OLE Object consistent with our drawing, change the font to Times New Roman (in Excel).

    click to expand

    28.Now change the White Pine materials to Ponderosa Pine.

     

    29. Save the changes in Excel and exit the program.

     

    30. Return to AutoCAD and notice the changes. These changes have been incorporated both in the original document and in the AutoCAD link.

    Command: qsave

    31. Save the drawing. It now looks like Figure 24.4.1.1.31a.

     

    click to expand
    Figure 24.4.1.1.31a

You have now practiced inserting OLE Objects. You've seen the difference between embedding and linking, but you haven't seen some of the OLE editing tools AutoCAD provides. Let's take a look at these now.

24.4.2 Modifying OLE Objects

For many reasons, I prefer OLE to imaging via the Image command. I particularly enjoy the versatility offered by being able to edit an OLE Object using its source application. I'm no longer restricted to AutoCAD's commands and procedures. (Although an impressive program, AutoCAD can't do all things.) But thanks to some brilliant programmers at both Autodesk and Microsoft, I can use all of the programs and applications on my computer in a holistic approach to provide my client with a more complete product.

But AutoCAD does provide some additional tools for controlling the OLE image once it becomes part of our drawing. Let's look at these now.

  • Right-click menu.

    AutoCAD's cursor menu provides convenient access to those commands most necessary for working with LE Objects (Figure 24.4.2a).


    Figure 24.4.2a

    • The first two options – Cut and Copy – utilize Windows' clipboard to move or copy an OLE Object.

    • Clear works as an erase-type command to remove an OLE Object from your drawing. (You can also erase an OLE Object.)

    • Undo does what it always does – undoes the last command or procedure.

    • A check beside Selectable means that you'll be able to select an OLE object. Removing the check means that you won't. You can, however, still access the cursor menu whether the OLE Object is selectable or not.

    • Bring to Front and Send to Back execute the corresponding option of the DrawOrder command.

    • The Properties… option presents the OLE Properties dialog box. Use this to change the properties of a linked object.

    • The final pick – shown here as Linked Worksheet Object – provides object- specific options. Among the options you'll generally find in the flyout menu are an Edit option (for editing the OLE Object) and a Convert option. Convert allows you to change the source application for an embedded object.

  • Olehide. You can use any of four settings for the Olehide system variable to control the display of an OLE Object both on the screen and when plotting. A setting of

    • 0 (the default) makes all OLE Objects visible.

    • 1 makes only OLE Objects in Paper Space visible.

    • 2 makes only OLE Objects in Model Space visible.

    • 3 hides all OLE Objects.

  • Olelinks. The Olelinks command presents the Links dialog box (Figure 24.4.2b). Here you find several options.

    click to expand
    Figure 24.4.2b

    • The list box shows all the linked OLE Objects in the drawing. Select the one with which you want to work.

    • The Update Now button will update the OLE Object by reading the source file and making any necessary adjustments.

    • Open Source opens the OLE Object in its source application.

    • Change Source… provides an opportunity to change the source of the link.

    • Break Link converts the selected OLE Object into a picture of the object. Use caution when doing this because you can't modify the picture. It's a handy way, however, to send the drawing to a client who might not have the OLE Server application. Remember: The OLE Server application must be loaded on the computer for an OLE Object to be visible!

    • At the bottom of the dialog box, you'll find two option buttons. Selecting Automatic means that AutoCAD will update the links as they change. Selecting Manual means that you must update the links yourself (using the Update Now button) whenever you want them updated.

  • Olescale. Olescale calls the Properties dialog box where you can adjust the scale of the OLE Object (as you did in our last exercise).

  • Olestartup. This system variable controls whether or not the OLE Server application loads when you plot the drawing. A setting of 0 (the default) won't load the application. A setting of 1 will load the application. Loading the application often improves the quality of the plot.

  • Olequality. You can set the OLE plot quality in the corresponding control box on the OLE Properties dialog box, or you can set the system variable at the command line. The possible settings and their meanings follow:

    • 0 produces line art quality. This is the lowest quality but is appropriate for embedded spreadsheets.

    • 1 (the default) produces text quality. Use this for text documents (like Word or Wordpad). (I prefer a setting of 1 for spreadsheets as well, since a spreadsheet is mostly text.)

    • 2 produces graphics quality. It works well for charts, bitmaps, or simple artwork.

    • 3 produces photographic quality and works well for the type of photograph we used in our cutting table drawing.

    • 4 produces the best results. Use it for high-quality photographs such as aerial or satellite photos used as background for plot layouts.

24.4.3 AutoCAD Data in Other Applications

The methods and procedures for using an AutoCAD drawing in another application (such as Word or Excel) don't differ from what you've already seen. The only limitation involves Paper Space and Model Space views. Remember that you can't select objects in Paper Space if Model Space is active (and vice versa). This presents a problem when copying objects to the clipboard. But let's try an exercise copying our cutting table drawing into a Wordpad document.

Do This: 24.4.3.1 Using AutoCAD Drawings in Other Applications

  1. Be sure you're stil in the cutting table24.dwg file in the C:\Steps\Lesson24 folder. If not, please open it now.

  2. Follow these steps.

    TOOLS

    COMMAND SEQUENCE

    STEPS

     

    1. Pick on the Model tab.

      

    2. Without entering a command, select all of the objects on the screen.

     

    3. Right-click in the graphics area and select Copy from the cursor menu. This places all of the selected objects on the Windows clipboard.

      

    4. Open Wordpad. Follow this path from the Start button on Windows' desktop:

        Start – Programs – Accessories – Wordpad

     

    5. In Wordpad, pick the Paste Special… option on the Edit pull-down menu.

    click to expand

    6. Wordpad presents the Paste Special dialog box.

    Highlight AutoCAD Drawing in the list box, and make sure there is a bullet next to Paste. Then pick the OK button.

     

    7. Return to AutoCAD and close the cutting table drawing. (Leave the application running.)

      

    8. Back in Wordpad, double-click on the drawing image. Notice that AutoCAD launches with Drawing in Document on the title bar. You've embedded an AutoCAD drawing into a Wordpad document!

      

    9. Close both applications without saving.

Of course, linking an AutoCAD drawing into another application's document is as easy!



 < Day Day Up > 



AutoCAD 2004. One Step at a Time
3D AutoCAD 2004/2005: One Step at a Time
ISBN: 0975261371
EAN: 2147483647
Year: 2003
Pages: 96

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