ObjectARX Samples Readme


Introduction

This document provides an overview of the sample applications that come with ObjectARX. The sample applications are located in the ObjectARX samples directory. Whether you are new to ObjectARX or relatively experienced with it, the sample applications can be a source of ideas and an opportunity to learn new concepts. In addition to describing what each sample application does, this document explains the sample categories, lists the skill level required to understand each application, and provides a suggested order in which to go through the sample applications.


Sample Categories

The ObjectARX sample applications are grouped into subdirectories according to the major focus of the sample code. The subdirectories and descriptions of the corresponding categories are listed below.

com

These examples illustrate how to use COM with ObjectARX.

database

These examples focus on understanding and working with the AutoCAD database.

dotNet

These samples demonstrate how to manipulate AutoCAD using the managed .NET API classes.

editor

These examples rely on the AutoCAD editor.

entity

These examples concentrate on deriving custom entities.

graphics

These examples emphasize the AcGi library.

misc

Miscellaneous examples.

reactors

These examples illustrate how to use reactors in ObjectARX.


Skill Levels

To help you identify where to start and what skill level you need to understand a particular sample application, this document lists a skill level rating for each sample. The four levels, beginning, medium, high, and advanced, are characterized by the specific ObjectARX development skills described below.

Beginning

At this level, the developer has an understanding of the AutoCAD database and knows how to do the following:

Medium

At this level, the developer knows how to:

High

At this level, the developer knows how to:

Advanced

At this level, the developer knows how to:


Sample Applications by Subdirectory

com
     AsdkMfcComSamp_dg
     AsdkPlainComSamp_dg
     AsdkSquareWrapper_dg
     designcenter_dg
database
     Arxdbg
     clonenod_dg
     clonreac_dg
     complex_dg
     curve_dg
     deepclone_dg
     elipsjig_dg
     ents_dg
     entswerr_dg
     groups_dg
     longtrans_dg
     ownrshp_dg
     pliniter_dg
     tablerec_dg
     tbliter_dg
     testdb_dg
     xdata_dg
    xrecord_dg
     xtsndict_dg
dotNet
    EllipseJig
    Ents
    EventWatcher

     FilerSample  
    HelloWorld
    Prompts
    Reflection
    SelectionSet
    SheetSet
    SimpleToolPalette
    TabExtension
editor
    custobj_dg
    mfcsamps
         acuisample_dg
         dynamic_dg
        FileNav
        modeless
    SimpleToolPalette_dg
entity
     hilight_dg
     polysamp
     referenc_dg
     tempapp_dg
graphics
     coordsys_dg  
     icon_dg
     mesh_dg
     shell_dg
     stylcvrt_dg
     teselate_dg
     textstyl_dg
     traits_dg
     viewgeom_dg
misc 
     fact_dg
     specials_dg
reactors
     dbreact_dg
     inputpoint
     othrwblk_dg
     persreac_dg
     profilesamp_dg
    ProtocolReactors_dg
   

Note Samples with names that end in "_dg" are referenced in the ObjectARX Developer's Guide.


Sample Applications Alphabetical by Name

This section lists the sample applications in alphabetical order and briefly discusses what each application does.

B | C | D | E | F | G | H | I | J | L | M | O | P | R | S | T | V | X  


Application:

AsdkMfcComSamp_dg

Subject:

COM and MFC

Skill Level:

 

Classes:

 

Summary:

This sample demonstrates some of the many uses of COM access using MFC.


Application:

AsdkPlainComSamp_dg

Subject:

COM

Skill Level:

 

Classes:

 

Summary:

This sample demonstrates some of the many uses of COM access using the Win32 API.


Application:

AsdkSquareWrapper_dg

Subject:

COM wrappers for custom entities

Skill Level:

 

Classes:

 

Summary:

This sample shows an ATL COM wrapper for an ObjectARX custom entity. This project builds a DLL that will be loaded when COM access to the custom entity is requested.


Application:

arxdbg

Subject:

ObjectARX application debugging tool

Skill Level:

Advanced

Classes:

See summary information

Summary:

This application is provided to help in debugging and understanding ObjectARX applications. The application serves as a learning/debugging tool by allowing the user to monitor what types of events are happening in the system. There is an extensive Word document that describes this application's capabilities in great detail.


Application:

clonenod_dg

Subject:

Deep cloning

Skill Level:

High

Classes:

 

Summary:

Implements deep cloning for a user-defined object dictionary in the named objects dictionary.


Application:

clonreac_dg

Subject:

Customizing deep clone behavior

Skill Level:

Advanced

Classes:

 

Summary:

Implements a transient editor reactor to customize deep cloning behavior.


Application:

complex_dg

Subject:

Complex entities

Skill Level:

 

Classes:

 

Summary:

Creates blocks and a complex entity and adds them to the database.


Application:

coordsys_dg

Subject:

Coordinate systems.

Skill Level:

 

Classes:

 

Summary:

This example demonstrates the use of isPerspective (), doPerspective(), getBackAndFrontClippingValues(), polygonDc(), polygonEye(), and polygon(). To do this, it takes an original line segment in model coordinates and creates its equivalents in eye and display coordinates. When displayed, all lines will overlap exactly.


Application:

curve_dg

Subject:

Entities

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates the use of AcDbCurve protocol to create specific types of ellipses.


 

Application:

custobj_dg

Subject:

Custom objects

Skill Level:

 

Classes:

 

Summary:

Implements a custom object. Creates a dictionary and iterates over it.


Application:

dbreact_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

Implements a database reactor and shows how to make the reactor MDI aware.


Application:

deepclone_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

Demonstrates deep cloning.


Application:

designcenter_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

Implements COM interfaces to extend the AutoCAD Design Center .


Application:

EllipseJig

Subject:

Dynamic Block access with .NET

Skill Level:

Medium

Classes:

EntityJig , Ellipse, AlignedDimension, DynamicDimensionData, DynamicDimensionDataCollection

Summary:

This program demonstrates how to use .NET to provide a user interface for the graphical addition of an Ellipse entity in AutoCAD.It also demonstrates dynamic dimensions displayed during jigging.


Application:

elipsjig_dg

Subject:

Using AcEdJig

Skill Level:

 

Classes:

 

Summary:

This program demonstrates how to use AcEdJig to provide a user interface for AcDbEllipse creation that's slightly different from that provided by AutoCAD itself.


Application:

Ents

Subject:

AutoCAD database fundamentals

Skill Level:

Beginning

Classes:

BlockTable , BlockTableRecord, Transaction, ObjectId, Group, Line, Circle, Dictionary

Summary:

This program demonstrates how to create entities, layers, and groups using the .NET API.It is a good place to get background for database programming in AutoCAD with the managed .NET API.


Application:

ents_dg

Subject:

Entities

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates how to create entities, layers, and groups.


Application:

entswerr_dg

Subject:

Entities

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates error checking when creating entities.


Application:

EventsWatcher

Subject:

.NET Managed Reactors

Skill Level:

Medium

Classes:

DocumentCollectionEventHandler , Editor, Database, ContextMenuExtension

Summary:

This C# .NET sample demonstrates how to define pure .NET reactors in AutoCAD to receive notifications for a wide variety of AutoCAD events.The sample also demonstrates custom context menu entries.


Application:

fact_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

This sample provides various utilitiy functions that can be used in ObjectARX.


Application:

FileNav

Subject:

File Navigation Dialog using MFC

Skill Level:

High

Classes:

CAcUiNavDialog

Summary:

Example showing how to use the File Navigation Dialog API.


Application:

FilerSample

Subject:

Demonstrates a custom DWG filer using .NET

Skill Level:

Medium

Classes:

DwgFiler

Summary:

This sample demonstrates how you can write your own custom filer to serialize portions of the DWG file to your custom class.

Application:

groups_dg

Subject:

Groups

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates the use of some of the AcDbGroup protocol.


Application:

HelloWorld

Subject:

.NET Managed API Basics

Skill Level:

Beginning

Classes:

Application and database basic classes

Summary:

This program demonstrates how to use the .NET Managed API in a Visual Basic .NET application.It demonstrates the fundamentals of .NET application development in AutoCAD, including; project settings, commandline messages and posting simple entities to the database.


Application:

hilight_dg

Subject:

 

Skill Level:

Medium

Classes:

 

Summary:

This program demonstrates how to use ObjectARX API functions to highlight and unhighlight subentities of complex entities such as ACIS solids.


Application:

icon_dg

Subject:

Viewport -dependent graphics.

Skill Level:

 

Classes:

 

Summary:

This example demonstrates the main use of polylineDc (), polygonDc(), and getViewportDcCorners()--graphics that depend on the physical layout of the viewport, like icons, markers, or borders that vary with the size of the viewport. For the demonstration, this example draws a box in the upper right corner of the viewport. The box's width and height are always a tenth of the viewport's shortest dimension and are centered a tenth of the viewport's shortest dimension down and to the left of the upper righthand corner of the viewport.


Application:

inputpoint

Subject:

Input Point Manager

Skill Level:

Advanced

Classes:

 AcEdInputPointMonitor, AcEdInputPointFilter and AcEdInputContextReactor.

Summary:

This application demonstrates how to use the Input Point Monitor. In this application, you add an input point monitor, filter, and reactor to the current document. The input point monitor watches your cursor movements. The input point filter tracks custom cursor behavior in addition to standard cursor movement. The input point reactor reacts to various begin and end input functions, whether graphical or keyboard user input. The reactor also allows you to accept or reject the user input.


Application:

longtrans_dg

Subject:

Long transactions

Skill Level:

 

Classes:

 

Summary:

This program shows how to use long transactions, including checkout and checkin of entities.


Application:

mesh_dg

Subject:

mesh()

Skill Level:

Beginning

Classes:

 

Summary:

This example demonstrates the use of the mesh() function.


Application:

mfcsamps\acuisample_dg

Subject:

MFC

Skill Level:

 

Classes:

 

Summary:

This sample demostrates some of the many uses of AcUi MFC dialog classes for AutoCAD.


Application:

mfcsamps\dynamic_dg

Subject:

MFC

Skill Level:

 

Classes:

 

Summary:

This sample demonstrates how to use an MFC DLL in an ObjectARX application.


Application:

mfcsamps \modeless

Subject:

How to implement a modeless dialog in a MDI environment.

Skill Level:

Medium

Classes:

CDialog , AcDbDatabaseReactor, AcApDocManagerReactor, AsdkDataManager, AcEditorReactor.

Summary:

This application demonstrates how to implement a modeless dialog in terms of AutoCAD Multiple Document Environment, as well as how to send commands to the command-line from the dialog context. This application also implements reactors for document, editor, and database. Information on changes and additions in database entities are reflected in the modeless dialog.


Application:

othrwblk_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

This sample shows correct and incorrect ways to use AcEditorReactor::otherWblock to get the object ID of the model space block table record for the destination database.


Application:

ownrshp_dg

Subject:

Ownership

Skill Level:

 

Classes:

 

Summary:

This program demonstrates deriving from AcDbObject and establishing ownership trees.


Application:

persreac_dg

Subject:

Persistent reactors

Skill Level:

 

Classes:

 

Summary:

This program demonstrates the use of persistent reactors by attaching two reactors one to each of two lines. Each reactor stores the object ID of the line to which it is not attached. When the line the reactor is attached to is lengthened or shortened, the reactor opens the other line and modifies its length to be the same as the new length of the line just changed.


Application:

pliniter_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

This program demonstrates iterating over the subentity vertices of an AcDb2dPolyline.


Application:

polysamp

Subject:

This application demonstrate multiple techniques and technologies. (Not a beginner's application.)

Skill Level:

Advanced

Classes:

See Summary Information below.

Summary:

This application is not targeted at the beginning ObjectARX Developer. This application demonstrates many techniques and technologies as follows:

  • How to implement a custom entity class.
  • How transactions work.
  • How to implement an OLE Automation interface for a custom class.
  • How to split your application into a UI and a Custom Object section.
  • How to build an Object Enabler.


This is the Developer Consulting Group melting-pot application, in that it has a little of everything.


Application:

profilesamp_dg

Subject:

Profile Manager notifications

Skill Level:

 

Classes:

 

Summary:

This sample demonstrates some of the many uses of the Profile Manager.


Application:

Prompts

Subject:

Demonstrate basic user input using the .NET Managed API

Skill Level:

Beginning

Classes:

PromptAngleOptions , PromptDistanceOptions, PromptDoubleOptions

Summary:

This sample demonstrates the basics of getting user input at the commandline using the .NET managed API.


Application:

ProtocolReactors_dg

Subject:

Profile Manager notifications

Skill Level:

Medium

Classes:

AcDbAppEntityGrips , AcDbBlockInsertionPoints,

Summary:

This sample demonstrates custom block insertion points and custom dynamic block grips. It creates a block definition named ASDK_CUSTOM_BLOCK. It also implements AcDbBlockInsertionPoints and AcDbAppEntityGrips protocol extension reactors and registers them with the protocol reactor framework.


Application:

referenc_dg

Subject:

Hard pointer references

Skill Level:

 

Classes:

 

Summary:

This program demonstrates interobject references. It creates a class that extends AcDbEllipse by adding functionality to store a dynamic array of hard pointer object IDs. The subErase() member function has been overriden and implemented such that whenever an object of this class is erased, the objects pointed to by the hard pointer IDs stored within the object will also be erased.


Application:

Reflection

Subject:

Using reflection with the .NET Managed API for AutoCAD

Skill Level:

Medium

Classes:

n/a – demonstrates .NET reflection

Summary:

This sample demonstrates how we can use the type information feature of .NET called ‘reflection’ to get runtime information about objects in AutoCAD.


Application:

Ribbon

Subject:

Sample for Windows API features

Skill Level:

Medium

Classes:

RibbonTab, RibbonPanel, RibbonPanelSource, RibbonForm, TaskDialog, ToolTip, MenuBrowserMenu, MenuBrowserMenuItem

Summary:

This sample demonstrates the Ribbon, Task Dialog, Tooltip and Menu Browser APIs.

Application:

SelectionSet

Subject:

Managed .NET API sample which demonstrates selection handling.

Skill Level:

Medium

Classes:

SelectionSet, PromptSelectionOptions, PromptSelectionResult, PromptStatus, Editor, AcEdSSGetFilter, AcEdSubSelectFilter.

Summary:

This sample demonstrates how you can create selection sets which allow custom selection in an AutoCAD transaction.The sample demonstrates standard entity selection as well as crossing, window, fence and filtered selection.


Application:

SheetSet

Subject:

COM

Skill Level:

Medium

Classes:

 

Summary:

This sample demonstrates how to create sheet set components using COM API. It creates a sheet set from scratch and adds sheets based on existing layouts under various categories (both under root and nested). Apart from adding sheets, it shows how to add custom property, label blocks, callout blocks, resource file location and sheet selection set to the sheet set. There is also an example that shows how to sink to sheet set events using an event handler class.


Application:

shell_dg

Subject:

shell()

Skill Level:

Beginning

Classes:

 

Summary:

This example demonstrates the use of the shell() function.


Application:

SimpleToolPalette

Subject:

AutoCAD UI, Managed .NET API

Skill Level:

High

Classes:

CustomToolBase

Summary:

The SimpleToolPalette sample application demonstrates how to use the .NET CustomToolBase class to create a simple Tool Palette client application.


Application:

SimpleToolPalette_dg

Subject:

AutoCAD UI, COM

Skill Level:

Advanced

Classes:

AcadToolImpl .

Summary:

This application demonstrates how to create a simple tool palette.


Application:

specials_dg

Subject:

 

Skill Level:

 

Classes:

 

Summary:

This directory contains code samples that get an object ID and create owner relationships. It also contains files that expand various macros used in the SDK.


Application:

stylcvrt_dg

Subject:

AcDb and AcGi text styles.

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates converting back and forth between AcDb and AcGi text styles.


Application:

Tab Extension

Subject:

Sample demonstrating simple Tab Extensions in .NET

Skill Level:

Beginning

Classes:

TabbedDialogExtension , TabbedDialogEventArgs

Summary:

This sample demonstrates how you can add your own custom tabs to the tab extension-enabled dialogs in AutoCAD such as the Options dialog and Drafting Settings dialog.

Application:

tablerec_dg

Subject:

Symbol tables

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates creating a symbol table record (specifically a layer table record), filling in the required data, and then adding it to the layer table.


Application:

tbliter_dg

Subject:

Symbol tables

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates iterating over a symbol table. In this example, the linetype table is used.


Application:

tempapp_dg

Subject:

Protocol extension

Skill Level:

 

Classes:

 

Summary:

This program demonstrates ObjectARX protocol extension. It implements a protocol extension for AcDbCircle, AcDbEllipse, and AcDbRegion.


Application:

teselate_dg

Subject:

worldDraw () and viewportDraw()

Skill Level:

Beginning

Classes:

 

Summary:

This sample shows a unit circle centered at the origin that depends on a viewport's view of the circle and tries to draw the circle with a polyline with the minimum number of discernible segments. It demonstrates one reason getNumPixelsInUnitSquare () is needed, but does not show how to optimally code the task.


Application:

testdb_dg

Subject:

Reading and writing database objects

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates reading and writing AcDbDatabase objects.


Application:

textstyl_dg

Subject:

AcGi text styles

Skill Level:

Beginning

Classes:

 

Summary:

This program demonstrates the use of AcGi text styles.


Application:

traits_dg

Subject:

Subentity traits

Skill Level:

 

Classes:

 

Summary:

This sample demonstrates using many of the AcGiSubEntityTraits class functions for controlling the properties of the graphics primitives drawn during entity elaboration.


Application:

viewgeom_dg

Subject:

worldDraw () and viewportDraw(), showing the use of getNumPixelsInUnitSquare()

Skill Level:

 

Classes:

 

Summary:

This example demonstrates using viewportDraw (), getModelToEyeTransform(), doPerspective(), RegenType(), and polylineEye().


Application:

xdata_dg

Subject:

Extended entity data

Skill Level:

 

Classes:

 

Summary:

This program shows how to add and access extended entity data (xdata).


Application:

xrecord_dg

Subject:

Xrecords

Skill Level:

 

Classes:

 

Summary:

This program demonstrates using xrecords.


Application:

xtsndict_dg

Subject:

Extension dictionaries

Skill Level:

 

Classes:

 

Summary:

This program demonstrates using extension dictionaries.