GstarCAD 2027 GRX Upgrade Guide

Contents

97933bc4fdda1814bc847649

Introduction

This guide is provided to facilitate upgrading the GRX programs of previous versions to the latest version.

Programming Environment

  • Microsoft® Visual Studio 2022 (version 17.8.0)

  • Windows SDK 10.0 (latest installed version)

  • CPU:

Basic: 1.6 GHz CPU

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)

  • Monitor Resolution:

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

  • GRXSDK

  • Microsoft .NET 8.0

Requirement on Original Source Code

For the application source code with version lower than GRX2025, it needs to migrate the source code to Visual Studio 2022 compile environment, under 'Use Unicode Character Set' and 'Multi-threaded DLL(/MD)' environment.

Install SDK

Download SDK.

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, HelloARX and SimplePalette.

  • Dotnet: .NET programming samples

  1. Addline: .NET programming sample of adding solid lines

  2. Hello: .NET programming sample of outputting prompt information

  3. 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.

GRX Project Upgrade Step

The following are the steps to upgrade sample project 'C:\grxsdk\arx\Samples\HelloARX'.

  1. Open the project 'HelloARX' with Visual Studio 2022, in Review Solution Actions dialog window set Platform Toolset to 'Upgrade to v143' and click OK. If the Review Solution Actions dialog window doesn't pop up automatically, find Platform Toolset in General of HelloARX Property Pages and set as 'Visual Studio 2022 (v143)' manually.
115f5ac0f7c986ad75c996c4
  1. In Solution Explore of Visual Studio 2022, right click on project 'HelloARX' and then click Properties from context menu to launch HelloArx Property Pages dialog window, as shown below.
a7695f32cc8544c6b9e6f267
  1. Select C/C++ in Configuration Properties and set Additional Include Directories in General as 'C:\grxsdk\arx\inc'

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

General-Additional Library Directories: C:\grxsdk\arx\lib-x64 (for 64-Bit)

Input-Module Definition File: C:\grxsdk\arx\inc\AcRxDefault.def

Input-Additional Dependencies:

AecModeler.lib;gcad.lib;gcax.lib;gcbase.lib;gcbr.lib;gccore.lib;gcdb.lib;GcDbConstraints.lib;GcDbPointCloudObj.lib;gcdyn.lib;GcGeolocationObj.lib;gcgs.lib;GcImaging.lib;GcModelDocObj.lib;gplot.lib;

  1. In Visual Studio 2022, click Build→Build Solution to create 'HelloARX.grx' file after compiling the project (If the compilation is not successful, repeat the above steps to reconfigure the project settings).

  2. Run CAD and input 'appload' at the command line to load 'HelloARX.grx'. Input 'HelloWorld' at the command line. If 'Hello World!' is displayed at the command line then the upgrade of the project is successful.

94d4e6c9abeee16b9870088f b3f1e35d32290d47d3fc6ae8

About the Use of Macro OBJECTPARAM_ALLOWED

In order to be compatible with ObjectARX2025, in GRX, if GcString is passed into a variable parameter function such as gcutPrintf , it is necessary to call GcString::constPtr(); as follows:

Previous version:

    GcString sz;
    gcutPrintf(_T("\n%s"), sz);

Current version:

    GcString sz;
    gcutPrintf(_T("\n%s"), sz.constPtr());

If this modification is not made ( i.e. constPtr () is not called), a compilation error will be reported when GRX is compiled:

error C4840: non-portable use of class "GcString" as argument to variadic function

Developers can use this compilation error to modify the code where GcString is called in previous versions.

This compatibility change will result in a compilation error when CString is passed into a variable parameter function such as gcutPrintf():

error C4840: non-portable use of class "ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t>>>" as argument to a variadic function

At this point, you can choose one of the following two methods to modify it:

  • Method1: Change to
    gcutPrintf(_T("%s"), (LPCTSTR(sz)));
  • Method2: After modifying all GcString codes, add OBJECTPARAM_ALLOWED definition in the project configuration . This macro definition can ignore all such compilation errors. As shown below.
349d7fa364a1cd65251d3204

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.

948e78d9e64e5ec85f59f934