ObjectARX & Dummies

Course Index

*Course support: Click here!
*Course and User samples: Download here!

Wednesday, February 23, 2005

Class 3b - Minimum application using ARXWizard

Hello,

On previous class I have presented the step by step way to create a minimum application by hand. Of course there is a easier way to do that but I think is very important that you understand correctly things that are behind the scenes.

This time we will use the ARXWizard tool which is provided by Autodesk through ObjectARX SDK. If you go to the \Utils folder you will find the install program. Go ahead, install it and allow Live Update to run at the first time. Do this with your Visual Studio .NET closed.

After you install it, open Visual Studio.NET, open File menu and start a New Project. The following dialog will appear and you will find a new node inside Visual C++ Projects folder which is called Autodesk. Select this node and the ObjectARX/DBX/OMF Project icon will appear at the right side as following:




Fill out the Name field and specify the desired location to create the new project. Click OK to continue. The following dialog will appear:



This dialog presents the steps to setup your new project. The first page, called Overview, shows some information and give you the opportunity to inform your RDS (Registered Developer Symbol). This label will be used to prefix anything that your code could implement and could conflict with other third-party applications. To allow this prefix to be unique, Autodesk provides (through ADN subscriptions) a way to register your prefix and inform other ADN members. Even you are note an ADN member you should create your own RDS. Use your initials, your 3 name first chars or any other name you find clear and useful.

The next step is to choose your desired Application Type. As I have mentioned before, ARXWizard suggests the ARX / DBX types which are basically the separation of Interfaces and Custom Classes. More details about the main differences between ARX and DBX can be found at ObjectARX documentation. This time we will choose the ObjectARX option as follows:



The next step is about Additional SDK Support which allows you to extend basic ObjectARX features to an specific Autodesk vertical. There are two options:

  • OMF Support: This is the SDK extension for Autodesk Architectural Desktop (aka ADT) which contains specific features that could be used if you plan to develop an ObjectARX application to run inside ADT;
  • MAP API Support: This is the SDK extension for Autodesk MAP which contains extra features to be used if you plan to develop a MAP ObjectARX application.

In our case, we will develop an ObjectARX application targeting plain (or vanilla) AutoCAD so leave both blank.



The next step is to specify MFC Support. As I mentioned before we will use MFC Extension DLL project type. This dialog also offers the option to enable AutoCAD MFC Extension Support which will allow you to use specific AutoCAD controls like LineType combo boxes, Color combo boxes, Dockable dialogs, etc. This is pretty handy once those controls are not so simple to implement from scratch. Select Extension DLL and enabled AutoCAD MFC Support:



The last step is dedicated to COM related stuff. ObjectARX supports COM implementations on both Server and Client sides. As COM programming is very complex and is beyond this course scope so I will not cover it.



Leave the options on the Not a COM Server and None. Click Finish to proceed.

Now you can open the project files and see what the ARXWizard has done for you. There are a lot of differences between the project we have created on previous class and the present project because ARXWizard use different implementations using handy classes. We will cover these features several times with our upcoming samples on the next classes.

Compile and Build the project and try to load the resulting ObjectARX application inside AutoCAD. You probably will be able to successfully load it.

7 Comments:

  • I follow your instructions on using the wizard exactly, but I keep getting the same error when I try to build:

    fatal error LNK1104: cannot open file 'mfc70.lib'

    The only mfc library I have on my system is mfc71.lib. How do I fix this?

    By Blogger sensamet, at 8:33 PM  

  • you should use VS2002 instead.

    By Anonymous Findekano, at 6:50 AM  

  • btw - the post above for free training in nothing but SPAM. It's a waste of time.

    Now back to school...
    While I had trouble getting Class 3a to build correctly this one built perfectly.

    No errors - arx was built and available.

    VS2002 SP1 with Object Arx 2006

    Bill

    By Anonymous Anonymous, at 5:43 PM  

  • Oh and one more thing...

    When setting up the project with the wizard, when I click "finish". VS shows a warning message that says...

    <<<

    Due to a defect in the Visual Studio Intellisense, to avoid a freeze in VS later when using our class wizards, please open the stdafx.h file in the VS IDE. Once VS has finished parsing this file, simply save the solution. This will force the necessary update to the VS Intellisense database. Sorry for any inconvenience caused.

    >>>

    It pops up with every project in VS2002 and VS2003.

    Other than that, thanks for the info on additonal SDK support. Very wise.

    Using VS2002 with Object Arx 2006

    By Anonymous Anonymous, at 5:52 PM  

  • Hi,

    This defect is a bug on VStudio which freeze it if you try to navigate your code before the parsing process ends.

    What I usually do is to open the solution, open the StdAfx.h file of the Startup Project (the one with bold name). I then wait for the parsing (see the VStudio status bar accesing files).

    When the parsing is finished, perform a SaveAll.

    That's it, strange but works.
    Regards,
    Fernando

    By Blogger Fernando Malard, at 2:14 PM  

  • Hi. I just wanted to ask how to turn it to managed form, cause when I just switch it in project setting and try to load it with Autocad 2006 it fails.
    Anyone help?

    By Blogger Zdenek [Czech], at 4:54 AM  

  • Hi zdenek,

    Managed form will be possible only if you convert or create the ObjectARX project as a Managed or Mixed-mode Module.

    This way it will allow you to use .NET classes from C++ and then you will be able to create and show Windows Forms.

    A MFC form is different from a Windows form which is based on .NET windows forms.

    Once you create a managed module it needs to be loaded into AutoCAD by the NETLOAD command and it should use the .DLL extension instead of .ARX

    Regards,
    Fernando.

    By Blogger Fernando Malard, at 8:24 AM  

Post a Comment

<< Home