This document applies to MX in AutoCAD version 2 in both Releases 14 and 2000 of AutoCAD.
MX in AutoCAD Version 2 uses intelligent custom objects to extend the power of AutoCAD to make it applicable specifically to MX software for civil engineers. MX applications run in three environments, Microsoft Windows NT4, AutoCAD and MicroStation. In AutoCAD it is the custom objects that enable the MX applications to look and feel the same as they do in the other two environments. This paper explores custom objects, what they mean to you the consumer and how you can make the most of them.
Before object technology became available, AutoCAD users and developers had to represent real-world objects with nothing more than lines and arcs. In previous versions of AutoCAD (Release 12 and earlier) and other CAD systems, applications like MX used blocks (simple groupings of graphical entities) to emulate object-oriented behaviors. However, as they could contain only graphical entities (not arbitrary object methods and intelligent data), developers were limited as to what they could build in. You could directly access and edit geometric entities within blocks, but doing so could accidentally destroy or corrupt the limited intelligence and model data held within a block.
In AutoCAD R14 it became possible for Infrasoft to create MX civil engineering applications in which intelligent design objects became firstorder objects in the AutoCAD database. Infrasoft has called its objects MX Strings. This means that MX String objects will only respond to editing commands in a way that is meaningful to them, interoperate with allowable entities and display according to defined characteristics.
Autodesk's objective technology, ObjectARX , enables Infrasoft to transform ordinary geometry into civil engineering specific models, with intelligent design objects that contain behavior. In the architectural world common examples of custom objects are doors, walls & windows. As objects these doors, walls and windows behave according to the specific properties or rules by which they are actually used in the real world, within AutoCAD itself. In the design, a door positioned in a wall is intelligent, that is, it would recognize the situation and "know" not to be positioned such that it could not open.
Even though the data within an individual MX String is never the same twice, the behavior for different types of string can be defined. This means that the MX String has a knowledge of its environment and can access additional design data held in the custom object and in files and databases external to AutoCAD. It can trigger operations ranging from a simple on-screen notice to the preparation of a comprehensive spreadsheet at an appropriate time.
This also means that AutoCAD knows very little about the MX String object, all the intelligence comes from the MX application that is loaded into AutoCAD.
By being a member of the Autodesk Developer Network, Infrasoft has access to use, and receives support of, ObjectARX . This is a programming environment that includes a number of dynamic link libraries (DLLs) that run in the same address space as AutoCAD and operate directly with core AutoCAD data structures and code. These libraries comprise a versatile set of tools, which allows Infrasoft to take advantage of AutoCAD's open architecture. They provide direct access to the AutoCAD database structures, graphics system, and CAD geometry engine to extend AutoCAD and its capabilities at run time. Infrasoft can create new commands that operate in exactly the same way as native AutoCAD commands.
ObjectARX entities developed by Infrasoft are virtually indistinguishable from built-in AutoCAD entities.
ObjectARX allows Infrasoft to program both MX Strings and commands to react to specific events that occur during the course of using AutoCAD. Known as reactors, these alert MX to specific situations and provide notification of data changes to the software. This protects you from potentially harming the data integrity built into the model, since the software can take appropriate action before the damage occurs.
It is these reactors that allow us to keep the model file and drawing file synchronized, no matter where the editing takes place, from the MX menu's, the AutoCAD command line, AutoLISP, a macro or a VBA script.
AutoCAD demand loads ObjectARX applications when encountering a custom object in the DWG file. If the application is not registered on the machine an alert box is automatically displayed with the source application, class name, and other information, such as Infrasoft's web address and telephone number. The alert box is also displayed if the application is unloaded during an editing session.
Demand loading of an application also occurs when an unknown command is entered in AutoCAD. AutoCAD tries to find and load the ObjectARX application that owns the command, by consulting the system registry, before issuing the "Unknown command" message.
Demand loading provides seamless integration of applications within AutoCAD and makes for better performance and efficiency compared to systems that have to have applications loaded all the time. These can drain system memory and CPU resources to do minor tasks.
So you've opened a drawing created with a MX application, yet you do not have MX on your machine. You see the alert box - what next?
A mechanism substitutes each MX String object with a surrogate, or proxy, as the DWG file is opened. This allows DWG files to be shared with any AutoCAD, whether or not they have a MX application installed.
Since AutoCAD knows virtually nothing about the proxy object, all that can be displayed is a vector graphics, or bounding box representation of it. This is saved with the object in the DWG file. Proxy objects allow limited editing, such as move and delete, and use the graphics as trim/extend boundaries, and of course you can plot them. They behave very much like AutoCAD Blocks; however their contents cannot be changed. Modification of the graphical representation of the object can be achieved using AutoCAD's EXPLODE command but unlike exploding a block, the intelligent object is optionally retained. Caution must be exercised here though, as the graphics are almost certainly a simple vector representation of the data in the database - e.g. the endpoints of the dashes in a dashed line representing the line of a road are not surveyed points.
At the end of the editing session, when the drawing is saved, the original custom object and its object-specific data are written back to the drawing file with their integrity intact. This means that any modifications made to the proxy object can be reconciled back to the MX model file the next time it is used in a MX session.
This mechanism maintains the integrity of the drawing database without compromising the integrity of ObjectARX applications.
While the proxy mechanism is flexible and provides integrity, it gives you little or no information about the object itself and the data contained within it. For this reason Infrasoft provide an object enabler much in the way that Autodesk does for the AEC objects.
The MX Object enabler is available to MX and non-MX users alike, via Infrasoft's website (http://www.infrasoft-civil.com/supportframe.htm), or contact your local MX Helpdesk, or any MX user can supply it with the DWG file (a Pack 'n' Go utility is provided with the MX software to help distribution). There is no licensing on this software; it is free and able to be used by anyone, on any number of machines. In addition, a Help file is available with object enabler, which describes the function it provides and how to install it on any machine.
Once the object enabler is installed on a machine the proxy objects are automatically returned to custom object MX Strings once more. This means that you can list MX model and string information and snap to the string geometry even though the MX software itself is not present on the machine.
Objects provide the means for MX to operate as a fast, safe and intelligent software application inside AutoCAD. Infrasoft want MX applications to feel part of AutoCAD itself and not let the technology prevent this from being the case. Hopefully this paper goes some way to explain how this is achieved.
Product TechNotes and FAQs
MX TechNotes And FAQs
Bentley Technical Support KnowledgeBase
Bentley LEARN Server
Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!