GstarCAD 2027 Visual Basic Programming Guide

Contents

60acc6d987f25b14c29866ab

Introduction

Using Visual Basic to develop application programs is essentially programming based on the COM API provided, which is very popular and easy to use.

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

Create Visual Basic Project

  1. Create a new Visual Basic project, and add a reference

  2. Select menu Project→Reference…

cd06163c1033f36418516959
  1. Click Browse… button and select the corresponding 'acax.tlb' file in SDK installation directory, e.g. 'C:\grxsdk\arx\inc-x64'.
NOTE

Please use Run as Administrator to start Visual Basic.

Get GCAD Application

Please use following codes to get GCAD applications:

On Error Resume Next
Set GCADapp = GetObject(, "gcad.application")
If Err Then
    Set GCADapp = CreateObject("gcad.application")
    GCADapp.WindowState = acMax
End If

Visual Basic Migration

To migrate the Visual Basic codes from AutoCAD®, it is necessary to change the names of some COM objects used in AutoCAD® to the corresponding COM object names, e.g. change 'AcadLWPolyline' to 'GcadLWPolyline', the prefix 'Acad' need to be changed to 'Gcad'.

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.

c410231b1ab85bd9b8fa2b87