InterOp:Connect/Document Information

From DocR22

Jump to: navigation, search

InterOp Connect can retrieve information about source documents before they are translated and destination documents after they are produced. Information can be retrieved about the file properties, the BRep content of the file, and the assembly content of the file.

The Connect classes reviewed in this section are:

Contents

Header Information

The SPAIDocumentHeaderInfo object retrieves file properties. The following table lists the properties that are accessible by the API:

Property Description
File name Specifies the name of the file. In a CATIA V5 CATProduct document, this property corresponds to the Part number which is the name of the root of the feature tree in the CATProduct.
Modification date Specifies the date when file was last modified
Author Specifies the name of the author of the file
Organization Specifies the name of the organization where InterOp Connect is installed
Source system Specifies the name of the system or modeler that generated this file
Version Specifies the version number of the source file
Units Specifies the model units
Tolerance Specifies the Point Tolerance for the model. The Point tolerance is the minimum 3D distance between two points to make the two points separate.
Comment Contains general information provided by the person who created the file
Document Type Specifies the input file type, such as part, assembly, or part+assembly

Document Type

Supported input file types are as follows:

Input File Type Description
Part The document contains part data (either boundary representation or visualization data). The applicable representation type can be either "BRep" (in combination with "PMI") or "Visualization" or "Mesh".
Assembly The document contains assembly that contains one or more parts, one or more parts and subassemblies, or one or more subassemblies. Moreover, with type assembly, parts or subassemblies have an assembly as a valid parent. The applicable representation type is "Assembly" (in combination with "PMI").
Part+Assembly The document contains both assembly as well as free part data. The applicable representation type is "BRep+Assembly" (in combination with "PMI").
Unknown The document type cannot be determined at the time of loading the header. In this case, we advise that you set the representation type as "BRep+Assembly".

Note: The file format for which the header information is requested determines which properties are provided. For example, if the header is requested for a Pro/E file, then all the properties except for Tolerance and Comment are returned by the API.


Showproduct.png



The following table lists the various properties and supported formats:

File Name Modification Date Author Organization Source System Version Unit Tolerance Comment Document Type
ACIS X X X X X X X
CATIA V4 X X X X
CATIA V5 X X X X X X X
IGES X X X X X X
Inventor X X X X X X X X X
Parasolid X X X X X
Pro/E X X X X X X X X
SolidWorks X X X X X X X X
STEP X X X X X X X
UG X X X X X X X
VDA X X X X X X X X

The following example illustrates how to implement a translator executable that displays the source document's author before performing the translation:

#include "SPAIConverter.h"
#include "SPAIDocument.h"
#include "SPAIDocumentHeaderInfo.h"
#include "SPAIResult.h"
#include "SPAIValue.h"
 
void main()
{
  SPAIDocument src("C:\\model.CATPart");
  SPAIDocumentHeaderInfo info;
  SPAIResult result = src.GetHeaderInfo(info);
  SPAIValue author;
  result &= info.GetAuthor(author);
  cout << "Author :" << (const char*)author << endl;
  SPAIDocument dst("C:\\model.sat");
  SPAIConverter converter;
  result &= converter.Convert(src, dst);
  return;
}

The SPAIDocumentHeaderInfo methods return the value for the desired property in a SPAIValue object which can store either a character string, a Boolean value, an integer value, or a double value.

The following sample illustrates what can be retrieved:

File Name     : Part1
Source System : CATIA V5
Version       : Document pre V5R8
Units         : MILLIMETER
Tolerance     : 0.0010000000


DocumentInfo Sample

This sample demonstrates how to display the header information for the input file and then translate the file to a specified output format.

Usage

'''DocumentInfo -i file -iformat format -o file -oformat format'''

Options

-i : input file
-o : output file
-iinfo : display input file information

MultiModelDocumentInfo Sample

This sample demonstrates usage of the SPAIDocumentHeaderInfo interface with a file containing multiple models, such as a CATIA V4 .exp file.

Usage

MultiModelDocumentInfo -i file -iformat format -o file -oformat format

Options

-i : input file
-o : output file
-iinfo : display input file information

BRep Information

The SPAIDocumentBRepInfo object retrieves information about the BRep content of a document. The following table lists the information that is accessible by the API:

BRep Information Type Description
Bodies Number of bodies
Mixed Bodies Number of mixed bodies
Solid Bodies Number of solid bodies
Sheet Bodies Number of sheet bodies
Wire Bodies Number of wire bodies
Vertex Bodies Number of vertex bodies
Solid Bodies Lumps Number of lumps in solid bodies
Solid Bodies Shells Number of shells in solid bodies
Solid Bodies Faces Number of faces in solid bodies
Solid Bodies Loops Number of loops in solid bodies
Solid Bodies Coedges Number of coedges in solid bodies
Solid Bodies Edges Number of edges in solid bodies
Solid Bodies Vertices Number of vertices in solid bodies
Sheet Bodies Shells Number of shells in sheet bodies
Sheet Bodies Faces Number of faces in sheet bodies
Sheet Bodies Loops Number of loops in sheet bodies
Sheet Bodies Coedges Number of coedges in sheet bodies
Sheet Bodies Edges Number of edges in sheet bodies
Sheet Bodies Vertices Number of vertices in sheet bodies
Wire Bodies Edges Number of edges in wire bodies
Wire Bodies Vertices Number of vertices in wire bodies
Acorn Bodies Vertices Number of vertices in acorn bodies
Local Coordinate Systems Number of local coordinate systems

The following example illustrates how to implement a translator executable that displays the number of bodies and the number of faces in the source document before performing the translation:

#include "SPAIConverter.h"
#include "SPAIDocument.h"
#include "SPAIDocumentBRepInfo.h"
#include "SPAIResult.h"
#include "SPAIValue.h"
 
void main()
{
  SPAIDocument src("C:\\model.CATPart");
 
  SPAIDocumentBRepInfo info(src);
 
  SPAIValue bodyCount;
  result &= info.GetBodyCount(bodyCount);
  cout << "Bodies :" << bodyCount << endl;
 
  SPAIValue faceCount;
  result &= info.GetSolidBodiesFaceCount(faceCount);
  cout << "Faces :" << faceCount;<< endl;
  SPAIDocument dst("C:\\model.sat");
 
  SPAIConverter converter;
  result &= converter.Convert(src, dst);
 
  return;
}

The following sample illustrates what can be retrieved:

Bodies                           : 1
Mixed Bodies                     : 0
Solid Bodies                     : 1
        Solid Bodies Lumps       : 1
        Solid Bodies Shells      : 1
        Solid Bodies Faces       : 6
        Solid Bodies Loops       : 6
        Solid Bodies Coedges     : 24
        Solid Bodies Edges       : 12
        Solid Bodies Vertices    : 8
Sheet Bodies                     : 0
Wire Bodies                      : 0
Acorn Bodies                     : 0
Free Surfaces                    : 0
Free Curves                      : 0
Free Points                      : 0
Local Coordinate Systems         : 0

Note: If any of Mixed, Solid, Sheet, Wire and Acorn bodies count is zero, the lower level details of those bodies will not be printed. In the above example, lower level details of Solid bodies only are printed.


BRepInfo Sample

This sample demonstrates how to display information about the BRep entities in the input file.

Usage

BRepInfo -i file -o file

Options

-i : input file
-o : output file
-ibrepinfo : display input file BRep information

Assembly Information

The SPAIDocumentAssemblyInfo object can generate an XML E-BOM file based on E-BOM XML schema that describes the product structure of an assembly document. This file contains a tree structure with root as the top level assembly from input file. The sub-assembly and parts instances referred by the assembly form the nodes of the tree structure.

The following code sample illustrates the assembly structure in an XML file:

- <Root Name="as1" Identifier="as1">
   - <Child Name="1-bracket assy" Identifier="as1-id-203-1">
     + <Position></Position>
       <RefLink Id="1-bracket assy"/>
     - <Child Name="nut-bold assy" Identifier="as1-id-203-2">
       + <Position></Position>
         <RefLink Id="nut-bolt assy"/>
       + <Child Name="nut" Identifier="as1-id-203-3"></Child>
       + <Child Name="bolt" Identifier="as1-id-203-4"></Child>
       </Child>
     + <Child Name="nut-bolt assy" Identifier="as1-id-203-5"></Child>
     + <Child Name="nut-bolt assy" Identifier="as1-id-203-8"></Child>
     + <Child Name="1-bracket" Identifier="as1-id-203-11"></Child>
     </Child>
   + <Child Name="1-bracket assy" Identifier="as1-id-203-12"></Child>
   + <Child Name="rod assy" Identifier="as1-id-203-23"></Child>
   + <Child Name="plate" Identifier="as1-id-203-27"></Child>

Top level assembly "as1" has four children (marked in red). The first sub-assembly, "l-bracket assy", has four children (marked in green). The sub-assembly, "nut-bolt assy", refers to two parts: nut and bolt (marked in blue). The XML file also stores the transformations associated with assembly instance or part instance (node "Position"). You can parse an XML file to re-create the assembly tree.

The following example illustrates how to implement a translator executable that generates an XML E-BOM file describing the product structure of the source document before performing the translation:

#include "SPAIConverter.h"
#include "SPAIDocument.h"
#include "SPAIDocumentAssemblyInfo.h"
#include "SPAIResult.h"
 
void main()
{
  SPAIDocument src("C:\\model.CATProduct");
  const char *assemblyInfoFile = "c:\\model_asm_info.xml"';
  SPAIDocumentAssemblyInfo srcInfo(src);
  SPAIFile inputAssemblyInfoFile(assemblyInfoFile);
  srcInfo.SaveAs(inputAssemblyInfoFile);
 
  return;
}

AssemblyInfo Sample

This sample demonstrates how to translate supported Assembly file to XML-EBOM.

Usage

AssemblyInfo -i file -o file

Options

-i : input file
-o : output file
-iformat  : input format (optional)
-iassemblyinfo  : input file Assembly information
Personal tools