GstarCAD 2024 GRX Migration Guide

Contents

Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/e7d00f0629c293ab306fa961

1. Introduction

GRX is the Runtime eXtension programming environment of GstarCAD, which is the latest application development SDK provided with GstarCAD. It provides Object-oriented development environment and APIs based on C++, which can be used to develop GstarCAD application programs, extension CAD classes and protocols, and create new commands in GstarCAD.

One of GRX's advantages is that it supports seamless migration of ARX application programs running on AutoCAD® to GstarCAD with little change to the original source code, keeping the source-code-level compatibility.

2. Programming Environment

  • Microsoft® Visual Studio Enterprise 2017 (Version 15.9.17)

  • Windows SDK 10.0.17763.0

  • CPU:

Basic: 1.6 GHz CUP

Recommended: 3.0 GHz CPU and above

  • RAM:

Basic: 2 GB

Recommended: 8 GB and above

  • Operation System (OS)

Windows 11

Windows 10 (version 1507 and above):

Home, Professional, Education and Enterprise (not support LTSC and Windows 10 S)

Windows 8.1 (with 2919355 update):

Core, Professional and Enterprise

Windows 7 SP1 (with the latest update):

Home, Professional, Enterprise and Ultimate

  • Monitor Resolution:

1028x800 and above true color display, including 4K (3840x2160) display

  • GstarCAD SDK 2024

  • GstarCAD 2024

  • .NET Framework 4.8 and above

3. Requirement on Original Source Code

For the application source code with version lower than ObjectARX 2020, it needs to upgrade the source code to the ObjectARX 2020 first. Source code shall be compiled with Visual Studio 2017, under ' Use Unicode Character Set ' and ' Multi-threaded DLL(/MD) ' environment.

4. Install GstarCAD SDK

Download GstarCAD SDK (' GRXSDK.ZIP ' file) from GstarCAD website:

https://www.gstarcad.net/download/

Unzip GRXSDK.ZIP file to the local disk (e.g. 'C:\grxsdk' ) and there will be 5 directories generated (in 'C:\grxsdk' ) which are: arx , inc , inc-x64 , lib-x64 and utils .

arx contains the header files, library files and sample programs used for porting ARX programs to GRX

programs. It contains the following directories:

  • Inc: Header files used for porting from ARX to GRX

  • inc-x64 : Files used by COM and .NET (for 64-bit)

  • lib-x64 : GRX libraries (for 64-bit)

  • Samples : Sample projects, including Dotnet, fact_dg, HelloADS, HelloA and SimplePalette.

  • Dotnet : .NET programming samples

    1. Addline : .NET programming sample of adding solid lines
    1. Hello : .NET programming sample of outputting prompt information
    1. Vbhello : Sample of .NET programming with VB .NET
  • fact_dg : Sample of LISP function definition

  • HelloADS : Sample of ADS programming

  • HelloARX : Sample of GRX programming

  • SimplePalette : Programming sample of how to create a set Palette windows

  • Utils: Directory contains sub-directories of GRX extended applications, including APIs for extended

function development, e.g. BREP for boundary representation.

Inc: Header files used for programming the GRX

inc-x64 : Files used by COM and .NET (for 64-bit)

lib-x64 : GRX libraries (for 64-bit)

Utils : Directory contains subdirectories of GRX extended applications, including APIs for extended function development, e.g. BREP for boundary representation.

5. Project Configuration

NOTE

'<sdkpath>' indicates the installation path of GstarCAD SDK, e.g. ' C:\grxsdk' .

  1. General / Target Extension : .grx

  2. Select C/C++ in Configuration Properties and set as below:

General / Additional Include Directories : <sdkpath>\arx\inc

  1. Select Linker in Configuration Properties and set as below:

General/Accessory library directory : <sdkpath>\arx\lib-x64

NOTE

Under debug configuration, please delete _ DEBUG macro definition and set Code Generation / Runtime

Library as ' Multi-threaded DLL (/MD)' .

  1. Additional Dependencies:
Lib NameNeed to import or notDescription of related module
AecModeler.libAs neededFaceted solid modeler
GcDbConstraints.libAs neededConstraint
gcdyn.libAs neededDynamic block
gcad.libUsuallyGUI/Controls
gcax.libAs neededCOM service
gcbase.libUsuallyBasic
APIs,
including
memory,
graphics, strings, etc
gcbr.libAs needed3D solid boundary
gccore.libUsuallyEditing/Document
gcdb.libUsuallyDatabase/Entity
GcDbPointCloudObj.libAs neededPoint cloud
GcGeolocationObj.libAs neededGeographic map
gcgs.libAs neededDisplay
GcImaging.libAs neededImage
GcModelDocObj.libAs neededSymbolic entity
gplot.libAs neededPrinting

Select Input/Additional Dependencies under Linker in Configuration Properties , remove lib files of ARX and add lib files of GRX:

'AecModeler.lib;gcad.lib;gcax.lib;gcbase.lib;gcbr.lib;gccore.lib;gcdb.lib;GcDbConstrai

nts.lib;GcDbPointCloudObj.lib;gcdyn.lib;GcGeolocationObj.lib;gcgs.lib;GcImaging.lib;

  • GcModelDocObj.lib;gplot.lib;'

Meanwhile, set Module Definition File path as '<sdkpath>\arx\inc\AcRxDefault.def'

6. Migrate ARX Project with Visual Studio 2017

6.1. Configuration of Target Extension

Select General in Configuration Properties and set Target Extension as '.grx' , and set Configuration as 'Release' .

Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/743d08a5e506235d4e52cd92

6.2. Configuration of Include Directory

Select C/C++ in Configuration Properties and set Additional Include Directories of General as

  • '<sdkpath>\arx\inc' as shown below.
Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/feba55b4ffd5dbd451dbee44

1) General Configuration

Select General under Linker of Configuration Properties and set Additional Library Directories to

' <sdkpath>\arx\lib-x64' , as shown below.

Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/b1fb883a269a97530f2f850a
  1. Input Configuration

Select Input / Additional Dependencies under Linker of Configuration Properties ,

remove the lib files of ARX and add lib files of GRX:

'AecModeler.lib;gcad.lib;gcax.lib;gcbase.lib;gcbr.lib;gccore.lib;gcdb.lib;GcDbConstrai

nts.lib;GcDbPointCloudObj.lib;gcdyn.lib;GcGeolocationObj.lib;gcgs.lib;GcImaging.lib;

  • GcModelDocObj.lib;gplot.lib;'

Meanwhile, set Module Definition File path as '<sdkpath>\arx\inc\AcRxDefault.def'

Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/6b038a972790f98e76994bda Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/d529a86ea9f944ad9a31972e

6.4. Compile Program

After completing the above steps, compile the project and make sure that the compilation is successful. Otherwise repeat the above steps to reconfigure the project settings.

7. Description of GRX Class Library

The following libraries are frequently used in programming with GRX. These libraries have same functions with the corresponding ARX libraries.

  • GcRx : same as AcRX of ARX , classes for binding an application and for runtime class registration and identification

  • GcEd : same as AcEd of ARX , classes for registering commands and for event notification

  • GcDb : same as AcDb of ARX , GstarCAD database class

  • GcGi : same as AcGi of ARX , graphics classes for rendering entities

  • GcGe : same as AcGe of ARX , utility classes for common linear algebra and geometric objects

7.1. GcRx

The GcRx class library provides system-level functionality such as DLL initialization and linking, and runtime class registration and identification as below:

  • Object runtime class identification and inheritance analysis

  • Runtime addition of new protocol to an existing class

  • Object equality and comparison testing

  • Object copy

7.2. GcEd

The GcEd class library is used to define and register new GstarCAD commands which operate in the same manner as the original ones.

7.3. GcDb

The GcDb classes are components of the GstarCAD database. This database stores all the information for the graphical objects that compose a drawing, and the non-graphical objects (such as layers, linetypes, and text styles) that are also part of a drawing.

7.4. GcGi

The GcGi class library provides the graphic interface used for drawing CAD entities.

7.5. GcGe

The GcGe class library provides classes used for performing common 2D and 3D geometric operations, including utility classes such as vectors and matrices and basic geometric objects such as points, curves, and surfaces.

Copyright reserved: Gstarsoft Co.,Ltd

Copying and referencing any part of this document is allowed. No part of this document may be changed

without permission. Please keep this statement when copying or referencing this document.

Literature/GSTARCAD/2024/03 API Guides/assets/GRX Migration Guide assets/f30b40c32517dcb973972bff