InterOp:Connect/Using Samples
From DocR23
Contents |
InterOp Samples from CATIA V5, TRANS, and DIRECT Packages
InterOp Connect samples are located in the installation subdirectories /samples/connect, /samples/connectacis, /samples/connectfile, and /samples/connectgeneric.
The directories include:
| Functionality | Sample Name | Description/Comments |
|---|---|---|
| Basic Translation | Simple | Execute a simple translation from input file to output file. |
| Log File Setup | LogFile | Generate a log file providing information about the execution of a translation. |
| Document Header Information | DocumentInfo | Extract header information from an input file. |
| MultiModel Header Information | MultiModelDocumentInfo | Extract header information from an input file containing multiple models. |
| BRep Information | BRepInfo | Extract BRep information from an input file. |
| Assembly Information | AssemblyInfo | Extract assembly information from an input file. |
| Options Setup | Options | Set options for a translation. |
| Representation Selection | Representation | Select a document representation for a translation. |
| Unit Setup | Unit | Set an output file unit for a translation. |
| Assembly Translation | AssemblyXML | Translate an assembly input file to XML E-BOM. |
| International Path Handling - Multibyte | Simple_Mbcs | How to handle paths with multibyte characters. |
| Import ACIS Entities1 | AcisImport | Import a file to ACIS entities. |
| Export ACIS Entities1 | AcisExport | Export ACIS entities to a file. |
| Import ACIS Assemblies1 | AcisAsmImport | Import an assembly file into ACIS assembly models in memory. |
| Export ACIS Assemblies1 | AcisAsmExport | Export ACIS assembly models present in memory to other assembly formats. |
| Import Manufacturing information to ACIS Entities1 | AcisMiImport | Import Manufacturing information from a source part file to ACIS entities. |
| Import Hole Feature information to ACIS Entities1 | AcisHoleImport | Import Hole Feature information from a source part file to ACIS entities. |
| Import Assembly Manufacturing (PMI) Information to ACIS Models1 | AcisAsmMiImport | Import Assembly Manufacturing (PMI) information from a source assembly file to ACIS models. |
| Import Parasolid Entities2 | ParasolidImport | Import a file to Parasolid entities. |
| Export Parasolid Entities2 | ParasolidExport | Export Parasolid entities to a file. |
| Import Generic Entities3 | GenericImport | Import a file to Generic entities. |
| Export Generic Entities3 | GenericExport | Export Generic entities to a file. |
| Import Manufacturing Information to Generic Entities2-3 | GenericMfgImport | Import Manufacturing information from a source part file to Generic entities. |
1 ACIS-based applications
2 Parasolid-based applications
3 Generic-based applications
Note: In order to rebuild the Spatial samples, you must add your license to the sample source code. The sample source file unlock_license.cpp contains a function unlock_license() which is called by every sample at start-up. Modify this file to call your application license function.
Building the InterOp Connect Samples from CATIA V5, TRANS, and DIRECT Packages
To build a sample, refer to the procedure for your platform:
Visual Studio
- Open a command prompt window and set up the environment
- Set X3DT to your InterOp installation folder, for example: set X3DT=c:\Progra~1\Spatial\iop
- If you are have an ACIS installation, set A3DT to your ACIS installation folder, for example: set A3DT=c:\Progra~1\Spatial\acis
- Set all other variables (for example, P_SCHEMA or CATDefaultEnvironment) where required
- Update the PATH variable with locations to all the required DLLs
- Change directories to the samples directory: cd %X3DT%\samples\connect
- Build the sample project (repeat these steps for each project).
- From the samples directory, enter: devenv AssemblyInfo.sln
- Select Build->Configuration Manager.
- For Release Win32, enter AssemblyInfo.
- For Debug Win32, enter AssemblyInfo.
- Select Build->Build AssemblyInfo.
UNIX (using make) and Macintosh
- From the shell, set up the environment
- Set X3DT to your InterOp installation folder.
- If you have an ACIS installation, set A3DT to your ACIS installation folder.
- Set ARCH to the architecture you want to build, for example: export ARCH=aix4_so
- Change directories to the samples directory: cd$X3DT/samples/connect
- Build the samples (default target builds all samples, for example, make -f makefile.aix4): make -f makefile.*
Note: The ACIS dynamic libraries are linked with the option -Wl,-install_name,@executable_path/libXXX.dylib. For bundled applications, ACIS libraries must be in the executable directory at runtime (for example, YourApp.app/Contents/MacOS). You can avoid this requirement when running from the command line by setting the environmental variable DYLD_LIBRARY_PATH to the library location.
Working with Localized File Paths
InterOp is able to work with localized file paths encoded as either multibyte character set (MBCS) or as wide characters.
- Multibyte
- To work with localized file paths in InterOp, you will need to set the system's locale to match the locale of the text for the file path. Generally this means setting the locale to the system's default codepage. If the APIs your application is built upon do not do this for you automatically, refer to the InterOp sample International Path Handling - Multibyte for an example of how to accomplish this.
- When working with MBCS encoded file paths, use the Connect interfaces that use char* arguments. For example, you would use the SPAIFile(const char* ipszFilePath) constructor to initialize a SPAIFile object.
- Wide character
- Working with wide character encoded file paths requires that you use the Connect interfaces that use wchar_t* arguments. In this case, you would use the SPAIFile(const wchar_t* ipszFilePath) constructor to initialize a SPAIFile object.
- Refer to the InterOp sample Basic Translation for an example of how you can process localized file paths using the Connect API.
Windows
On Windows systems, the C-Runtime APIs interpret char* text as either ASCII or MBCS depending upon whether the preprocessor symbol _MBCS is defined. Therefore, to use the char* form of the Windows APIs and have them work properly with localized text, you must ensure that _MBCS is defined for your application (and that _UNICODE is undefined if you are using the Generic-Text Mappings.) If you chose to use MBCS encodings for localized text on Windows systems, you are limited to processing text in a single language.
On Windows systems, the C-Runtime APIs interpret wchar_t* as UTF-16, which is one of several Unicode encodings. Note that this interpretation of the wchar_t type is unique to Windows and is not applicable to other platforms. Because Windows systems define its wide character encoding to be UTF-16, using the wchar_t interfaces allows you to process text involving more than one language.
UNIX and Macintosh
On UNIX based systems, the C-Runtime APIs interpret char* text as being encoded as MBCS and wchar_t* text as being encoded as wide characters. In both cases, the text encoding is relative to the currently defined locale. Note that, in general, on UNIX based systems the wchar_t type is not Unicode. It is only interpreted as Unicode when the current locale is Unicode. For example, if you are running on the AIX platform under the en_US.ISO8859-1 locale, then the wchar_t type would not represent Unicode, but rather the wide character encoding of the ISO8859-1 codepage. If, however, you are running under a UTF-8 locale such as en_US.UTF-8, then the wchar_t type would be Unicode - in this case UTF-32 (because wchar_ts on AIX are four bytes wide). Therefore, unless your locale is set to Unicode, you are limited to processing text in a single language.
The InterOp sample International Path Handling - Multibyte shows you how you how to use InterOp using MBCS text and the sample Basic Translation shows you how to use InterOp using wide character text.
Known Limitations
- CATIA V5 is not able to process file paths comprising of wide characters.
- AIX is not able to process Unicode text that falls outside the Basic Multilingual Plane (BMP).