Anda di halaman 1dari 21

Customizing the ESPRIT Report Generator

A machining report is an effective way to increase efficiency and reduce errors on the shop floor with little cost involved. The ESPRIT Report Generator automatically generates reports that include an easy-to-read list of all tools and operations in an ESPRIT document. Both standard and detailed reports are available that provide the machining details an operator needs to correctly set up a machine and perform the required machining operations. For manufacturing environments that need more complex, detailed, or differently formatted reports, ESPRIT offers tools you can use to create your own custom reports.

You Will Learn How the Report Generator works The basics of HTML How to customize the HTML formatting in the report How to add a company logo How to customize the data in the report How to add programming functionality with JavaScript

dptechnology.com

The Report Generator Outputs reports in HTML or PDF Outputs detailed and summary reports Generates reports from standard template files Lets you create customized template files

The ESPRIT Report Generator outputs HTML and PDF reports of machining operations and tool data in an ESPRIT document. The Report Generator includes 5 standard, preformatted reports: EDM: Outputs the operation list of all wire EDM operations Milling_Detailed and Turning_Detailed: Outputs the operation list, tool list, and details on individual operations and tools Milling_Summary and Turning_Summary: Outputs the operation list only

Customizing the ESPRIT Report Generator

Summary report

Detailed reports

dptechnology.com

How does t he Repor t Generator work?


When a report is generated, the data in the ESPRIT file is saved into XML files. The data in those XML files is formatted into a viewable report using HTML report templates. The same XML data can also be used by custom VB mcros to save data into other formats (such as an Excel spreadsheet). To generate a report, click Create Reports on the File menu and choose the type of report to create. By default, the report is saved to your user folder under ...\username\Documents\DP Technology\ESPRIT\Data\ReportGenerator\Reports.

Customizing the ESPRIT Report Generator

Repor t G ener ator O pt ions


When you click the Options button in the Report Generator dialog, you can define how and where ESPRIT reports are generated, saved and viewed. By default, the Report Generator outputs HTML files. You can set options to:

Set your options and preferred folder locations before generating a report.

Output PDF files Set the numerical formatting Generate the database schema file (described on the next page)

Change the folder location for generated reports Change the folder location for custom report templates Define the program or Web browser you will use to view the HTML files Define the program you will use as your XML editor Define the program you will use as your PDF viewer

dptechnology.com

The d at a base sc hema file


The options dialog lets you generate the database schema file. This is a .txt file that contains keywords for all the types of data available to the Report Generator. General document data (system unit, machining mode, part type/material, ...) Machine setup data General operation data (operation name, type, work coordinate, rotary angles, ...) Operation technology (operation parameters, CL codes, ...) Tool technology (tool parameters, CL codes, ...)

Customizing the ESPRIT Report Generator

The User Tool


If you define your XML editor in the options dialog before you click User Tool, the system will automatically open the XML editor after the XML files are generated. The User Tool button on the Report Generator dialog lets you manually generate the XML files that are used to generate the report. The content in the XML files is similar to the database schema file except that they contain actual data from the ESPRIT document and only the types of data specific to the chosen report type.

dptechnology.com

The basics of HTML


HTML stands for HyperText Markup Language and is the predominant markup language for pages displayed in a Web browser. A markup language is a combination of words and symbols that give instructions on how a document should appear. A familiar markup language is still used by editors and teachers to mark up printed manuscripts and essays with symbols and revision instructions written in an ink color different from that of the author. HTML code can be typed by hand in a word processor or text editor, or created in one of many Web design programs. Files with the extension .htm or .html are read by Web browsers.

Customizing the ESPRIT Report Generator

HTML element s
HTML documents are made up of HTML elements, which consist of tags enclosed in angle brackets within the Web page content. HTML elements form the building blocks of all websites. HTML tags normally come in pairs like <p> and </p> to denote a paragraph of text. The first tag in a pair is the start tag, the second tag is the end tag (they are also called opening and closing tags). For example, a title element is defined by a pair of title tags: <title>This is the title</title> The title tags control the text displayed at the top of the Web browser or the browser tab title. All HTML documents have the key elements shown below: <html> <head> <title>Machining Report</title> </head> <body> </body> </html>

The text between the <html> tags describes the Web page. Content between the header tags is not displayed on the Web page, except for the title element. Everything between the <body> tags describes the visible content on the page (text, images, tables,...).

HTML at t ributes
Attributes define details about an element. Most elements have attributes that can be defined. Most attributes are name-value pairs, separated by = and written within the start tag of an element after the elements name. For example, the appearance of a paragraph element can be defined by a style attribute. <p style=color:red>Text of paragraph.</p> The class attribute provides a way of classifying similar elements. For example, to classify types of text. <p class=Title>Machining report</p>

S t y les
Instead of individually defining the style attributes for each element, style elements can be defined for the entire HTML document in the header. The type attribute must always be set to text/css (css stands for Cascading Style Sheet). <head> <style type=text/css> ****Style settings for paragraph elements, title elements, table elements, image elements, etc. go here**** </style> dptechnology.com 5

</head> <body></body> </html>

Customizing the ESPRIT Report Generator

Ta bles
The default ESPRIT report templates use Table elements to keep the data organized. Instead of rows and columns, HTML tables are made up of rows and cells. Each row can contain any number of cells. The elements used in HTML tables are: The table <table> element Table row <tr> elements Table cell <td> elements The example shown below produces a simple table with one row that contains three cells: <table border=1> <tr> <td>First Cell</td> <td>Second Cell</td> <td>Third Cell</td> </tr> </table>

Images
Images are displayed with the <img> tag that contains a reference to the source of the image file. If the image is stored in the same folder as the HTML template, you only need to specify the name of the image file. Otherwise, the reference must also include the folder location. The IMG tag has no closing tag. <img src=company_logo.gif />

Default repor t templates


The default HTML report templates are installed with ESPRIT. They are located in the ESPRIT program folder under: Program Files\D.P.Technology\ESPRIT\Data\ReportGenerator\Templates

dptechnology.com

Custom repor t templates


Custom report templates are controlled by the user. The easiest way to create custom templates is to start by copying the default templates to your user folder. Copy t he d ef aul t t emplat es from t he program fold er From the ESPRIT program folder, navigate to the folder ESPRIT\Data\ ReportGenerator\Templates. Right-click on the folder and select Copy from the menu.

Customizing the ESPRIT Report Generator

Pa st e t he t emplat es to t he user docum ent fold er In your user folder, navigate to the folder username\Documents\DP Technology\ESPRIT\Data\ReportGenerator. Right-click on the folder and select Paste.

dptechnology.com

Customizing the ESPRIT Report Generator

Rena m e t he individual t emplat e fold er s There is no restriction on the name of the report folder. However, the name of the summary template must always be OpSummary.htm and the detailed template must be OpDetailed.htm. A report will not generate if you use any other names. Rename the folders in your user folder by adding -Custom to the name.

V iew t he new t emplat es in t he Repor t G enerator dialog In ESPRIT, click Create Reports on the File menu. Notice that the custom reports are added to the list.

Editors for HTML templates


HTML code can be edited with text editors like Notepad and WYSIWYG (What You See Is What You Get) editors like Dreamweaver. The examples in this guide are shown in UltraEdit. Any text editor or HTML editor can be used to edit the HTML report templates. An inexpensive editor is UltraEdit, a multi-purpose text, HTML and XML editor, and an advanced PHP, Perl, Java and JavaScript editor for programmers. UltraEdit is useful for editing HTML because the syntax highlighting lets you visually sort your code by highlighting related parts of the source code as different colors. Information about UltraEdit is available here: http://www.ultraedit.com A free trial version of UltraEdit is available here: http://www.ultraedit.com/downloads/ ultraedit_download.html.

dptechnology.com

Changing t he company logo


One of the first customizations to a template is usually to replace the standard ESPRIT logo with the logo of the company generating the report. Copy t he new logo imag e The sample files for the lessons in this guide are located in the ReportGeneratorFiles folder, available for download here (an ESPRITWeb login is required). Copy the image file generic_logo_200x200.gif from the folder ReportGeneratorFiles to ..\Documents\DP Technology\ESPRIT\Data\ ReportGenerator\Templates\EDM-Custom.

Customizing the ESPRIT Report Generator

Up d at e t he custom repor t t emplat e In the folder EDM-Custom, open the file OpSummary.htm in your preferred editor. This is the template file used to create the summary report for EDM operations. Replace ESPRIT_Logo_RGB_180x64_Web.gif in the template with genericlogo_200x200.gif . Add attributes for width and height to scale the image from 200 pixels x 200 pixels to 110 wide x 110 high: When you float a visible element like an image, it becomes a block that can then be shifted to the left or right as far as possible. Any text is then nicely wrapped around the image. The logo in this template will always appear at the far right of the screen, no matter how much the screen is resized. <p><img src=generic-logo_200x200.gif width=110 height=110 style=float: right /></p>

dptechnology.com

Customizing the ESPRIT Report Generator

V iew t he up d at e Save the file. View the file in your Web browser to see the new logo. Keep the EDM-Custom\OpSummary.htm template file open for the next lesson.

Notice that the title now wraps to the left of the logo.

Changing t he format t ing of a repor t


A report template can be edited to change how the information or images are displayed. A report can also be edited to add or remove information depending on the needs of the shop floor.

Repor t set t ings


At the beginning of the report template are standard report settings. The Settings section starts with BEGIN_SETTINGS and ends with END_SETTINGS. 0 is false and 1 is true. Most of these settings control the pictures that are generated in the report. Picture sizes are in pixels. The value for NAReplacementString is used when a parameter value is not available. Lesson Summary Change the size of the part picture Replace the data shown in the header table Modify columns in the operation table Use a style tag to set the background color of table headings M ake t he par t pic ture larg er Start by changing the size of the part picture from 300 x 300 pixels to 350 x 350. Set PartPictureWidth=350 Set PartPictureHeight=350 Next, you need to adjust the size of the image placeholder in the table. In the first row of the table, change the width and height of PartPic.jpg to 350.

dptechnology.com

10

Customizing the ESPRIT Report Generator

Replac e t he t hird row of dat a in t he head er t abl e The third row of the header table displays information about auto wire threader, submerged tank, wire diameter and start position from SolidWire Part Setup.

This information does not change often, so you will replace this row with three new rows that display data about the part type and material from KnowledgeBase Document Setup. Copy the second row in the table: <tr> <td style=width: 15% class=style1><strong>ESPRIT File Path:</ strong></td> <td colspan=3>Gen_FileName</td> </tr>

Replace the third row with the copied code (all the code between the third set of <tr> </tr> tags). Change the third row as follows: The general keywords shown here are listed in the database schema file under the heading General Data. <tr> <td style=width: 15% class=style1><strong>Machine:</strong></td> <td colspan=3>Gen_PartType</td> </tr> Copy the second row two more times and then change to these values: <tr> <td style=width: 15% class=style1><strong>Machine:</strong></td> <td colspan=3>Gen_PartType</td> </tr> <tr> <td style=width: 15% class=style1><strong>Material Class:</ strong></td> <td colspan=3>Gen_PartMaterialClass</td> </tr> <tr> <td style=width: 15% class=style1><strong>Material Condition:</ strong></td> <td colspan=3>Gen_PartMaterialCondition</td> </tr> Save the template file. Open the file Wire EDM Example.esp and generate the custom report. Open the report OpSummary.htm in a Web browser.

dptechnology.com

11

Customizing the ESPRIT Report Generator

Fix t he spacing in t he head er Now that youve added extra rows to the header table, you need to adjust the row spacing for the image to make it span 7 rows instead of 5. In the first row, change the rowspan value. The attributes rowspan and colspan can be used in HTML tables to stretch a cell across the number of rows or columns specified. <tr> <td class=style2 style=width: 15%><strong>Part Name:</strong></ td> <td colspan=3 class=style3><strong>Gen_Name</strong></td> <td style=width: 24% rowspan=7> <img src=PartPic.jpg width=350 height=350 /></td> </tr>

dptechnology.com

12

Customizing the ESPRIT Report Generator

Move t he Comm ent column in t he t abl e of op erat ions In the second table that lists the operations, you will move the operation comments from the last column to the third column in the table. In the first row, move the Comment heading to the third item in the row (Cut and Paste the line of code).

When a CL code is referenced in a template, it must be followed by the letter C or V. C outputs the caption of the parameter. V outputs the value. CL7 corresponds to the Comment parameter on a technology page.

In the third row, move the cell containing CL7V to the third item in the row.

Remove t he Wor k Coordinat e column Remove the header and variable cells for Work Coordinate. Delete the following lines of code: <td><strong>WORK COORD</strong></td> <td>OP_WorkCoordinateName</td>

Remove one column from the column span for the operation list. <tr> <td colspan=7>BEGIN_EDMOP</td> </tr> <tr> <td colspan=7>END_EDMOP<br /> INSERT_OPERATIONS</td> </tr>

dptechnology.com

13

Customizing the ESPRIT Report Generator

A pply a st yle t ag to a row A style called .style1 is defined in this HTML template. The only attribute of style1 is a background color of light gray. .style1 { background-color: #F0F0F0; }

You can apply this style to individual cells in the table or you can apply it to an entire row. In this lesson, you will set the background color for an entire row. The class attribute is typically used to point to a class in a style sheet. When a class is assigned to an element, it overrides the default formatting only for that element. Add the style1 class attribute to the header row of the operation list. <table style=width: 100% cellspacing=0> <tr class=style1> <td><strong>OP#</strong></td> <td><strong>OPERATION</strong></td> <td><strong>COMMENT</strong></td> <td><strong>OFFSET<br /> OFFSET #</strong></td> <td><strong>POWER</strong></td> <td><strong>FEEDRATE</strong></td> <td><strong>CYCLE TIME<br /> LENGTH OF CUT</strong></td> </tr>

Save the file and generate the report again to see your changes.

dptechnology.com

14

Changing t he data included in a repor t


Youve learned how to use keywords from the database schema to change the information output in the report. You can also use CL (cutter location) codes to output values and captions that correspond to individual settings in the ESPRIT program. The <br /> tag is used to insert a line break. The text that follows is placed on the next line without creating a new paragraph. <td>CL613V</td> <td>CL194V<br /> CL418V</td>

Customizing the ESPRIT Report Generator

Every setting on a technology page has a corresponding CL code. You can find the CL code by right-clicking on a setting and selecting Edit Properties. The CL code is displayed in the title of the dialog.

Lists of CL codes can also be found in the Post help (on the Help menu, click Post Help). In the Appendix are lists of CL codes for every machining technology in ESPRIT, including cutting tools.

Tool CL cod es in oper at ion r epor t s


If you want to output tool CL data in an operation report (such as OpSummary.htm), CLT is used for outputting the tool CL code. CLT does not apply to the Tool reports, which use CL codes like CL101V, etc. <td>CL613V</td> <td>CLT1101V</td> <td>CLT1498V</td> <td>CL194V<br /> CL418V</td>

The format is: CLT{N}{###}[V/C]. N identifies the tool on operations that have more than one tool (first, second, third)

dptechnology.com

15

### identifies the CL code number V or C returns the Value or Caption For example, CLT1101V is the value of ToolNumber (CL Code 101) of the first (primary) tool. CLT2103V is the ToolDiameter (CL Code 103) of the second tool. CLT3105V is the ToolLength (CL code 105) of the third tool.

Customizing the ESPRIT Report Generator

Inser t ing pic t u r es


When generating the report, ESPRIT takes pictures of the part, the simulation and of the tool. To use these pictures in the report you need to put references in the template. In the previous lesson, you adjusted the size of the main part picture called PartPic. jpg. This is the picture of the ESPRIT document using the current view of ESPRIT when the report is created. ESPRIT generates pictures after the simulation of each operation. To insert the simulation picture in the report, reference the picture called AfterSim.jpg. The simulation picture width and height are controlled in the settings section of the OpSummary template. <p>BEGIN_SETTINGS<br /> CreateSimulationPictures=1<br /> SimulationPictureWidth=350<br /> SimulationPictureHeight=350<br /> ...

The settings in the OpSummary template also control whether tool and tool holder pictures are created. <p>BEGIN_SETTINGS<br /> ... CreateToolingPictures=1<br /> CreateToolingHolderPictures=0<br />

To enable the creation of tool holder pictures, set CreateToolingHolderPictures to 1. To show tool pictures, the template should contain the following references: Tool498.jpg for the first tool of an operation Tool711.jpg for the second tool Tool707.jpg for the third tool To show holder pictures, the template should contain the following references: Holder498.jpg for the first tool Holder711.jpg for the second tool Holder707.jpg for the third tool

dptechnology.com

16

Customizing the ESPRIT Report Generator

Lesson Summary Add a disclaimer to the summery report Replace the operation type in the detailed report with the incremental depth

G enerat e a d et ailed milling repor t Open the file Milling Example.esp. Generate a Milling_Detailed-Custom report. In the detailed report for the first operation in the list, the data for Op Type is not very useful. You will replace it with information about the incremental depth.

Ad d a disclaim er to t he summar y repor t In a text editor, open the file ReportGenerator\Templates\Milling_DetailedCustom\OpSummary.htm. At the bottom of the report, add a paragraph element <p> for a document control disclaimer: </table> <p class=disclaimer>The information in this report is intended solely for the internal use of Generic Corp. employees. Access to the information contained in this report by anyone else is unauthorized and prohibited.</p> </body>

Add the disclaimer style to the report. .style1 { background-color: #F0F0F0; } The font family for the <p> element has already been defined at the beginning of the style section (fontfamily:Arial, Helvetica, sans-serif;), so you dont need to define it again. When you create any additional classes for paragraphs, you only need to define attributes that are new or different because paragraphs will first inherit the root attributes. .disclaimer { font-size: medium; color: DarkRed; font-weight: bold; } </style>

Save the template file and generate the Milling_Detailed-Custom report again to see the new disclaimer.

dptechnology.com

17

Customizing the ESPRIT Report Generator

Find t he CL cod e for Increm ent al D ept h In Milling Example.esp, double-click on the first operation in the Operation Manager to open the technology page. On the Strategy tab, rightclick on Incremental Depth and click Edit Properties. Notice that Incremental Depth = CL Code (175) Close the dialog.

Ad d d at a for increm ent al d ept h to t he d et ail ed milling repor t In a text editor, open the file ReportGenerator\Templates\Milling_DetailedCustom\OpDetailed.htm. In the second row of the table, replace Op Type with CL175C (to output the caption) as shown below. Replace OP_GuiTypeName with CL175V (to output the value). <table style=width: 100% cellspacing=0> <tr> <td colspan=2 class=style2><strong>OP OP_Key : CL613V</ strong></td> <td rowspan=12><img src=AfterSim.jpg width=350 height=350 /></td> </tr> <tr> <td style=width: 22% class=style1>CL175C</td> <td style=width: 28%><strong>CL175V</strong></td> </tr>

Save the template file and generate the detailed custom report again to see the changes.

dptechnology.com

18

Adding programming funct ionalit y with JavaScript


Java and JavaScript are not the same! They are two completely different programming languages. Java (developed by Sun Microsystems) is a powerful and much more complex programming language. JavaScript is the most popular programming language for Web pages. JavaScript is a scripting language used to create dynamic and interactive web content. It is used to complement the static HTML code. JavaScript is fairly easy to learn because the scripts are logical and the syntax is not complicated. JavaScript: Is a common set of language instructions that works in all major Web browsers Gives HTML designers a programming tool Allows the use of variables, conditional statements, and logical operators Is usually embedded directly into HTML pages Can be used without purchasing a license

Customizing the ESPRIT Report Generator

JavaSc ript sy nt a x
Special tags are needed to embed Javascript within an HTML document: <script type=text/javascript> </script> JavaScript variables are used to hold values or expressions. Variables are declared with the var keyword. Variable names must begin with a letter or the underscore character: JavaScript is casesensitive, so variable names are also casesensitive. var toolNum; (Integer) var toolName; (String)

After variables are declared, they are empty (they have no values yet). Variables can hold values and mathematical expressions: toolNum=5; toolNum=x+y-4;

When you assign a string to a variable, use quotes around the value. If you place numbers inside the quotes, they are treated as a string rather than a numerical value. toolName=Drill; Variables can be declared globally or locally. A variable declared within a JavaScript function becomes LOCAL and can only be accessed within that function. Variables declared outside a function become GLOBAL, and all scripts and functions on the Web page can access them.

dptechnology.com

19

Customizing the ESPRIT Report Generator

Lesson Summary Declare a global variable to use as a counter for operation numbers Add a function to count all operations Overwrite the operation numbers from the ESPRIT document with consecutive operation numbers in the report

G enerat e a summar y tur ning repor t Open the file Turning Example.esp. Generate the Turning_Summary-Custom report. Notice that the operation numbers are set in the order the operations were created in ESPRIT. When operations are sorted, moved, added, or deleted in the Operation Manager, the numbers are no longer consecutive and may have gaps between numbers. This is not useful for machine operators.

D eclare a global var iable You will begin by declaring a global variable that you can use as a counter for the operation numbers. You will set the initial value to 1. In a text editor, open the template file ReportGenerator\Templates\Turning_ Summary-Custom\OpSummary.htm. Add the following code: <body> <p>BEGIN_SETTINGS<br /> CreateSimulationPictures=0<br /> SimulationPictureWidth=350<br /> ... NAReplacementString=-<br /> END_SETTINGS</p> <!--Define Global Variables--> <script type=text/javascript> opNum=1; </script> dptechnology.com 20

Customizing the ESPRIT Report Generator

Ad d a scr ipt to count t he op erat ions In the second table that lists the operations, rename the first cell in the first row to ORDER. <table style=width: 100% cellspacing=0> <tr> <td class=style1><strong>ORDER</strong></td> <td style=width: 13%><strong>OPERATION</strong></td>

Rename the second cell in the first row OPERATION(OP#) to make it easy to cross-reference the operation numbers in the ESPRIT document. <table style=width: 100% cellspacing=0> <tr> <td class=style1><strong>ORDER</strong></td> <td style=width: 13%><strong>OPERATION(OP#)</strong></td> <tr> <td colspan=10>BEGIN_TURNINGOP</td> </tr> <tr> <td><script type=text/javascript> document.write(opNum); opNum=opNum+1; </script></td> <td style=width: 13% class=style1>CL613V</td>

The function called document.write outputs a number or string into the HTML document. It must be written in all lower case. DP Technology Corp. 1150 Avenida Acaso Camarillo, CA 93012 USA North America +1 800 627 8479 esprit@dptechnology.com International +1 805 388 6000 esprit@dptechnology.com About DP Technology DP Technology is a leading developer and supplier of computer-aided manufacturing (CAM) software for a full range of machine tool applications. ESPRIT, DP Technologys flagship product, is a powerful, high-performance, fullspectrum programming system for milling, turning, wire EDM, and multitasking machine tools. ESPRIT embodies DP Technologys passion for excellence and its vision of technologys potential. Copyright DP Technology All rights reserved. ESPRIT is a registered trademark of DP Technology Corp.

Add logic in the first cell after BEGIN_TURNINGOP for the operation counter.

Add the Op_Number from the ESPRIT document to the second cell in the row. Repeat the same steps below BEGIN_MILLINGOP. <td style=width: 13% class=style1>CL613V(OP Op_Number)</td>

Save the template file and generate the summary turning report again to see the reordered operation numbers.

Customizing your machining reports just takes some creativity and a little HTML know-how.

dptechnology.com

21

Anda mungkin juga menyukai