Reviewing the Sample Applications

AutoCAD Land Desktop ActiveX & VBA

Reviewing the Sample Applications

 

The AutoCAD Land Desktop ActiveX and VBA ActiveX Object Model comes with several samples that demonstrate how to create your own utilities and extensions to AutoCAD Land Desktop. We have provided samples for each of the most common development environments:

Visual Basic for Applications

Visual Basic

Visual Lisp

ObjectARX

VisualC++

This listing provides the name, description, and location of the main source code file for each sample application. Many sample applications have support files that can be found in the same directory as the main source code file.

Sample Applications:


Sample\Land\Vba\ProjectFind.dvb

Description: VBA dialog for finding AutoCAD Land Desktop projects.

Macros:

ProjectFind

This macro launches a modal dialog that you can use search for a project based on a path and filters using wildcards, and optionally load a drawing from that project into AutoCAD Land Desktop. 


Sample\Land\Vba\PointGroupFncs.dvb

Description: VBA functions to modify Point Groups.

Macros:

AddPointsToGroup

This macro adds a point list to the selected Point Group. The point list can be retrieved from an AutoCAD drawing or typed in.

CreateGroupByDesc

This macro displays a list of all unique point descriptions. You can then create a new Point Group based on that unique description. Then the macro adds all points with that description to that new Point Group.

DisplayGroupsByPoint

Given a Point number, the macro displays all point groups that contain that Point number. The Point number can be typed or selected from an AutoCAD drawing.


Sample\Land\Vba\PointGroupReport.dot

Description: VBA macro that creates a custom Point Group report.

Macros:

PointGroupReport

This macro will accept customer data and print out: customer data, project statistics, and multiple Point Groups.

NOTE: To use the word template, you must have the AutoCAD Land Desktop running and a drawing open with a point database created in its project. Locate the PointGroupReport.dot with Explorer and double click on the file name. This will open Word and begin a new document using PointGroupReport.dot as the template. From the Tools menu open the Macros dialog and select the macro named PointGroupReport. Select the Run button to display the Point Group Display Dialog. This dialog creates a client data section and a point table listing for each selected point group.

To edit this macro use the Visual Basic Editor from the Macro selection of the Tools menu in Microsoft Word.


Sample\Land\Vba\Draw3dSurface.dvb

Description: VBA dialog for drawing a Surface as 3d Faces.

Macros:

DrawSurface

This macro launches a modal dialog that you can use to select a Surface and then draw all visible Surface Faces as AutoCAD 3dFaces. All drawing is done on the current drawing surface.


Sample\Land\Vba\AlignmentUtilities.dvb

Description: VBA dialog for making a copy of an alignment in the alignment database.

Macros:

CopyAlignment

This macro launches a modal dialog that you can use to select an alignment and then make a copy of that alignment. The alignment is not drawn in the current AutoCAD drawing.


Sample\Land\Vba\DrapeLine.dvb

Description: VBA dialog for projecting an alignment to a surface, and drawing the result as a set of lines.

Macros:

DrapeLine

This macro launches a modal dialog that lets the user select an alignment and a surface, and drape a projected series of line entities onto the surface on the current layer.


Sample\Land\Vba\PointGroupTable.dvb

Description: VBA dialog for adding a point table to the drawing.

Macros:

PointGroupTable

This macro launches a modal dialog that allows the user to select a point group, and inserts a table on the current layer that identifies point number, eastings, northings and elevations.


Sample\Land\Vba\ParcelArea.dvb

Description: VBA dialog for displaying the total area of a set of parcels.

Macros:

ParcelArea

This macro launches a modal dialog that allows the user to select one or more parcels, and displays the total area in the proper units.


Sample\Land\Vba\DrawCrossSection.dvb

Description: VBA utility for drawing a cross section of the first station of the current alignment.

Macros:

DrawCrossSection

This macro will drawing a cross section in Model Space using a vertical scale factor of 10. It imports the CrossSection block, and then drafts each cross section surfaces as a lightweight polyline. The code demonstrates how to process the right and left sides of the surfaces properly.


Sample\Land\ActiveX\LockWatcher

Description: A VB application for monitoring multi-user locks for a project.

NOTE: The VB sample LockWatcher was developed using Visual Basic version 5.0. It is also compatible with VB4-32 and VB6.


Sample\Land\VLisp\CogoPoints.lsp

Description: Various Visual Lisp functions to access the Project and Cogo interfaces. This lisp file is useful for learning the syntax of ActiveX and VLisp.

Functions:

loadAecProj

Loads the AutoCAD, Aecc.Application, and the Active Project interfaces. This routine must be run before all other functions.

cleanup

Releases all global interfaces.

ProjectStats

Displays the active project's properties.

PointGroups

Lists the point group names using the Item() method.

PointGroups2

Lists the point group names using Enumeration.

addCgPoint

Adds a new Cogo Point.


Sample\Land\Arx\AeccNew

Description: This ARX provides the command line equivalents of the New and Open dialogs. It demonstrates the use of the ACRX_CMD_SESSION and ACRX_CMD_NOINTERNALLOCK flags for registered commands that use the Document.NewProjectBased and Document.OpenProjectBased ActiveX methods.

NOTE: You must modify project settings for the included directories and the library to match your system. The locations of the following type libraries must also be modified in stdafx.h: acad.tlb, aecxbase.tlb, aecxuibase.tlb and landauto.tlb.

Functions:

aeccnew

This prompts you for arguments and creates a new project/drawing. 

aeccopen

This prompts you for arguments and opens an existing project/drawing.


Sample\Land Arx\PointGroup

Description: This application displays the currently defined point groups and displays the points for an existing point group.

NOTE: You must modify project settings for the included directories and the library paths to match your system. The locations of the following type libraries must also be modified in stdafx.h: acad.tlb, aecxbase.tlb, aecxuibase.tlb and landauto.tlb.

Functions:

c:pointgroup

Lists routines for PointGroup.arx. 

c:listpointgroups

Lists all point groups for the current project.

listgrouppoints

Gives a point group name, will list all of the points.


Sample\Land\ Arx\PointExport

Description: Application will export all Cogo points into an ASCII file.

NOTE: You must modify project settings for the included directories and the library paths to match your system. The locations of the following type libraries must also be modified in stdafx.h: acad.tlb, aecxbase.tlb, aecxuibase.tlb and landauto.tlb.

Functions:

pointexport

Exports all Cogo points to an ASCII file.


Sample\Land\ActiveX\EventLogger

Description: A C++ application for monitoring alignment events.

This sample application displays a dialog with a list box that records all alignment events (when an alignment or station equation is written to the database). The sample demonstrates how to implement an event sink in a COM object using MFC and ATL.