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
Copy the example from the help file into an empty VBA code module.
- Add a reference to the AEC Base Application, AEC
Base Object, and AutoCAD Land Type Libraries.
- Verify that AutoCAD has an AutoCAD Land Desktop drawing open
to model space.
- Verify that the active project has data for the
example to work with.
- Open the Macros dialog box by entering the command VBARUN.
- 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.