C# Wrapper Update Coming Soon!

We are pleased to announce a major update for the C# wrapper, which includes exciting new features and enhancements.

Linux Platform Support

The new version of the C# wrapper will be available for Linux OS, expanding its usability across more platforms.

Extension of C# Language Support

The list of .NET versions supported by the C# wrapper has been extended to provide greater flexibility for developers.

Windows C# Support:

  • .NET Framework v3.5
  • .NET Framework v4.0
  • .NET Framework v4.5
  • .NET Framework v4.5.1
  • .NET Framework v4.5.2
  • .NET Framework v4.6
  • .NET Framework v4.6.1
  • .NET Framework v4.6.2
  • .NET Framework v4.7
  • .NET Framework v4.7.1
  • .NET Framework v4.7.2
  • .NET 6.0
  • .NET 7.0
  • .NET 8.0

Linux C# Support:

  • .NET 6.0
  • .NET 7.0
  • .NET 8.0

What OCC C# Wrapper Is

The OCC C# Wrapper is a tool for wrapping Open CASCADE Technology (OCCT) C++ classes to C#, allowing their use within .NET applications. The C# interface reuses C++ DLLs and can call C++ methods through C# calls. The wrapping process generates a list of C# files that together form a single C# project interface. This results in a single DLL with modules that correspond to the wrapped OCCT classes.

C# Wrapper Demo

We are offering a one-month demo version of the C# wrapper. This demo is a full version of the C# wrapper generation result but with a limited usage period. It is a great opportunity to try the product before purchasing it. The demo package contains the following files:

  • C# DLL to use in your project
  • An executable file to test integration with the C# DLL in a WinForm application
  • A unit test executable to validate and check that the wrapper is working

C# Wrapper Full Version

The full version of the C# wrapper is a complete package containing all the necessary scripts and files to generate C# files from a C++ OCCT project and build them into a single DLL. After purchasing the full version, you will have the freedom to update the generator based on your needs. The delivery includes the full source package, and you are free to use it in any application you are developing.

C# Wrapper Code Sample

// Reading CAD FILES Sample:
using OCC.TCollection;
using OCC.DE;
using OCC.TDocStd;
using OCC.XCAFApp;
using OCC.STEPCAFControl;

// Load a container for each DE component
var aWrapper = DE_Wrapper.GlobalWrapper().Copy();
// Manually updating parameters for reading CAD files
TCollection_AsciiString thePath = new TCollection_AsciiString("");
DE_Provider? aProvider = null;
if (!aWrapper.FindProvider(thePath, true, aProvider).)
{
  // Do something
}
// Modify string with parameters, described in the documentation:
DE_ConfigurationNode aConfig = aProvider.GetNode();
TCollection_AsciiString aParameters = aConfig.Save();
// https://dev.opencascade.org/doc/overview/html/occt_user_guides__de_wrapper.html
aConfig.Load(aParameters);

// Reading CAD file
TDocStd_Document? aDoc = null;
XCAFApp_Application anApp = XCAFApp_Application.GetApplication();
anApp.NewDocument(new TCollection_ExtendedString("BinXCAF"), aDoc);
if (!aProvider.Read(thePath, aDoc))
{
    // Do something
}

// Sample to Read using original reader functionality
var aReader = new STEPCAFControl_Reader();
aReader.SetColorMode(true);
if (!aReader.Perform(thePath, aDoc))
{
  // Do something
}

C# Wrapper Overview in Visual Studio

The final result of the wrapping process is a single DLL that can be easily integrated into any C# project. Below is a simple example of how the wrapped DLL appears in the "VS Object Browser":

OCCT 7.7.0

This update significantly enhances the capabilities and flexibility of the C# wrapper, making it a powerful tool for developers working with OCCT in .NET applications. We look forward to your feedback and hope you enjoy the new features!

The new version coming soon. Follow our marketplace for updates: Wrappers - Open Cascade.

Best regards,

The OCCT3D Team.