LusoCAD Visual Basic Programming Guide
Table of Contents
1. Introduction ........................................................................................................................ 2
2. Install LusoCAD SDK........................................................................................................ 2
3. Create Visual Basic Project............................................................................................ 3
4. Get GCAD application ..................................................................................................... 4
5. Visual Basic Migration ..................................................................................................... 4
1
1. Introduction
Using Visual Basic to develop application programs on LusoCAD is essentially
programming based on the COM API provided with LusoCAD, which is very
popular and easy to use.
2. Install LusoCAD SDK
Download LusoCAD SDK ('GRXSDK.ZIP' file). Unzip the 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
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)
2
➢ 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
1) Create a new Visual Basic project, and add a reference
2) Select menu Project→Reference...
3) Click Browse... button and select the corresponding 'acax.tlb' file in
LusoCAD SDK installation directory, e.g. 'C:\grxsdk\arx\inc-x64'.
NOTE: Please use Run as Administrator to start Visual Basic.
3
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 LusoCAD, it is necessary
to change the names of some COM objects used in AutoCAD® to the
corresponding COM object names used in LusoCAD, e.g. change
'AcadLWPolyline' to 'GcadLWPolyline', the prefix 'Acad' need to be changed to
'Gcad'.