CAD Exchanger SDK
Examples

Introduction

CAD Exchanger SDK includes a set of C++ and C# examples demonstrating its functionality. The examples are located in the ${install_dir}/examples subdirectory.

The examples are provided under a permissive Modified BSD License. You may insert their source code into your application and modify as needed.

Before launching examples make sure you provide a license key and set your development environment. The chapters for each supported programming language (C++, C#) provide respective instructions.

List of Examples

Links in the below table lead to C++ versions of respective example. For other language just navigate into corresponding subfolder in the SDK package.

Select any example that most closely matches your target use case and introduce modifications specific to your case.

Example Purpose
General Example Demonstrates how to simply convert CAD files with the help of CAD Exchanger SDK
Model Explorer Demonstrates how to explore imported model contents
Assembly Creation Demonstrates how to create an assembly of sub-assemblies and parts of solid primitives and to export to target format
Meshing Example Demonstrates how to create polygonal representations using computational meshers
Progress Status Example Demonstrates how to integrate support of progress status update

C++ Examples

Note
Substitute the ${install_dir}/examples/cadex_license.cxx file with the one that you received for your evaluation process. When you become a customer you will substitute it with a commercial license key.

Building with Microsoft Visual Studio

Note
Currently project files shipped with SDK are created for Visual Studio 2013. To downgrade to an earlier Visual Studio version (2010 or 2012), open the project file and replace the platform toolset and the linker settings in the project properties dialog box, as explained below. If you work with newer versions (2015 or above) Visual Studio will automatically upgrade during first opening.
  • Open a respective project file (*.vcxproj).
  • Add paths to the include and library directories (${install_dir}/inc, ${install_dir}/${platform}/${compiler}/lib).

The following screenshots demonstrate how to set environment in Visual Studio:

msvs_dirs.png
Setting include and .lib directories in Visual Studio
msvs_dirs_path.png
Setting .dll directory in Visual Studio

The following screenshots demonstrate how to downgrade to Visual Studio 2010:

examples_prop_toolset.png
Setting Platform Toolset to VS2010
examples_prop_lib.png
Setting Linker settings to VS2010
Note
Pay attention that you need to set respective directories depending on your particular configuration, including target architecture (x86 or x64), compiler (e.g. vc12 or vc14), and mode (release or debug). Refer to Setting up development environment for detailed descriptions of subfolders.

Instead of setting environment for every project in Visual Studio, you can set the environment variables INCLUDE, LIB and PATH in a .bat file. This file would set these variables and launch Visual Studio. In this case any project would inherit these settings.

Building with GNU Makefiles

On Linux or MacOS, to build an example with the help of GNU make, change the current directory to the example directory and type:

  • make or make release to build release mode;
  • make debug to build debug mode.

C# Examples

Provided C# examples demonstrate how to integrate C++ based CAD Exchanger SDK into C# applications.

C# examples are alocated in the subfolder ./examples/csharp of the SDK package.

Note
Insert contents of the license key your received for your evaluation process into your example code (see line:
//insert here the activation key!
string theKey = "";

Building with Microsoft Visual Studio

  • Open a respective project file (*.csproj).
    Note
    Most likely you will notice warnings by Visual Studio that some references could not be resolved (see image below). This is due to Visual Studio limitations to enforce absolute file names (and paths) to be used in the project - assembly references cannot be resolved in user's environment. Please proceed as detailed below
    msvs_cs_asm.png
    Warnings in Visual Studio about unresolved assembly references
  • Manually add respective assembly references with the same name (e.g. CadExCoreNet, CadExParaNet, etc) by browsing the subdirectory corresponding to your target configuration.
msvs_cs_asm_addref.png
msvs_cs_asm_addref_browse.png
Adding assembly references in Visual Studio respecting target environment
  • Build and run the example.