GstarCAD 2024 Visual Basic Programming Guide
GstarCAD 2024 Visual Basic Programming Guide
Contents
- #1. Introduction
- #2. Install GstarCAD SDK
- #3. Create Visual Basic Project
- #4. Get GCAD Application
- #5. Visual Basic Migration
- #6. Copyright
1. Introduction
Using Visual Basic to develop application programs on GstarCAD is essentially programming based on the COM API provided with GstarCAD, which is very popular and easy to use.
2. 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
-
- Addline : .NET programming sample of adding solid lines
-
- Hello : .NET programming sample of outputting prompt information
-
- 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.
3. Create Visual Basic Project
-
Create a new Visual Basic project, and add a reference
-
Select menu Project → Reference…
- Click Browse… button and select the corresponding ' acax.tlb' file in GstarCAD SDK installation directory, e.g. 'C:\grxsdk\arx\inc-x64'.
Please use Run as Administrator to start Visual Basic.
4. 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
5. Visual Basic Migration
To migrate the Visual Basic codes from AutoCAD® to GstarCAD, it is necessary to change the names of some COM objects used in AutoCAD® to the corresponding COM object names used in GstarCAD, e.g. change ' AcadLWPolyline ' to ' GcadLWPolylin e', the prefix ' Acad ' need to be changed to ' Gcad '.
6. Copyright
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.
