ASCII Import and Export : Developer
In This Topic
ASCII Import/Export is a feature that allows you to save a drawing or library to a human-readable text file, as opposed the normal QID or QIL format. The word "ASCII" essentially says that the file is plain text instead of "binary" (computer language). The Import/Export feature has several uses, but isn't commonly needed by typical CabMasterPro designers. They include:
- Easy integration with external applications, for example accounting software or graphical selection applets. Because ASCII text is such a universal format, applications could be modified to output relevant information that can then be imported into CabMasterPro. This feature is already used to integrate CabMasterPro with several third-party programs.
- Letting you open drawings saved in any version of CabMasterPro with any other version. Normally, you can only open older drawings in newer versions, but Import/Export allows you to open new drawings in old versions because it is independent of the drawing file format.
- Allow mass search-and-replace style editing of libraries and drawings. This is most beneficial to library developers, who can replace all instances of a string by exporting it to text, doing the replacement in an editor, and then re-importing. They can also make any changes in many places at once, e.g. by using a macro.
Two utilities for working with ASCII exports are provided with CabMasterPro - the Tab Explorer and Export Editor. Both are designed specifically for CabMasterPro exports, and can be used to browse and search an exported library, or make multiple changes using filters.
This is only available to Developer software users.
The two exporting options available from the File menu are Export to ASCII (Minimal). and Export to ASCII (Full)
The difference between the two is that a minimal export does not save the properties that are the same as the in-built default values. For example, if the offset of a section is zero, this line will not be exported because zero is the default. A full export will output every property in a drawing, regardless of its value. In practice, the main differences are:
- If transferring drawings via Import/Export to different versions of the program, you should use Full Export. This is because the defaults themselves may have changed, and only a full export will explicitly specify each value.
- If transferring between programs of the same version, use Minimal Export. The only reason for this is that the exported files are smaller (because they don't contain defaults) and will therefore import quicker. For example a full export of the SLC Sample library takes around 90Mb while a minimal export is only about 10Mb.
The Import from ASCII and Merge from ASCII options are very similar: both load values from a text file and add them to the current drawing. If a property already exists, it is overwritten with the new value. The main difference is that Import clears the current properties first, so is effectively the same as starting a new drawing (or library) and then using Merge. Merge is the most common option, as it allows you to add a handful of property values to an existing drawing.
OLE objects cannot be imported into a drawing or library. You will receive a warning when you try to export an OLE object, and you should delete the object then retry the export.
Format of an Export File
This section is provided for those that wish to manually edit export files. Exports can be opened in any text editor, but the easiest and recommended way to edit export files is by using the CabMasterPro Tab Explorer and Tab Explorer and Export Editor utilities. Refer to the documentation included with these utilities, and remember to check the CabMasterPro website for updated versions.
The format of an export file is simple:
- Each line in the file is a single property of the drawing or library
- A line is divided up into four tab-separated fields
- The first field is the property name, e.g. "label" or "cabinet_cost". Some names are set by CabMasterPro, others are user-defined (such as those in the "All Answers" lists)
- The second field is the current value of that property. It is usually enclosed in a set of quote marks, and text string values must have triple quotes at each end, like in Lookup Tables
- The third field is the formula behind the property, if any. It does not usually have to have quote marks as it is an expression instead of a literal value
- The final field is a context string, that tells a property where is belongs in a drawing (e.g., on the Page Properties, on a certain face in a cabinet, etc)
- Therefore the general format for an export line is:
name <tab> value <tab> formula <tab> context
- If the value or formula is omitted, they are assumed to be blank. The default context is an answer in the Drawing Properties. If the whole line is blank, it is ignored
An example export line looks like this:
code "F450" "F"&width Cabinet|12
ASCII File format
The term "ASCII file" refers to a "text" file that is readable by the naked eye (it only contains the letters a-z, numbers, carriage returns, and punctuation marks). Therefore, any file that one can read with a common editor, like simple Windows Notepad program, is considered an ASCII file.
XML File format
Some benefits of using XML format files are that they:
- are self-describing, making them easy to read, create, and extend. They are human readable, making it easy to understand how data is interpreted during bulk operations.
- contain the data types of target columns. The XML encoding clearly describes the data types and data elements of the data file and also the mapping between data elements and table columns.
- allow for loading of a field that contains a single large object (LOB) data type from a data file.
- can be enhanced yet remain compatible with its earlier versions. Furthermore, the clarity of XML encoding facilitates the creation of multiple format files for a given data file. This is useful if you have to map all or some of the data fields to columns in different tables or views.
- can be used to bulk import data into tables or non-partitioned views and to bulk export data.