.NET

BricsCAD (Windows) Pro or higher


 

The BricsCAD .NET API exposes BricsCAD functionality for use by managed code built on the .NET Common Language Runtime (CLR) platform.

 

Runtime

With BricsCAD V21, the supported .NET framework version is 4.5.1 (CLR version 4).

The .NET 4.5.1 framework is highly compatible with .NET Framework 4. Existing modules compiled for older BricsCAD versions should work in V21 unless version-dependent P/invoke signatures were used to access unmanaged API functions.

Compiler version

For new development on V21, developers must use Visual Studio 2017 or later. Managed modules compiled with .NET 4 for older BricsCAD versions will continue to run on V21 but Visual Studio 2010 and older versions of VS will not recognize the current BrxMgd TD_Mgd modules because they are based on .NET 4.5.1.

For .NET based development it is sufficient to use the free Visual Studio Community Edition.

.NET project setup in Visual Studio

Create a class library using the class library wizard under your preferred .NET language. Reference the two required DLLs (BrxMgd.dll and TD_Mgd.dll). Reference the optional BREP API (TD_MgdBrep.dll) and/or 2d constraints API (TD_MgdDbConstraints.dll) if needed. These DLLs are located in your BricsCAD installation folder.

Important note: when referencing these DLLs, it's important to set the 'Copy Local' property to False.

Note: importing the BricsCAD and Teigha COM type libraries requires TlbImp without the /strictref option!

Sample projects can be found in the BricsCAD install folder, subfolder \API\dotNet.

Bricscad.Internal

Since V18, the Bricscad.Internal namespace has been added, with plans to add undocumented functions upon request.

Changes in V21

BRX20.DLL has been updated as BRX21.DLL, P/Invoke signatures depending on this file will need to be updated accordingly.

Code compatibility

It's generally possible to use the same source code to build assemblies targeting both BricsCAD and AutoCAD. A common technique for resolving differences in namespaces is to use short namespace aliases that are different depending on the target application:

C#
VB.NET

#if BRX_APP
  using _AcAp = Bricscad.ApplicationServices;
  using _AcBr = Teigha.BoundaryRepresentation;
  using _AcCm = Teigha.Colors;
  using _AcDb = Teigha.DatabaseServices;
  using _AcEd = Bricscad.EditorInput;
  using _AcGe = Teigha.Geometry;
  using _AcGi = Teigha.GraphicsInterface;
  using _AcGs = Teigha.GraphicsSystem;
  using _AcGsk = Bricscad.GraphicsSystem;
  using _AcPl = Bricscad.PlottingServices;
  using _AcBrx = Bricscad.Runtime;
  using _AcTrx = Teigha.Runtime;
  using _AcWnd = Bricscad.Windows;
  using _AcInt = Bricscad.Internal;
  using _AcRbn = Bricscad.Ribbon; //for compatibility with Autodesk.AutoCAD.Ribbon;
  using _AdWnd = Bricscad.Windows; //for compatibility with AutoCAD Ribbon: AdWindows.dll
  using _AxApp = BricscadApp; //COM
  using _AxDb = BricscadDb; //COM
//BRX-specific below here
  using _AcLic = Bricscad.Licensing;
  using _AcMec = Bricscad.MechanicalComponents;
  using _AcGc = Bricscad.Geometrical3dConstraints;
  using _AcBim = Bricscad.Bim;
  using _AcCiv = Bricscad.Civil;
  using _AcDm = Bricscad.DirectModeling;
  using _AcIfc = Bricscad.Ifc;
  using _AcRhn = Bricscad.Rhino;
  using _AcBgl = Bricscad.Global;
#elif ARX_APP
  using _AcAp = Autodesk.AutoCAD.ApplicationServices;
  using _AcBr = Autodesk.AutoCAD.BoundaryRepresentation;
  using _AcCm = Autodesk.AutoCAD.Colors;
  using _AcDb = Autodesk.AutoCAD.DatabaseServices;
  using _AcEd = Autodesk.AutoCAD.EditorInput;
  using _AcGe = Autodesk.AutoCAD.Geometry;
  using _AcGi = Autodesk.AutoCAD.GraphicsInterface;
  using _AcGs = Autodesk.AutoCAD.GraphicsSystem;
  using _AcGsk = Autodesk.AutoCAD.GraphicsSystem;
  using _AcPl = Autodesk.AutoCAD.PlottingServices;
  using _AcBrx = Autodesk.AutoCAD.Runtime;
  using _AcTrx = Autodesk.AutoCAD.Runtime;
  using _AcWnd = Autodesk.AutoCAD.Windows; //AcWindows.dll
  using _AcInt = Autodesk.AutoCAD.Internal;
  using _AcRbn = Autodesk.AutoCAD.Ribbon; //AcWindows.dll
  using _AdWnd = Autodesk.Windows; //AdWindows.dll
  using _AxApp = Autodesk.AutoCAD.Interop;
  using _AxDb = Autodesk.AutoCAD.Interop.Common;
#endif

#If BRX_APP Then
  Imports _AcAp = Bricscad.ApplicationServices
  Imports _AcBr = Teigha.BoundaryRepresentation
  Imports _AcCm = Teigha.Colors
  Imports _AcDb = Teigha.DatabaseServices
  Imports _AcEd = Bricscad.EditorInput
  Imports _AcGe = Teigha.Geometry
  Imports _AcGi = Teigha.GraphicsInterface
  Imports _AcGs = Teigha.GraphicsSystem
  Imports _AcGsk = Bricscad.GraphicsSystem
  Imports _AcPl = Bricscad.PlottingServices
  Imports _AcBrx = Bricscad.Runtime
  Imports _AcTrx = Teigha.Runtime
  Imports _AcWnd = Bricscad.Windows
  Imports _AcInt = Bricscad.Internal
  Imports _AcRbn = Bricscad.Ribbon 'for compatibility with Autodesk.AutoCAD.Ribbon;
  Imports _AdWnd = Bricscad.Windows 'for compatibility with AutoCAD Ribbon: AdWindows.dll
  Imports _AxApp = BricscadApp 'COM
  Imports _AxDb = BricscadDb 'COM
''BRX-specific below here
  Imports _AcLic = Bricscad.Licensing
  Imports _AcMec = Bricscad.MechanicalComponents
  Imports _AcGc = Bricscad.Geometrical3dConstraints
  Imports _AcBim = Bricscad.Bim
  Imports _AcCiv = Bricscad.Civil
  Imports _AcDm = Bricscad.DirectModeling
  Imports _AcIfc = Bricscad.Ifc
  Imports _AcRhn = Bricscad.Rhino
  Imports _AcBgl = Bricscad.Global
#ElseIf ARX_APP Then
  Imports _AcAp = Autodesk.AutoCAD.ApplicationServices
  Imports _AcBr = Autodesk.AutoCAD.BoundaryRepresentation
  Imports _AcCm = Autodesk.AutoCAD.Colors
  Imports _AcDb = Autodesk.AutoCAD.DatabaseServices
  Imports _AcEd = Autodesk.AutoCAD.EditorInput
  Imports _AcGe = Autodesk.AutoCAD.Geometry
  Imports _AcGi = Autodesk.AutoCAD.GraphicsInterface
  Imports _AcGs = Autodesk.AutoCAD.GraphicsSystem
  Imports _AcGsk = Autodesk.AutoCAD.GraphicsSystem
  Imports _AcPl = Autodesk.AutoCAD.PlottingServices
  Imports _AcBrx = Autodesk.AutoCAD.Runtime
  Imports _AcTrx = Autodesk.AutoCAD.Runtime
  Imports _AcWnd = Autodesk.AutoCAD.Windows 'AcWindows.dll
  Imports _AcInt = Autodesk.AutoCAD.Internal
  Imports _AcRbn = Autodesk.AutoCAD.Ribbon 'AcWindows.dll
  Imports _AdWnd = Autodesk.Windows 'AdWindows.dll
  Imports _AxApp = Autodesk.AutoCAD.Interop
  Imports _AxDb = Autodesk.AutoCAD.Interop.Common
#End If

 


© Bricsys NV. All rights reserved.