InterOp:Connect/Integrating with Your Application

From DocR21

Jump to: navigation, search

This section describes the steps you need to plug 3D InterOp into your application.

Note: Although the development environment assumed here is Microsoft Visual C++, you may use your own Integrated Development Environment (IDE). The procedure you follow is similar to what is provided in this section.


Contents

Step 1. Setting Up the Environment

Set up the environment variables as indicated below. Setting the variables at the user level avoids overwriting the system variables.

Environment Variables

The list of environment variables and the values to be set (for sample code and recommended for your application development) are as follows:

Environment Variable Value
X3DT <Path to the InterOp installation>
A3DT 1 <Path to the ACIS Installation>
PATH %X3DT%\lib\%ARCH%; %A3DT%\lib\%ARCH% (This needs to be appended to the existing path.)
ARCH The Compiler Flags and Preprocessor Directives table contains the InterOp ARCH value that corresponds to each set of InterOp libraries.

1 ACIS Connect only

The ARCH environment variable is specific to various InterOp components. The following table lists various components and supported ARCH environment variables for Windows based platforms:

NT_AMD_64_DLL NT_AMD_64_DLLD NT_VC8_DLL NT_VC8_DLLD NT_VC9_DLL NT_VC9_DLLD NT_VC9_64_DLL NT_VC9_64_DLLD
ACIS X X X X X X X X
CATIA V4 X X X X X X X X
CATIA V5 R X X X X X X X X
CATIA V5 W X X X X X X X X
IGES X X X X X X X X
Inventor X X X X X X X X
Parasolid X X X X X X X X
Pro/E X X X X X X X X
SW X X X X X X X X
STEP X X X X X X X X
UG X X X X X X X X
VDA X X X X X X X X

The following table lists various components and supported ARCH environment variables for UNIX-based platforms:

aix4_so aix4_so_debug linux_so linux_so_debug maci386 maci386_debug
ACIS
CATIA V4 X X X X X X
CATIA V5 R X X
CATIA V5 W X X
IGES X X X X X X
Inventor
Parasolid X X X X X X
Pro/E X X X X X X
SW
STEP X X X X X X
UG X X X X
VDA X X X X X X


Step 2. Setting Up the IDE

Note: The following procedure is specific to Microsoft Visual C++ IDE.

Projects and makefiles for building the InterOp sample applications, installed in $(X3DT)\samples, illustrate the following instructions. Using Connect explains how to build these samples.

Step a. Create a console application in the IDE

Step b. Set the Include directories

Set the additional include directories path to $(X3DT)\include and to $(A3DT)\include for ACIS-based applications. To do this, follow these steps:

  1. Click Project-> Settings to open the Project Settings dialog box.
  2. Click theC/C++ tab on the Project Settings dialog box and select Preprocessor option from the Category drop down list.
  3. Specify the name of the above stated directories in the Additional include directories text field.
  4. Click the OK button to close the Project Settings dialog box.

Step c. Configure the C++ Setting

InterOp uses multithreaded runtime libraries. To enable InterOp to use multithreaded runtime libraries, you need to configure the following settings. To do this, follow these steps:

  1. Click Project -> Settings to open the Project Settings dialog box.
  2. Click the C/C++ tab on the Project Settings dialog box and select Code Generation option from the Category drop down list.
  3. Select "Multithreaded DLL" for release build (Win32 Release) or "Debug Multithreaded DLL" for debug build (Win32 Debug) from the Use runtime library drop-down list.
  4. Click the OK button to close the Project Settings dialog box.

You also need to add the preprocessor definitions in the Compiler Flags and Preprocessor Directives table specific to the InterOp ARCH you are building. To do this, follow these steps:

  1. Click Project -> Settings to open the Project Settings dialog box.
  2. Click the C/C++ tab on the Project Settings dialog box and select Preprocessor option from the Category drop down list.
  3. Add "NT_VC8_DLL", for example, in the Preprocessor definitions text field.
  4. Click the OK button to close the Project Settings dialog box.

Step d. Add the Object/Library Modules

For release build (Win32 Release), add SPAXBase.lib and SPAXInterop.lib to the Object/Library modules text field. For debug build (Win32 Debug), add SPAXBased.lib and SPAXInteropd.lib to the Object/Library modules text field. To do this, follow these steps:

  1. Click Project -> Settings to open the Project Settings dialog box.
  2. Click the Link tab on the Project Settings dialog box and select General option from the Category drop down list.
  3. Specify the name of the required library file in the Object/Library modules text field.
  4. Click the OK button to close the Project Settings dialog box.

Step e. Set an Additional Library Path

Set the additional library path to %X3DT%/lib/%ARCH% and to %A3DT%/lib/%ARCH% for ACIS-based applications. To do this, follow these steps:

  1. Click Project -> Settings to open the Project Settings dialog box.
  2. Click the Link tab on the Project Settings dialog box and select Input option from the Category drop down list.
  3. Specify the above stated path in the Additional library path text field.
  4. Click the OK button to close the Project Settings dialog box.

Step 3. Writing Code

The minimal set of instructions to create an application performing a translation is as follows:

  1. Create the source document: Invoke SPAIDocument object constructor.
  2. Create the target document: Invoke SPAIDocument object constructor.
  3. Create the converter object: Invoke SPAIConverter object constructor.
  4. Translation: Translate the source document to the destination document by invoking the Convert method of the SPAIConverter class. A customized translation is possible by setting options through other APIs. Refer to InterOp Connect Options.

Note: For better understanding of the working syntax, refer to Sample Code.


Sample Code

"SPAIConverter.h"
#include "SPAIDocument.h"
#include "SPAIResult.h"
main()
{ SPAIDocument src("C:\model.igs");
SPAIDocument dst("C:\model.CATPart");
SPAIConverter converter;
SPAIResult result=converter.Convert(src, dst);
return result;
}

Step 4. Building the Application

Build the application using the IDE.

Step 5. Running the Application

Run the application. Ensure that you provide the command line arguments needed by the application.

Personal tools
Live