Running the Example Code

AutoCAD Land Desktop ActiveX & VBA

Running the Example Code


All of the example code in the Reference can be copied from the help files, pasted directly into the AutoCAD VBA environment, and then executed with the following requirements:

  • The current active drawing in AutoCAD must be a drawing created with AutoCAD Land Desktop open to model space.

  • The active project must contain objects or data that the example is trying to access for use.
  • In order to provide clear and simple examples, all the examples provided in the reference assume that the Base Point and North Rotation is the same as the AutoCAD World coordinate system using the default X and Y settings. If you use any of the examples in your own code make sure you test for Base Point and North Rotation and provide appropriate conversion when necessary.
  • Some examples contain user input methods such as Utility.GetPoint, which can be called from a macro, but cannot be called from a modal dialog.

To run the examples

  1. Copy the example from the help file into an empty VBA code module.

  2. Add a reference to the AEC Base Application, AEC Base Object, and AutoCAD Land Type Libraries.
  3. Verify that AutoCAD has an AutoCAD Land Desktop drawing open to model space.
  4. Verify that the active project has data for the example to work with.
  5. Open the Macros dialog box by entering the command VBARUN.
  6. Choose the macro and press Run. 

NOTE: The examples are provided to simply show how a specific Object, Property, Method, or Event can be used. No provisions for error trapping are provided. Code optimization, format or logic have been kept simple, and to a minimum, for the sake of clarity.