API & Plugin Architecture

GstarCAD Developer Hub

Build high-performance vertical applications and automate complex design workflows. GstarCAD provides industry-standard development interfaces including GRX (C++ ObjectARX-compatible), .NET API, AutoLISP / VLISP, and VBA.

Get GRX SDK ↗ Porting from ObjectARX

Supported Programming Interfaces

Choose the development language that matches your application requirements

GRX (C++ Runtime Extension)

High Performance

GstarCAD Runtime eXtension (GRX) is a C++ class library functionally and syntactically equivalent to AutoCAD ObjectARX®. Enables direct access to GstarCAD's core geometry database, graphics subsystem, and command engine.

  • • Syntax Parity: Almost 1:1 header and method names (e.g. AcDbEntity → GcDbEntity)
  • • Custom Entities: Implement custom graphical objects with DWG persistence
  • • Minimal Porting Cost: Usually requires only header replacement and recompilation
Deep Dive into GRX Architecture →

.NET API (C# / VB.NET)

Modern & Rapid

Full managed .NET wrapper providing modern object-oriented access. Develop rich WPF/WinForms dockable palettes, Ribbon controls, and automated transaction-based drawing processors with Visual Studio.

  • • Managed Assemblies: GcCoreMgd.dll, GcDbMgd.dll & GcMgd.dll
  • • Namespace Parity: Autodesk.AutoCAD.* → Gssoft.Gscad.*
  • • LINQ & Database Transactions: Safe and robust document transaction locks
Explore .NET Development Guide →

AutoLISP & Visual LISP

Script Automation

Native interpreter for .lsp, .fas, and .vlx routines. Includes full support for ActiveX COM interop (vlax-*, vla-*) and Dialog Control Language (DCL) for user interfaces.

  • • No Compilation Required: Direct drag-and-drop loading via APPLOAD
  • • Compatibility: 99%+ of legacy AutoCAD LISP scripts execute identically
  • • Built-in VLISP IDE: Interactive debugger and code editor
View AutoLISP Code Examples →

VBA (Visual Basic) & COM

Office Integration

Complete VBA 7.1 (64-bit) runtime environment. Seamlessly exchange data between GstarCAD drawings and Microsoft Excel, Access, ERP, or SQL databases for automated BOM export and schedule updates.

  • • Type Library: Standard COM automation object model
  • • Legacy Support: Run existing .dvb project files
  • • Excel Interop: Real-time bi-directional drawing table updates
Learn VBA Automation →

Porting C++ ObjectARX® Applications to GRX

Most ObjectARX projects can be compiled to GRX in hours using automated string replacement
// 1. Header Inclusion Prefix Transformation
- #include "dbmain.h" // AutoCAD
+ #include "gcdb.h" // GstarCAD GRX

// 2. Class Prefix Transformation: Ac* → Gc*
- AcDbBlockTableRecord* pBlockRecord;
+ GcDbBlockTableRecord* pBlockRecord;

// 3. Command Definition Macro (Lowercase aced/gced)
- acedRegCmds->addCommand(...);
+ gcedRegCmds->addCommand(...);

Gstarsoft provides dedicated technical migration consulting for global Independent Software Vendors (ISVs) seeking to bring their industry plugins to the GstarCAD global marketplace.

ObjectARX® to GRX Complete Symbol & Header Mapping Reference

Binary-level API architecture parity compiled by the Suzhou Gstarsoft SDK Engineering Team

The GstarCAD Runtime eXtension (GRX) SDK is engineered from the ground up to mirror the class hierarchy, virtual method table (vtable) semantics, smart pointer templates (GcDbObjectPointer), and transaction lifecycle of Autodesk ObjectARX®. By maintaining a conditional compilation header (StdArx.h) with typedef aliases, ISVs can compile a single C++ codebase into both .arx and .grx binaries:

Subsystem / Layer AutoCAD ObjectARX® / .NET GstarCAD GRX / .NET Equivalent Porting Effort & Notes
Database Core Classes AcDbDatabase, AcDbEntity, AcDbObjectId GcDbDatabase, GcDbEntity, GcDbObjectId 1:1 prefix replacement (AcDb* → GcDb*)
Geometry Library (Ge) AcGePoint3d, AcGeVector3d, AcGeMatrix3d GcGePoint3d, GcGeVector3d, GcGeMatrix3d Identical linear algebra and tolerance methods
Graphics Interface (Gi) AcGiWorldDraw, AcGiViewportDraw GcGiWorldDraw, GcGiViewportDraw Full custom entity procedural rendering support
Editor & Selection (Ed) acedGetPoint, acedSSGet, acedCommandS gcedGetPoint, gcedSSGet, gcedCommandS Identical result buffer (resbuf) chain semantics
C++ Linker Libraries acad.lib, acdb24.lib, acge24.lib, rxapi.lib gcad.lib, gcdb.lib, gcge.lib, grxapi.lib Compiled with MSVC v142/v143 (VS 2019 / VS 2022)
.NET Managed Assemblies AcCoreMgd.dll, AcDbMgd.dll, AcMgd.dll GcCoreMgd.dll, GcDbMgd.dll, GcMgd.dll Set Copy Local = False in Visual Studio
.NET Root Namespaces Autodesk.AutoCAD.DatabaseServices Gssoft.Gscad.DatabaseServices Use #if GSTARCAD preprocessor directives

Production Code Blueprints: C# .NET Transactions & Side-Database Processing

Verified on GstarCAD 2027 Professional with .NET Framework 4.8 / .NET 8

Below is a complete, thread-safe C# .NET command implementation demonstrating how to iterate through Model Space entities, filter block references with extended entity data (XData), and perform off-screen batch processing using Database.ReadDwgFile() without opening drawings in the editor UI:

#if GSTARCAD
using Gssoft.Gscad.Runtime;
using Gssoft.Gscad.ApplicationServices;
using Gssoft.Gscad.DatabaseServices;
using Gssoft.Gscad.EditorInput;
using Gssoft.Gscad.Geometry;
#else
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
#endif

namespace EnterpriseCadAutomation
{
    public class BatchBomProcessor
    {
        [CommandMethod("GCAD_AUDIT_BLOCKS", CommandFlags.Modal)]
        public void AuditModelSpaceBlocks()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
                BlockTableRecord ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);

                int count = 0;
                foreach (ObjectId objId in ms)
                {
                    if (objId.ObjectClass.DxfName == "INSERT")
                    {
                        BlockReference br = (BlockReference)tr.GetObject(objId, OpenMode.ForRead);
                        foreach (ObjectId attId in br.AttributeCollection)
                        {
                            AttributeReference att = (AttributeReference)tr.GetObject(attId, OpenMode.ForRead);
                            if (att.Tag.Equals("PART_NUMBER", System.StringComparison.OrdinalIgnoreCase))
                            {
                                count++;
                            }
                        }
                    }
                }
                ed.WriteMessage($"\n[GstarCAD Audit] Verified {count} intelligent part references in Model Space.");
                tr.Commit();
            }
        }
    }
}

GstarCAD Developer Cookbook & SDK Engineering Guides

Step-by-step industrial tutorials for C++ GRX, C# .NET, and AutoLISP/VLISP developers
15 Industrial Code Recipes

C++ GRX, C# .NET & AutoLISP Developer Code Cookbook Library

Copy-paste production code patterns for custom entities, database reactors, headless side-database processing, WPF palettes, and 50x faster entmakex automation.

C++ GRX SDK (ObjectARX Porting)

GRX Cookbook 01: Implementing Custom AcDbEntity / OdDbEntity Classes with subWorldDraw & DWG Filing

Architect custom parametric C++ CAD entities in GstarCAD 2027 GRX SDK by overriding subWorldDraw, subGetGripPoints, dwgInFields, and dwgOutFields for binary DWG persistence.

C++ GRX SDK (ObjectARX Porting)

GRX Cookbook 02: AcDbDatabaseReactor & AcEditorReactor Event Hooks for Real-Time Layer & Standards Governance

Intercept objectAppended, objectModified, and beginSave events in C++ GRX to enforce ISO 13567 layer standards and block unauthorized modifications automatically.

C++ GRX SDK (ObjectARX Porting)

GRX Cookbook 03: High-Frame-Rate Interactive Entity Placement Using AcEdJig (sampler & update)

Build responsive real-time cursor preview jigs in GstarCAD C++ GRX by implementing AcEdJig::sampler(), update(), and acquirePoint() with dynamic dimension feedback.

C++ GRX SDK (ObjectARX Porting)

GRX Cookbook 04: Attaching Binary ERP/PLM Metadata via XData (1001 RegApps) and AcDbXrecord Dictionaries

Store structured BOM part numbers, material grades, and cryptographic signatures inside DWG entities using Extended Entity Data (XData) and Extension Dictionaries (`AcDbXrecord`).

C++ GRX SDK (ObjectARX Porting)

GRX Cookbook 05: Multi-Threaded Spatial Bounding-Box & B-Rep Clash Detection in C++ GRX

Accelerate interference checking across 50,000+ MEP pipes and structural steel members in GstarCAD using AcDbExtents spatial R-tree filtering and OpenMP/std::async worker pools.

C# .NET Managed API

.NET Cookbook 06: High-Speed Block Attribute Scanning & BOM Extraction via TransactionManager

Scan 100,000+ block references in under 0.4 seconds in GstarCAD .NET (`Gssoft.GstarCAD.DatabaseServices`) using lightweight ReadOnly transactions and RXClass filtering.

C# .NET Managed API

.NET Cookbook 07: Building Dockable WPF PaletteSet Windows with Document-Locking Command Execution

Host modern WPF MVVM user interfaces inside GstarCAD 2027 using Gssoft.GstarCAD.Windows.PaletteSet and safely modify the DWG database via Document.LockDocument().

C# .NET Managed API

.NET Cookbook 08: Headless Multi-File DWG Batch Processing Using ReadDwgFile Side Databases

Process hundreds of DWG files in the background without opening them in the CAD editor by instantiating `new Database(false, true)` and calling `ReadDwgFile()` in C# .NET.

C# .NET Managed API

.NET Cookbook 09: Complex Boolean Entity Queries Using SelectionFilter & TypedValue Relational Operators

Construct compound `C# .NET Managed API

.NET Cookbook 10: Single-Source Dual-Target .CSPROJ Architecture for AutoCAD & GstarCAD Plugins

Configure an SDK-style `.csproj` with `#if GSTARCAD` conditional compilation and global `using` aliases so a single C# codebase compiles simultaneously for GstarCAD 2027 and AutoCAD.

AutoLISP & Visual LISP Automation

AutoLISP Cookbook 11: 50x Faster Geometry & Layer Creation Using entmake / entmakex Instead of (command)

Bypass command-line overhead and OSNAP interference by constructing lines, closed LWPOLYLINEs, layers, and block inserts directly in the DWG database via `entmakex` DXF lists.

AutoLISP & Visual LISP Automation

AutoLISP Cookbook 12: Reading & Driving Dynamic Block Visibility States and Stretch Parameters via Visual LISP

Automate dynamic block configuration (`AcDbDynBlockReference`) in GstarCAD 2027 using `vla-getdynamicblockproperties`, `vla-get-effectivename`, and variant array marshaling.

AutoLISP & Visual LISP Automation

AutoLISP Cookbook 13: Event-Driven Associative Area & Coordinate Labels Using vlr-object-reactor

Build live reactive annotations in GstarCAD Visual LISP that automatically recalculate and update MTEXT labels whenever a linked boundary polyline is stretched (`:vlr-modified`).

AutoLISP & Visual LISP Automation

AutoLISP Cookbook 14: Self-Contained Single-File AutoLISP Plugins with On-the-Fly Temporary DCL Dialogs

Eliminate missing `.dcl` file deployment errors by dynamically writing Dialog Control Language definitions to `vl-filename-mktemp`, invoking `load_dialog`, and cleaning up automatically.

AutoLISP & Visual LISP Automation

AutoLISP Cookbook 15: Bi-Directional CSV / ERP Title Block Attribute Batch Updater Across Project Folders

Parse external UTF-8 `.csv` schedules in AutoLISP and automatically update title block revision numbers, approval dates, and sheet descriptions across entire project directories.