Our Friends: Leaflet Printing , Presented by: Talia Cad Software

Sign In

Subscribe

Subscribe to Daily Autocad.


Nov 28
Tuesday
ObjectARX
Components of ObjectARX applications.
For Autocad 2000 and higher versions

Hello everyone,

In this article I will introduce the components of ObjectARX™ applications and tools required to develop them (Fig.1). I know, it looks scary. But it gives you amazing customization abilities.

Fig.1
Fig.1 Components of an ObjectARX project

As I mentioned in my previous article, ObjectARX™ applications are “.dll” files. Of course, there may be other files like “.xls”, “.doc”, “.exe”, “.bmp” ect… or other resource files written in other programming languages, “.php”, “.asp” files, database, hardware driver connections, etc… depending on what your ObjectARX™ project includes. You should consider it a project composed of many components and files, rather than a code snippet that can be copy-pasted as part of a macro.

This “.dll” file, has “.ARX”, or “.DBX” extension. The main application, which I mentioned above, must be ARX file; however if you create your custom objects, which are derived from AutoCAD objects classes, these classes are stored in a DBX extension file, which is linked to main ARX file. At the starting it becomes scary, why two different files, not one? This idea arises from the separation of UI (user interface) from database operations.

ARX file

In this file you keep the code related to the user interface like toolbars, MFC (Microsoft Foundation Classes, which is the standard dialog boxes, buttons, scroll bars etc. that Microsoft use in Windows applications), AutoCAD commands that your application handle (just like the standard commands you enter from the command line), and other code that organize the general operation of you application.

DBX file

In this file, you keep your own “custom classes”. Those who don’t know what “object-oriented programming” is, should skip this part, unless they want to discover a new way of programming. Those who know about it should also skip because I will try to explain it :)  As I mentioned in my previous article, one of the most exciting features of ObjectARX programming is ability to create your own custom objects, which may be related to the concept of “object-oriented programming” in AutoCAD. I will try to explain with an example. As it is mentioned in this article, TABLE command is introduced with AutoCAD 2005®. This table entity is a custom object derived from several line, and text entities combined together to form a TABLE object. I am sure that most of the ObjectARX™ programmers have already created their TABLE objects before AutoCAD 2005®, and used it in their own applications. At least, I have done that. These DBX files or the custom objects inside them are totally reusable, and customizable. Once you create one custom object, you can use it in different applications or you can derive new custom objects from them and adapt them to your new problem.

C++ Compiler

Compiler, is a program which compiles the code into and “.exe” or “.dll” file. Thus, we will use a separate program to write our code. Here is a table for C++ compilers for AutoCAD and C++ versions. Sorry for users of versions before 2000, I started with R14 :)

Fig.2

ARXWizard

It is included in ObjectARX™ SDK (Software Development Kit), which can be downloaded from www.objectarx.com for different versions of AutoCAD. This wizard enables us to create our ObjectARX™ projects, files and objects from default templates and add/modify commands (to AutoCAD) that our application will handle. It is nearly impossible to create a working project for a newbie without ARXWizard. When you install it, it adds a toolbar inside VS2002 and adds itself to the other wizards of VS.

AutoCAD Libraries

They are also included in SDK. They are inside /inc and /lib folders. Actually, you do not need to deal with these files personally. You just enter these directories into your project settings and compiler. As I mentioned in my previous article, the main idea of ObjectARX™ programming is using AutoCAD’s own source code, but not limited to it, which is composed of these libraries. These libraries include AutoCAD’s own object classes and global functions (like shortcut functions to database related works; angle, distance measurement functions and much more…). 

MFC (Microsoft Foundation Classes) Libraries

Libraries to use standard Microsoft dialog boxes, buttons etc… Note that, even if you can use your external resources and MFC libraries, AutoCAD libraries also include objects derived from MFC.

COM+ (Component Object Model) Connections

For those who used a VBA macro or any other program that enables AutoCAD to communicate with other programs (like EXCEL), has already used COM without noticing it. COM is an intermediate platform which enables different programs (even written in different programming languages) to communicate with each other.

Your own Libraries

You can use your own libraries or any other library that is created with C++ or any other programming language.

Web Server Connections

For now it’s just my imagination; who needs to include a web server inside an ObjectARX™ application? However, with the development of internet, it enters every field. It is possible to implement some PHP, ASP, JAVA, AJAX whatever web language you want, through an ObjectARX™ application, will run on a server and work as a part of your project.

As you see, I am just trying to enlarge your imagination, because there are no limits for the components that can be added to an ObjectARX™ application. Those I mentioned are only limited to my programming experiences, for more experienced and talented programmers there may be much more…

Thanks for reading, and please stay tuned. In my next article, for those who are willing to write their first program, I will explain the installation of basic components (Fig.1) for an Object ARX application, so that shortly we can write our first “Hello World” program :)

Viewed 6,380 times so far... This week: 51 Today: 3 Latest: 5 July 2009, 4:08

Post Tags:

6 Responses to “ Components of ObjectARX applications. ”
  1. Hello Mazhar,
    Thank you for your clear explanation. I wan’t to add a few comments about compilers. Object ARX 2004-2006 libraries and AutoCAD 2004-2006 .EXE’s have been linked with VS 2002 ( MFC 7.0 ). So the binary files linked with VS 2003 will not run. But if you configure VS 2003’s linker to use VS 2002 libraries it’s safe to use VS 2003 IDE.

    Please see the Owen Wengerd’s page http://www.manusoft.com/Resources/ARXTips/Main.stm about this

  2. Mazhar Basa

    Nov 28, 2006
    Reply

    Thanks,

    I already use VS2003 thanks to Owen, but the problem is ARXWizards, which are only capable with VS2002. After you install them, they can check for new versions, and I downloaded some updates saying that now they are compatible with VS2003 also. However, I couldn’t run them on VS2003 properly. You can even use VS2005 as explained in Owen’s page. However, I could not succeed that one:)

    These different versions, compatibility problems should scare people, but I believe that we should use the latest versions and upgrades as much as we can. Every new version comes with improving and new features which enables us to do more complicated things much more easily (i.e. .NET programming with AutoCAD 2007). Hard part is the first step forward, after we have done it, new opportunities await us.

  3. Nice work Mazhar.

    To run the wizard on VS 2003, you have to get the latest version for ObjectARX 2006. Autodesk revamped the download mechanisms with the introduction of ObjectARX 2007 and I don’t know if LiveUpdate still works with the older wizards, but it used to be possible to install the original ObjectARX wizard on VS 2002, then use the LiveUpdate toolbar button to download the latest update; the update could then be installed in both VS 2002 and VS 2003 simultaneously.

  4. Mazhar Basa

    Nov 30, 2006
    Reply

    I am honored to hear from masters like Erhan Toker and Owen Wengerd. Those who are interested in ObjectARX should definitely check out their works in http://www.taliasoft.com and http://www.manusoft.com to see what can be done with ARX applications.
    I hope, one day I can be a good programmer like you:)

  5. Hi Mazhar,
    first, thanks for the good job.
    Next, could you update link to your previous article as
    http://www.dailyautocad.com/objectarx/a-brief-information-about-objectarx/

  6. bonjour ; SVP je veux une documentation sur les dll eu sur ARX si c’est possible
    merci


Post a Comment



All content and source © 2008 Daily Autocad | News Plus wordpress theme brought to you by Zidalgo.