GstarCAD 2027 VBA Migration Guide

Contents

31184a9e28a27cbe0c1e5a2e

Migrate Project Code

Run AutoCAD® VBA Manager

Run VBAMAN command to launch the VBA Manager in AutoCAD® as shown below.

04c906b7c9f8eff860f54992

Load Project File (.dvb) to Be Migrated

Click Load… and select the DVB file to load, e.g. 'vbaSample.dvb' as shown below:

f2b2eca12386087ea036ec74

Run VBA Editor

Click Visual Basic Editor button to launch VBA editor and all the project contents of 'vbaSample.dvb' are listed on the left side of the VBA editor, and the project name is 'MySection'.

cf1639aa067df9a99b0501d7

Export VBA Project

  1. Right click on the items under Forms, Modules or Class Modules, e.g. right click on the 'frmAbout' form under Forms and select Export File…, as shown below:
b4a6ce9ce84dcf242a620c8f
  1. Specify a folder to save the exported file (The extension of exported form file is '.frm').

  2. In the same way, export modules and class modules to files (The extension of exported module is '.bas', and the extension of exported class module is '.cls').

  3. Double click on 'ThisDrawing' under AutoCAD Objects to show and copy the codes to a new file.

Run VBA Editor in GCAD

Run VBAIDE command to launch the VBA editor in GCAD, same as that of AutoCAD. A new empty project 'GCADProject' is automatically created by default.

708244110701589eb35fda1a

Modify Project Name

Right click on the 'GCADProject' and select GCADProject Properties(E)…, the Project Properties dialog window pops out. Modify the Project Name to 'MySection' as same name as that in AutoCAD, and click OK.

cf7661ccd8eb744963bf1565 0df9770b2d252c20069efbc9

Import File

  1. Right click on 'MySection' project and select the Import File… The Import File dialog window pops out, as shown below.
a182d537572e53041cc673fc
  1. Select all files just exported from AutoCAD and import into 'MySection' project, as shown below:
b42210627ab7d131d50d5c8d 7c065e5a63a0c67ff943c55f

Import Code of 'ThisDrawing'

Copy the source codes exported from 'ThisDrawing' in AutoCAD to 'ThisDrawing' here in GCAD VBA editor.

e53d50f47905670180bbe113

Save as GCAD VBA Project (.vbi)

Click File→Save to save 'MySection' project as 'vbaSample.vbi', as shown below:

b4bdbf3e755a03e2ac715360 5e7bc582d5790c6db95225de
NOTE

The extension name of AutoCAD VBA project file is 'DVB' while the extension name of GCAD VBA project file is 'VBI'.

Modify Migrated Code

  1. Replace the preifx 'Acad' of COM object name used in migrated codes with 'Gcad' in correspondance with GCAD, e.g. replace "AcadLine" with "GcadLine".

  2. Replace the 'autocad.application' used in migrated codes with 'gcad.application' in correspondance with 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.

19980cacaf514ed1622e2cd1