Embedding objects to and from Windows: OLE in Creo Elements/Direct Drafting 17.0

Product: Creo Elements/Direct Drafting
Release: 17.00
Technical Area: Base Functionality

Embedding objects to and from Windows: OLE in Creo Elements/Direct Drafting 17.0


With OLE ('Object Linking and Embedding '), you can embed the output window from one Windows application into another Windows application. Use this, for example, to enhance a Microsoft Word document with Creo Elements/Direct Drafting drawings. Or add Microsoft Excel data to your Drafting drawing.  Follow these two examples to learn how to use OLE with your data:

Note. OLE enhancements in Creo Elements/Direct Drafting 17.0 are summarized at the end of this article.

Note. The examples below assume you have standard installations of Microsoft Word and Excel and Creo Elements/Direct Drafting. The file types ‘MI’ and ‘DOC/DOCX’ and ‘XLS/XLSX’ need to be registered on Windows.

Example 1: A Microsoft Word document enhanced with a Creo Elements/Direct Drafting OLE


Suppose you’re creating a product manual. You can use your Creo Elements/Direct drawing to illustrate your Word document. In this example, you’ll see how a section of a Creo Elements/Direct Drafting .mi file is embedded in Word.

Steps

1.    Start Microsoft Word
2.    Load the Word document
3.    Click  ‘Insert’ → 'Object’ (Fig. 1). 

Figure 1. Clicking ‘Insert’ → ’Object’ in Word.
Figure 1. Clicking ‘Insert’ → ’Object’ in Word.

 

4.    The dialog to embed an object appears. Activate the ‘Create from File’ tab (Fig. 2)
5.    ‘Browse’ to the Drafting drawing (the file must have a .mi file extension) and load it.

Figure 2. Browse to file, checkboxes.
Figure 2. Browse to file, checkboxes.

Note. The MI OLE object is now linked to the Word document, but the view is NOT updated. At this point, you should see a black rectangle (Fig. 3).

Figure 3.  View of the OLE in MS Word after link but before update.
Figure 3. View of the OLE in MS Word after link but before update.


6.    Click on the black rectangle. Drafting will start and load the drawing that you linked to the Word OLE (Fig. 4).

Figure 4. Drafting opened by Word.
Figure 4. Drafting opened by Word.


7.    The Drafting OLE will be inserted into Word with Drafting’s background color, line size, line color, and view. In the next few steps, you’ll modify Drafting settings to create just the view you want in the Word window. You can change the background color by inserting a macro command into Drafting’s command line (Fig. 5).


Type:     CHANGE_VIEWPORT_COLOR WHITE

Figure 5. Change viewport color.
Figure 5. Change viewport color.


8.    Change the geometry color to black with: ‘Geometry’ → ‘Change’ → ‘COLOR….’ → ‘Black’. Mark all geometry (Fig. 6).

Figure 6.  Change geometry.
Figure 6. Change geometry.


9.     Specify which part of the drawing appears embedded in the Word document from Creo Elements/Direct Drafting.  In this example, only the geometry within the red rectangle (Fig. 7) should fill the viewport. To isolate it, use:

 
Zoom:  ctrl + right Mouse button


Move:  ctrl + left mouse button

Figure 7. Drafting before isolating section of drawing.
Figure 7. Drafting before isolating section of drawing.


10.    Check the view in Drafting’s viewport.  The geometry shown in Drafting’s viewport is the same as that which will appear in Word (Fig. 8).

Figure 8. Drafting, ready to update OLE.
Figure 8. Drafting, ready to update OLE.


11.    Now you’re ready to update the drawing in Word. Close Drafting by clicking on the red cross. Answer the ‘Update’ question with ‘Yes’ (Fig. 9).

Figure 9. Update dialog.
Figure 9. Update dialog.


12.    In Word, you can now adjust the size of the Drafting OLE in your document. The blue rectangles (Fig. 10) show the frame of the Drafting OLE.

Figure 10.  OLE in Word.
Figure 10. OLE in Word.


13.     Move and zoom the Drafting OLE into the text (Fig. 11). Word can create different frames for embedded OLEs. In this example a broad black line was selected.

Figure 11. Drafting drawing embedded in Microsoft Word.
Figure 11. Drafting drawing embedded in Microsoft Word.

 

 

Example 2:


A Creo Elements/Direct Drafting drawing enhanced with a Microsoft Excel table


Suppose you’d like to include a workflow to a design. In this example, we embed data from an Excel file in a Creo Elements/Direct Drafting drawing.

Steps

1.    Generally, Excel spread sheets have black text on a white background (Fig. 1). Drafting has white text and geometry on a black background.

Figure 1. The Excel sheet to embed in Creo Elements/Direct Drafting 17.0 drawing.
Figure 1. The Excel sheet to embed in Creo Elements/Direct Drafting 17.0 drawing.



2.    Change in Excel text and frame color to white and the background color to black (Fig. 2) and store.

Figure 2. Excel sheet with Drafting’s text and background color.
Figure 2. Excel sheet with Drafting’s text and background color.



3.    Store the Excel sheet that is prepared for Creo Elements/Direct Drafting 17.0
4.    Start Creo Elements/Direct Drafting 17.0
5.    Load a drawing
6.    From Creo Elements/Direct Drafting, click ‘Insert’ → ’Object’. The Insert Object dialog appears (Fig. 3).

Figure 3. Creo Elements/Direct Drafting OLE menu.
Figure 3. Creo Elements/Direct Drafting OLE menu.



a.    In the ‘Inset Object’ menu, check  ‘Create from File’
b.    Browse to the Excel sheet
c.    Click ‘OK’


7.    Enter a Creo Elements/Direct Drafting internal name for the OLE, or accept the given OLE name (Fig. 4). In this case, we used the name, Excel.Sheet.12. The OLE will be listed with that name in Drafting’s OLE list.

Figure 4. Insert OLE name.
Figure 4. Insert OLE name.



8.    Now resize and move the OLE until it suits your drawing (Figs. 5 and 6). The OLE can be resized and moved as any Drafting object.

Figure 5. Excel sheet embedded in Drafting.
Figure 5. Excel sheet embedded in Drafting.


 

Figure 6. Final result: Creo Elements/Direct Drawing with an embedded, resized and positioned Excel sheet
Figure 6. Final result: Creo Elements/Direct Drawing with an embedded, resized and positioned Excel sheet

 


OLE enhancements in Creo Elements/Direct Drafting 17.0


OLE handling was introduced with Creo Elements/Direct Drafting 9. But Creo Elements/Direct Drafting 17 added outstanding enhancements in OLE handling for usability, printing, and inquiries. Now:

  • OLEs are attached to Drafting parts. OLEs can be handled inside the part structure.
  • Drafting OLEs are compatible with Annotation.
  • The following general commands can be applied to OLE; no separate commands needed anymore:
    • Undo/Redo support enabled
    • Delete
    • Move
    • Modify with all its options
    • Change Level
    • Show
    • Print to PDF and PS files enabled
    • Possible to inquire OLE objects (see next slide for inquire numbers)
  • The following inquire commands have been added  for OLE elements:
    • INQ 28 (returns Z-level for PICTURE and OLE)
    • INQ 318 (returns application name)
    • INQ 319 (returns class ID)
    • INQ 320 (returns OLE type as „LINK“, „EMBEDDED“ or „STATIC“)
  • The following inquire numbers for OLE elements have been revised:
    • INQ 403 (returns OLE, if OLE is selected and not PICTURE as before)
    • INQ 8 (returns 3 if OLE is shown in icon mode)

 

 

 

Did this document help you?
Yes
No
Not what I was looking for