Pro, Platinum
The BricsCAD .NET API exposes BricsCAD functionality for use by managed code built on the .NET Common Language Runtime (CLR) platform.
With BricsCAD V19, 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 V19 unless version-dependent P/invoke signatures were used to access unmanaged API functions.
For new development on V19, developers must use Visual Studio 2017 or later. Managed modules compiled with .NET 4 for older BricsCAD versions will continue to run on V19 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.
Create a class library using the class library wizard under your preferred .NET language. There are currently two DLLs that must be referenced ( and ) plus one optional BREP API DLL ( ). These DLLs are located in your BricsCAD installation folder.
Important note: when referencing these DLLs, it's important to set the ' property to .
Note: importing the BricsCAD and Teigha COM type libraries requires without the option!
Sample projects can be found in the BricsCAD install folder, subfolder \API\dotNet.
Since V18, the Bricscad.Internal namespace has been added, with plans to add undocumented functions upon request.
BRX18.DLL has been updated as BRX19.DLL, P/Invoke signatures depending on this file will need to be updated accordingly.
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 |
#If BRX_APP Then |
There are some known differences that developers should be aware of.
Access DBObject after transaction ends
In AutoCAD, objects belonging to a transaction remain accessible in some cases even after the transaction has ended. In BricsCAD, all transaction resident objects are closed when the transaction ends. For example:
using (_AcDb.Transaction tr =
db.TransactionManager.StartTransaction())
{
_AcDb.DBObject space = tr.GetObject(db.CurrentSpaceId,
_AcDb.OpenMode.ForRead);
tr.Commit();
//now 'space' is closed and no longer transaction
resident
_AcDb.ObjectId idXDict = space.ExtensionDictionary;
//works in Acad; eInvalidOperation in Teigha
}
If this situation is encountered, there are two common solutions:
© Bricsys NV. All rights reserved. |