Pro, Platinum
The BricsCAD .NET API exposes BricsCAD functionality and allows to build managed code: code that runs under the .NET Common Language Runtime CLR.
With BricsCAD V16, the supported .NET framework version is 4.5.1 with CLR version 4.
Since the new framework is highly compatible to the .NET Framework 4, existing modules compiled for older BricsCAD versions should keep running, unless version-dependent P/invoke signatures were used (see further).
For new developments on V16, developers need to use Visual Studio 2013. While modules compiled with VS2010/.NET 4 for older BricsCAD versions will continue to run on V16, the problem is Visual Studio 2010 itself will not recognize v16's BrxMgd and TD_Mgd reference DLLs, since VS2010 is not .NET 4.5.1 aware.
For .NET based developments, in particular VB.NET, C#, F#, C++/CLI (pure), it should be sufficient to use the free Visual Studio 2013 express compiler.
Create a class library using the class library wizard under your preferred .NET language. There are currently two DLLs that need to be referenced, and (+ optional (BREP API)). These DLLs are located in your BricsCAD installation folder. Important note: when referencing these DLLs, its important to set the ' property to . All other DLLs such as referenced COM DLLs or satellite DLLs. can have their 'Copy Local' property to true, or as needed by your project.
Sample projects can be found in the BricsCAD install folder, subfolder \API\dotNet.
BRX15.DLL has been updated as BRX16.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:
© Menhirs NV. All rights reserved. |