ObjectARX & Dummies

Course Index

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

Friday, January 28, 2005



Prior to begin the course I would like to list what are the requirements to create, compile and use ObjectARX applications.

I will use the most recent version that is ObjectARX 2005. Most of features presented will be compatible to previous versions (I will consider release 2000 and above).

What you will need:
  • AutoCAD 2000,2000i and 2002 (and verticals): ObjectARX 2000 and VC++ 6.0;
  • AutoCAD 2004, 2005 and 2006 (and verticals): ObjectARX 2004 and VC.NET 2002 (7.0);
  • AutoCAD 2007, 2008 and 2009 (and verticals): ObjectARX 2007 and VC.NET 2005 (8.0);
  • AutoCAD 2010, 2011 and 2012 (and verticals): ObjectARX 2010 and VC.NET 2008 (9.0);
  • AutoCAD 2013 and 2014 (and verticals): ObjectARX 2013 and VC.NET 2010 (10.0);
*** Visual Studio 2010 and 2012 does provide the Platform Toolset capabilities allowing you to use their IDE but compile the code with previous version. Note that this is possible only if you have the corresponding platform core compiler version installed at your machine. The advantage of this feature is to be able to centralize multiple project versions into the same IDE.

You may download AutoCAD trial versions from Autodesk web site (www.autodesk.com).
To download ObjectARX (for free), go to www.objectarx.com (this will redirect you to the right page at Autodesk's web site).
Once you have the above products, proceed with the installation:
  • Install AutoCAD (full option recommended);
  • Install Visual C++;
  • Install (just need to extract) ObjectARX to your computer;
On the next post I will explain how to install the ObjectARX Wizard tool.

Further information about Microsoft Visual Studio versions:
Product nameCodenameInternal
Supported .NET
Framework versions
Release date
Visual StudioN/A4.0N/A1995-04
Visual Studio 97Boston5.0N/A1997-02
Visual Studio 6.0Aspen6.0N/A1998-06
Visual Studio .NET (2002)Rainier7.01.02002-02-13
Visual Studio .NET 2003Everett7.11.12003-04-24
Visual Studio 2005Whidbey8.02.0, 3.02005-11-07
Visual Studio 2008Orcas9.02.0, 3.0, 3.52007-11-19
Visual Studio 2010Dev10/Rosario10.02.0, 3.0, 3.5, 4.02010-04-12
Visual Studio 2012Dev1111.02.0, 3.0, 3.5, 4.0, 4.52012-09-12
Visual Studio 2013Dev1212.02.0, 3.0, 3.5, 4.0, 4.5, 4.5.1Upcoming



  • I have the folowing question..
    Is this software "Visual C++.NET 2003 Standard" ready to create ARX programs together with ObjectARX?

    By Anonymous maq, at 2:30 PM  

  • Hello maq,

    Officially only the Visual Studio .NET 2002 is supported which uses the .NET Framework 1.0 and MFC 7.0

    This applies to AutoCAD 2004,2005 and the brand new 2006.

    There are some tricks over the Internet to make VS.NET 2003 generate compatible code with 2002 but I really recommend you to use VS.NET 2002.

    If you already purchased the 2003 version just request a downgrade from Microsoft.


    By Blogger Fernando Malard, at 2:27 PM  

  • Hi Fernando, great website! My question is this, is there a difference between Visual Studio .Net 2002 "standard" and "professional"? Then which one should I get, to learn programming and customize arx for autocad? Thanks!

    By Anonymous Anonymous, at 2:43 PM  

  • Hi there,

    Regarding to ObjectARX requirements the Visual Studio .NET 2002 Standard, Professional, Enterprise Developer, Enterprise Architect and Academic will generate the same results.

    Basically, the differences among them are only about development tools included into the package.

    For more information, please take a look at:



    By Blogger Fernando Malard, at 2:54 PM  

  • I have question:
    Does VISUAL STUDIO 2003 be suitable to ACAD 2005 ?

    By Anonymous Anonymous, at 3:59 PM  

  • Hi maq,

    VS 2003 (any flavor) is not officially compatible with AutoCAD 2004, 2005 and 2006. There are some tricks to allow it to generate compatible code but I really would suggest you to avoid these tricks.

    If you already have purchased the 2003 version you need to request a downgrade from Microsoft which is free and will charge you only for the media set.


    By Blogger Fernando Malard, at 4:16 PM  

  • How can I downgrading MS VISUAL STUDIO 2003 to fit version for ObjectARX for ACAD2005 and 2006 ? I can't find it in Microsoft web site.

    By Anonymous Anonymous, at 6:53 PM  

  • Hi,

    You will need to contact Microsoft support by phone and request instructions on how to proceed. As far as I know you will pay only for the shipment and media.


    By Blogger Fernando Malard, at 9:41 PM  

  • Hi Fernando!
    I like this page too.
    I need to implement an application for AutoCAD 2004, but I'm still using VS6.0 SP5, (because VS .NET 2002, 2003 and the 2005 beta was producing strange runtime errors when I was using mixed sources - old application in C and my C++ code.)
    What do you think, is it possible to use VC6 and its MFC with "ObjectARX for AutoCAD 2002" to develop an app for ACAD2004?
    Thanks in advance

    By Anonymous Tamas Veres, at 11:44 AM  

  • Hi Tamas,

    No, there is no way to load an application compiled with ObjectARX 2002 inside AutoCAD 2004 and above.

    You need to use VS.NET 2002 (SP0) to be 100% compatible with AutoCAD 2004 and above.

    Some people use some tricks to use VS.NET 2003 to build applications compatible with AutoCAD 2004 but it is not supported by Autodesk.

    There are several changes in MFC, ATL and inside the ObjectARX SDK that are probably causing the problems you report. The best thing to do is to migrate your applications step by step and fix all problems.


    By Blogger Fernando Malard, at 1:54 PM  

  • I have been looking around on the web for a download of vc++ 6.0 but it appears we cant even buy this anywhere anymore? I bought the 2003 version fairly cheap in 2003 but I dont want a bunch of error ridden fixes just to get started with arx lol. Is there an actual download available that you know of without spending hours upon hours trying to virtually create something similiar?

    By Anonymous KewlToyZ, at 11:34 AM  

  • Hello KewlToyZ,

    If you are planning to develop for AutoCAD 2004,2005 or 2006 you can buy a VS2003 or VS2005 and require a downgrade license from Microsoft.


    By Blogger Fernando Malard, at 11:40 AM  

  • I am using ADT 2005. Which version of C++ do I need. I have version 6.0 but I think I read somewhere that the OBJECT ARX.sdk will only work with C++ version 8.0. Is this true or can I get by with versionb 6.0? Also which version of Visual Studio do I need? Thanks for the help.
    David W Estridge

    By Anonymous Anonymous, at 10:54 AM  

  • Hi David,

    ADT 2005 is based on AutoCAD 2005 so it will require Visual Studio 2002 (7.0) and at least ObjectARX 2004.

    ADT also requires its own specific framework which is called OMF (Object Modeling Framework). This framework will allow you to create and manage specific ADT objects and entities.

    Your VS2002 projects will need to use at least ObjectARX and OMF SDK if it will deal with ADT objects.

    IMPORTANT: If your ObjectARX application will only use native AutoCAD features and nothing from ADT API you can compile your projects without ADT headers and libraries. It will load fine on ADT and on any other AutoCAD based vertical.

    NOTE: ADT OMF SDK is only available to Autodesk ADN members.

    Hope this help.

    By Blogger Fernando Malard, at 11:41 AM  

  • I'm sorry Fernando. I am using ADT 2006! NOT 2005. I hit the wrong key on my keyboard. Can go over the requirements that will be compatible for ADT 06 real quick please. I am very sorry for the inconvenience. Thanks

    By Anonymous Anonymous, at 1:32 PM  

  • Hi Dave,

    ADT 2006 will require the VISUAL STUDIO 2005 version and ObjectARX2005 SDK.

    All other remarks of my previous post are also valid to 2006. There is also a OMF 2006 SDK you need to use to be able to access specific ADT features.

    ObjectARX application compiled with 2005 are NOT binary compatible with 2006 and vice-versa.


    By Blogger Fernando Malard, at 9:18 PM  

  • Hello Fernando,
    Can I use Microsoft Visual C++ express?

    By Anonymous Anonymous, at 7:55 AM  

  • Hello Fernando,
    Is it possible to use Microsoft Visual C++ Express?

    By Anonymous Anonymous, at 7:59 AM  

  • Hello,

    Check this article from Kean Walmsley:



    By Blogger Fernando Malard, at 8:24 AM  

  • I am planning to program with objectARX for autocad 2006. what other requirements do i need to install.
    thanks for the service

    By Blogger satya, at 6:12 AM  

  • I am planning to program with objectARX for autocad 2006. what other requirements do i need to install.
    thanks for the service

    By Blogger satya, at 6:13 AM  

  • Hello satya,

    AutoCAD 2006 requires:

    - ObjectARX 2004, 2005 or 2006;
    - Microsoft Visual C++ 2002 (7.0);

    Note that you are planning to use some features existing only on AutoCAD 2006 you will need to use ObjectARX 2006. In other hand, if you would like to make your application compatible with 3 versions (2004,2005 and 2006) you need to use ObjectARX 2004.


    By Blogger Fernando Malard, at 8:17 AM  

  • Hello Mr. Fernando,
    Is there any access to ADT 2006 & LDT 2006 objects in ObjectARX 2006. I need to create parametrical foundation as bearing structure and to compute volume of soil in quadrant between two layers.

    By Anonymous Valdemar, at 6:47 AM  

  • Hello Valdemar,

    ADT has its own SDK which works together with ObjectARX. It is called OMF and is available only to ADN members.

    This way you need to signup ADN membership or use only AutoCAD level entities in your application.


    By Blogger Fernando Malard, at 8:32 AM  

  • Hi Fernando,
    Your page's so cool.

    I'm using VC++6.0 and I want to develop ObjectARX for AutoCad 2000.
    Have I do anything different from your lessons?

    Thank in advance.

    By Anonymous Đào Anh Vũ, at 12:08 AM  

  • Hi,

    ObjectARX 2000 will be restrict as AutoCAD 2000 is.
    AutoCAD 2000 was the first version to provide MDI support.

    I'm not 100% sure what will work on 2000 but the major part of this Blog's concept applies to 2000 and some part of the code should work too.


    By Blogger Fernando Malard, at 8:14 AM  

  • Hi there,

    I have a load of object ARX files I have found. I would like to look at them. Is there anyway to get a reader or some simple way of viewing the files>?

    By Blogger iain9876, at 8:22 AM  

  • Hi iain9876,

    ObjectARX unmanaged modules are C++ binary code which cannot be easily reversed engineered. If you have the PDB (program database) of this module you could try some third-party disassembler applications.

    The better option is to find the author and request its source code if he can provide.


    By Blogger Fernando Malard, at 8:30 AM  

  • Hi, I'm using Autocad 2004 and I'm trying to find Objectarx 2004. Where can I download objectarx 2004? Does Objectarx2005 work with autocad 2004?

    Thank you!

    By Blogger Guillaume, at 11:11 PM  

  • Hi Guillaume,

    The ObjectARX 2004 SDK is made available through the following Autodesk FTP site:



    By Blogger Fernando Malard, at 9:32 AM  

  • ...and regarding to your question about 2005 it contains features specific for 2005 so it cannot fully run inside 2004.


    By Blogger Fernando Malard, at 9:34 AM  

  • Hello from Italy, Fernando! My question: I’m using Architecture 2008 (i.e. AutoCAD 2007, I think), and I want to study arxprogramming. Some years ago I have bought on ebay Visual Studio .net 2002: is it the right version?

    By Blogger Antonio, at 9:17 AM  

  • Hi Antonio,

    Autodesk Architectural 2008 is based on AutoCAD 2008. Due that it requires Visual Studio 2005 without Service Pack.

    VS2002 works only for versions 2004,2005 and 2006.

    Best regards,

    By Blogger Fernando Malard, at 10:04 AM  

  • Thank you for the quick reply! So now I have a second question. I have only one official copy of AutoCAD (Architecture 2008), which I use in my professional business. I was thinking I could buy a new hard disk and install there a previous trial version of autocad, together with my visual net 2002. Is an arx2005 application compatible with autocad 2008?

    By Blogger Antonio, at 10:22 AM  

  • Hi Antonio,

    No, ARX2005 will not run inside 2007,2008 and 2009. There is a binary break. You need to recompile your code inside VS2005 and this will require your code to be UNICODE compatible.

    Basically if you need to support both 2004,2005,2006 and 2007,2008,2009 families you will need to live with VS2002 and VS2005 in parallel. In this case, I would recommend ObjectARX2004 for VS2002 and ObjectARX2007 for VS2005.

    There are some "hacks" over the Internet to avoid this problems but they are not supported by Autodesk so there is no guarantee they will not cause any problems to you.

    Sorry about the bad news.

    By Blogger Fernando Malard, at 10:37 AM  

  • Hello,

    I want to know if the examples which are provided in arx lib can be compiled with VS2008 ?
    Because I've tried to do this but I have the following error : "Error 8 fatal error LNK1104: cannot open file 'mfc80u.lib'"



    By Blogger Chty, at 12:41 PM  

  • Hello William,

    VS2008 is not compatible with ObjectARX 2007,2008 and 2009.

    You need to use VS2005 (without SP1) to be fully compatible with these 3 versions.


    By Blogger Fernando Malard, at 1:42 PM  

  • thank's for the answer, but why "without SP1" ?

    By Blogger Chty, at 6:37 AM  

  • William,

    Because SP1 make some changes into some libraries which may cause problems with AutoCAD.

    In fact you can use SP1 but ONLY with ObjectARX 2009. If you plan to build based on ObjectARX 2007 or 2008 the only supported version is VS2005 without SP1.


    By Blogger Fernando Malard, at 8:04 AM  

  • Hello,

    It's strange, I've been using ARX 2006 & ARX 2008 with Visual Studio 2008 without any problems. (I didn't know the requirements)

    By Blogger Chty, at 10:06 AM  

  • Hi,

    You will probably run into problems because they are not compatible. There are some hacks over the Internet but they are not 100% guarantee to work.

    Check your compiled module dependencies with the following tool:

    C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin\Depends.exe

    Open your compiled ARX or DBX module inside this applicatio and check the libraries it depends on.

    Probably if you deploy your product to a machine without VStudio something will happen.


    By Blogger Fernando Malard, at 10:17 AM  

  • Since Microsoft Visual Studio 9.0 has been out, there isn't a depends.exe file in the subfolders.

    I copied and renamed the mfc90u.lib and the mfcs90u.lib to mfc80u.lib, and mfcs80u.lib. Then I compiled the clones objectarx sample. When I used the Arx command to load the clones.arx object, it complained of not being compatable, but went ahead and loaded it. You cannot use clone1, or clone2, but will use clone3 command correctly.

    By Anonymous rickjkelley, at 12:45 PM  

  • For the clones.arx compilation, I just copied and renamed two files needed called mfc80u.lib, and mfcs80u.lib from the latest VS 9.0 libs called mfc90u.lib, and mfcs90u.lib. Recompiled them and loaded it using the ARX command. When you load it, the message will come up saying that it is not compatable with 2007, but will load it anyway. Clone1, and clone2 seem not to work, but clone3 will. (This is the one that I was interested in anyway).

    By Anonymous Anonymous, at 12:50 PM  

  • Hello,

    I really don't recommend you to do that. The compatibility is not related only to those libraries. You may run into trouble due several changes on the MFC and CRT libraries.

    If you already have purchased the VS2008 request a downgrade from Microsoft. They probably will charge you only by the DVD mailing.

    Remember, only because it loads does not means it will work.


    By Blogger Fernando Malard, at 1:09 PM  

  • Hi,

    Is there any chance that this ObjectARX can work with C#?

    thank you,

    By Anonymous Anonymous, at 9:51 PM  

  • Hello,

    There is a specific .NET AutoCAD API which allows you to do almost everything you can do with C++ ObjectARX.

    In fact the way and the code itself is different and the way to use the features may also vary a little bit.

    .NET does not allow you to develop custom objects so you still need C++ ObjectARX to do that.


    By Blogger Fernando Malard, at 8:25 AM  

  • Hi.

    First question: Is AutoCAD 2010, ObjectARX 2010 and VS 2008 SP1 a compatible environment?
    Second: Is there any tutorial like this (ObjectARX&Dummies) for these latest versions? If not, could I use this tutorial?

    Thanks in advance and best regards


    By Anonymous Anonymous, at 7:02 AM  

  • Hello Zix,

    Yes, to build AutoCAD 2010 compatible product you need to use ObjectARX 2010 and VS2008 SP1.

    Pay special attention to the platform (x32 or x64) which will require the proper SDK files to compile as the AutoCAD 2010 comes in two platforms too.

    This Blog's tutorials should apply to 2010 release with a few modifications due the SDK changes which you can verify at its Migration Guide.

    Try to just open the projects inside VS2008 follow VS migration wizard and try to compile. If some error appear, go to the Migration Guide and check for the corresponding changes. For the custom entity, the major problem will be the new subXXX() methods like subWorldDraw() which replaces the current worldDraw(). For that a simple #define may do the trick.


    By Blogger Fernando Malard, at 8:09 AM  

  • Thanks for a quick response!

    Best regards


    By Anonymous Anonymous, at 8:28 AM  

  • Hi Fernando.

    Regarding my question about the environment: is it possible to work with VS 2008 SP1 Express Edition or it has to be full version? I have Express Edition and for example I don't have possibility to choose MFC DLL under C++ projects.



    By Anonymous Anonymous, at 6:50 AM  

  • Zix,

    Express edition does not support MFC. There are some workarounds but you will need to use external resource editors, modify used libraries, etc. If you need to use it, go to the Standard version.

    Sorry about bad news.

    By Blogger Fernando Malard, at 8:07 AM  

  • Hello.

    As far as concerned these subXXX() functions from post above, what should be exactly after #define?

    thank you

    By Anonymous Anonymous, at 11:28 AM  

  • Hi,

    This will depend on the platforms you will target.

    If your product will be only focused on the 2010 you just need to replace the non-sub method by the corresponding sub. Take a look at the Migration Guide inside ObjectARX 2010.

    If you plan to target both 2010 and previous family (2007,2008 and 2009 which require a VS2005 project) you will need to create a #define to change the name of these SubXXX methods depending on the project you are compiling.

    Something like that:

    #ifdef MY_VS2005
    #define subXXX XXX

    This way, when compiling inside VS2005 you will use the old style names and when compiling the same code inside VS2008 it will not change the names. Note that "MY_VS2005" is a pre-compile symbol you should define yourself inside the VS2005 project settings.

    Good luck.

    By Blogger Fernando Malard, at 11:55 AM  

  • Hi Fernando.

    Where is Migration Guide located? I simply couldn't find it.


    By Anonymous Anonymous, at 5:34 AM  

  • Hi,

    ObjectARX Migration Guide:

    x64 Migration Guide:

    Both inside \ObjectARX 2010\docs

    For the previous SDKs these document's name may vary.


    By Blogger Fernando Malard, at 10:55 AM  

  • hi Fernando;

    I am dincer from Turkey and have a question .
    what can you say about DOTNETARX? Where can we find documents, source codes and such a blog for DOTNOTARX?

    Thank you

    By Anonymous dincer, at 8:48 AM  

  • Hello dincer,

    The best resource for ObjectARX .NET programming is this from my friend Kean Walmsley:



    By Blogger Fernando Malard, at 9:38 AM  

  • Fernando,

    I have Windows 7 and I'm testing the beta version of VS2010, is there way to make it work with ObjectARX 2010? I tried it but it's now telling me:

    LINK : fatal error LNK1104: cannot open file 'mfc90u.lib'

    What do you suggest??

    By Blogger Estudiante, at 9:04 PM  

  • Hello Estudiante,

    I have not tested this environment yet but I'm afraid you will need to make some unsupported tweaks into the VS libraries.

    In regards to C#, probably it will work with VS2010.


    By Blogger Fernando Malard, at 10:12 AM  

  • can I use Visual C# (sharp) instead?

    By Blogger Shahid, at 5:22 PM  

  • Shahid,

    You can but only for C# programming. C++ will require Visual C++.


    By Blogger Fernando Malard, at 3:02 PM  

  • Hello,
    I'm using Autocad 2007 and I need to compile a program I just received. The problem is : I've been looking everywhere, I can't find any website where we can download VS2005...

    Could you help me, or tell me if it's possible to downgrade a more recent version ?

    Thanks !

    By Blogger Aurore, at 8:59 AM  

  • Aurore,

    You will need to call Microsoft and see if they can provide you VS2005/VS2008 if you buy a version of VS2010.

    If this ObjectARX application is targeting AutoCAD 2010,2011 and 2012 you should use VS2008. This will require you to convert some things inside your project.

    If you are targeting AutoCAD 2008/2009 thus you will need VS2005 indeed.

    Good luck.

    By Blogger Fernando Malard, at 8:01 AM  

  • hello, i am compiling a proyect VC++ 6.0 for AutoCad 2012 with VS 2010 and ObjectARX 2012, the ARX loads ok, but the commands do not work, i list th commands and the names are in Chinesse characters, help me please
    PD: Too Im try to compile it in VS 2008 SP1 and ObjectARX 2010 with same result...

    By Blogger Miguel Angel Armenta Lopez, at 3:48 PM  

  • Miguel,

    Did you try to encapsulate your string messages with the _T() macro?

    "Your Message"


    _T("Your Message")

    This will use the string as UNICODE symbol.
    This also requires you to port your app to UNICODE which requires some modifications described into the ObjectARX documentation.


    By Blogger Fernando Malard, at 8:01 PM  

  • Hi, i get the error LNK2019: unresolved external symbol "class AcDbObjectId __cdecl createLine(class AcGePoint3d,class AcGePoint3d,char *)" (?createLine@@YA?AVAcDbObjectId@@VAcGePoint3d@@0PAD@Z)
    what does it mean? how can I resolve it?

    By Anonymous Anonymous, at 8:45 PM  

  • Did you create the project using ARXWizard?
    Usually this indicates you are missing the ARX libraries or the createLine() method body is not being linked with your code.

    Can you provide more details about your project?

    By Blogger Fernando Malard, at 2:00 PM  

  • Hello, Fernando:
    how can i debug my arx with VS 2010 and AutoCAD 2012? Im trying to do it, but VS 2010 say me there is not source code available and the arx do not appear in the stack frame, I put in the start up suite...
    The break points do not activate because can't load symbol for the document...
    Thanks in advance

    By Anonymous Anonymous, at 2:47 PM  

  • Hello,

    Here is my checklist:

    - Your code should be compiled as DEBUG;
    - The main ARX module should be the current/active project at the VS project tree;
    - VS2010 should have SP1 installed;
    - You need to load into AutoCAD the same binary file you have just compiled in DEBUG mode;

    Another thing you can try is to debug via binding. You compile your project as Debug but do not start AutoCAD from VS. Manually open AutoCAD, load your ARX module and return to VS. There, into the Debug menu, you will find ATTACH command which will show you a dialog with current running processes including acad.exe. Select this process and it will dynamically bind your source code with the runtime DLL.

    Please let me know if any of these tips did solve your problem.

    Best regards,

    By Blogger Fernando Malard, at 7:40 AM  

  • Hi Fernando!
    Well, i have installed SP1, now i'm trying to compile with DEBUG but i get the error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: char * const & __thiscall std::_Vector_const_iterator >::operator*(void)const " (??D?$_Vector_const_iterator@PADV?$allocator@PAD@std@@@std@@QBEABQADXZ)
    Without DEBUG all is ok!
    I have these libraries in linker input:

    By Anonymous Anonymous, at 7:48 PM  

  • Hello,

    Have you checked if your _DEBUG symbol is being properly handled into StdAfx.h?

    As this symbol affects how MFC libraries are compiled you need to wrap the includes with a #if statement like this example (see how the BOLD definitions wrap the includes):


    #if defined(_DEBUG) && !defined(AC_FULL_DEBUG)
    #pragma message("Building debug version of this module to be used with non-debug/Prod AutoCAD")
    #define DEBUG_THIS_ONLY
    #undef _DEBUG

    #pragma warning(disable: 4275)

    #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

    #include // MFC core and standard components
    #include // MFC extensions

    #ifndef _AFX_NO_OLE_SUPPORT
    #include // MFC OLE classes
    #include // MFC OLE dialog classes
    #include // MFC OLE automation classes
    #endif // _AFX_NO_OLE_SUPPORT

    #ifndef _AFX_NO_DB_SUPPORT
    #include // MFC ODBC database classes
    #endif // _AFX_NO_DB_SUPPORT

    #ifndef _AFX_NO_DAO_SUPPORT
    #pragma warning(push)
    #pragma warning(disable:4265)//disable missing virtual destructor warning
    #include // MFC DAO database classes
    #pragma warning(pop) // C4265
    #endif // _AFX_NO_DAO_SUPPORT

    #include // MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT

    #include "AcadStdafx.h"

    // Turn on the _DEBUG symbol if it was defined, before including
    // non-MFC header files.
    #ifdef DEBUG_THIS_ONLY
    #define _DEBUG
    #undef DEBUG_THIS_ONLY

    Hope it helps you.

    By Blogger Fernando Malard, at 11:41 AM  

  • Hi, Fernando: I get this error trying to write xdata to an acad object: Unhandled Exception in 0x76e82cc7 in acad.exe: 0xC0000005: Access violatios reading at 0x289ee5bf. Funny thing that sometimes fails and sometimes not!
    WHat may be happenning??
    Thanks in advanced...

    pRb =acutNewRb(AcDb::kDxfRegAppName);
    AcDbObjectId objId;
    AcDbEntity *pEntity;

    if (acdbOpenObject(pEntity, objId, AcDb::kForWrite, false) != eOk)
    acedAlert(_T("Error: Can´t open object!"));
    else {
    if (pEntity->setXData(pRb) != Acad::eOk)
    acedAlert(_T("Error: Can´t add XData!"));
    Sometimes fails in pEntity->setXData and sometimes fails in pEntity->close()

    By Anonymous Anonymous, at 2:49 PM  

  • Hello,

    The problem seems to be related to the upgradeOpen() method call.
    This method is only intended to be used when you have an entity opened for READ and want to enable WRITE capability to it.

    At your code you opened the entity for WRITE so you don't need to call upgradeOpen(). As a matter of fact, the ideal scenario would be changing the open to READ and keep the upgradeOpen() call.

    Note that every open operation in WRITE mode will trigger a lot of reactors inside AutoCAD database so it is way slower than a READ open. Only use WRITE mode when you are sure the entity is going to be changed. If any test needs to be done prior to the modification you can do the test in READ mode.

    Another minor issue is that your call to acutRelRb(pRb); is inside the ELSE so if your entity cannot be processed the resbuf is not being cleaned up. The following two calls in your code:

    pRb =acutNewRb(AcDb::kDxfRegAppName);

    ...should be inside the IF because if you don't open the entity why use them anyway?

    Hope it will fix your strange behavior.

    Best regards,

    By Blogger Fernando Malard, at 9:12 AM  

  • Hello, Fernando!
    I get this error executing an arx application: Unhandled Exception 0x77303873 in acad.exe: 0xC0000374: This in free.c in:
    #endif /* _WIN64 */
    retval = HeapFree(_crtheap, 0, pBlock); // Here the error

    if (retval == 0)
    errno = _get_errno_from_oserr(GetLastError());

    What is can be it??

    By Anonymous Anonymous, at 5:52 PM  

  • Hi Fernando!

    I changed my code just you say and the exception error still be present.
    NOw, fails in acutRelRb() function too:
    Unhandled Exception in 0x0f477750 in acad.exe: 0xC0000005: Access violation reading at 0x0000001a.
    It will be problem with AutoCad, MSVC++ or ObjectARX, or other anything???

    By Anonymous Anonymous, at 10:06 PM  

  • Hello,

    To better understand the problem I need more info about your installed software and versions.

    What version of VS are you using?
    Does it have the latest updates?
    What version of AutoCAD and ObjectARX?
    Is it 64bit, 32 or both?

    Thank you,

    By Blogger Fernando Malard, at 9:34 AM  

  • Well, i´m using Visual Studio 2010 Sp1, ObjectArx 2012, Autocad 2012 SP2 in win 7 Ultimate SP1 32 bits

    By Anonymous Anonymous, at 4:09 PM  

  • Ok,

    Without seeing your complete code is difficult to point the cause of your exception.

    As the method acutRelRb() is responsible for deallocating the memory used by a resbuf object.

    Not sure how you created your VS Project but if it was done manually check the Project type: /MT
    (Multi-threaded) as opposed to /MD (Multi-threaded DLL). You need to use the latter.

    Try to improve your debug exception range by enabling some additional exceptions at the Debug > Exceptions... dialog. Debug your app and when ready to call your command go back to VS and enable some additional exceptions (remember to reset them after you finish the debug with the RESET button). More info about it here:


    If none of those things worked, try to create a new blank project with ARXWizard and test portions of your code there to validate each routine.

    Sometimes in AutoCAD an object left opened will crash later when you reuse it or its container so the code line where the crash occurred doesn't necessarily mean that the problem is there.

    Tell me how it turns out.


    By Blogger Fernando Malard, at 4:26 PM  

  • Hi

    Wonder if you can advise on how to get AutoCAD 2009 working with VS 2010?

    I also have VS2008 installed but obviously I wish to use 2010 if possible.


    By Anonymous Anonymous, at 8:06 PM  

  • Malcom,

    Did you check this article I published some time ago?



    By Blogger Fernando Malard, at 5:18 PM  

  • HI, Fernando!
    Is There some way to call a lisp function from an ARX??


    By Anonymous Anonymous, at 3:11 PM  

  • Hello,

    Basically you can send commands to AutoCAD as LISP expressions.

    There are several ways to do it but it will depend on what exactly you want to do.

    Take a look at this article:


    Note that once you register your own command it can be called the same way AutoCAD native commands can.


    By Blogger Fernando Malard, at 3:52 PM  

  • Hi, Fernando!
    Well, really i want to call a function in C++ code from visual lisp code...

    By Anonymous Anonymous, at 12:50 PM  

  • Hello,

    Once you register your function command using acedDefun() it will be callable from AutoLISP.

    If you are using ARXWizard the "C>" button will show the command registration dialog where you can do that by adding your command at the lower list.

    Hope this help,

    By Blogger Fernando Malard, at 3:22 PM  

  • HI, Fernando!
    how can i create a 3dface in ObjectARx??


    By Anonymous Anonymous, at 4:16 PM  

  • Just use the AcDbFace class:


    const AcGePoint3d& pt0,
    const AcGePoint3d& pt1,
    const AcGePoint3d& pt2,
    Adesk::Boolean e0vis = Adesk::kTrue,
    Adesk::Boolean e1vis = Adesk::kTrue,
    Adesk::Boolean e2vis = Adesk::kTrue,
    Adesk::Boolean e3vis = Adesk::kTrue


    const AcGePoint3d& pt0
    Input first corner point (in WCS coordinates)
    const AcGePoint3d& pt1
    Input second corner point (in WCS coordinates)
    const AcGePoint3d& pt2
    Input third corner point (in WCS coordinates)
    Adesk::Boolean e0vis = Adesk::kTrue
    Input Boolean indicating whether or not first edge will be visible
    Adesk::Boolean e1vis = Adesk::kTrue
    Input Boolean indicating whether or not second edge will be visible
    Adesk::Boolean e2vis = Adesk::kTrue
    Input Boolean indicating whether or not third edge will be visible
    Adesk::Boolean e3vis = Adesk::kTrue
    Input Boolean indicating whether or not fourth edge will be visible


    This constructor initializes the AcDbFace to use the points pt0--pt2 as the four corner points of the face with pt2 being used for both the third and fourth corner points. This produces a face that is triangular. The points must be in WCS coordinates.

    The e0vis--e3vis arguments control the edge visibilities. e0vis controls the visibility of the edge between pt0 and pt1, e1vis the edge between pt1 and pt2, etc. An Adesk::kTrue value indicates the edge is to be visible. An Adesk::kFalse value indicates the edge is to be invisible.

    In addition, standard AcDbEntity initialization occurs.


    By Blogger Fernando Malard, at 4:23 PM  

  • i get the error "an unhandled win32 exception ocurred in ACAD.EXE [xxxx]" when i run my ARX aplication. Before all were fine, and some time after this is what happening...i dont understand it! Help me please!

    By Anonymous Anonymous, at 2:30 PM  

  • Hello,

    I would need further information to help you.
    Things like:

    - AutoCAD version
    - Windows platform: 32 or 64?
    - Visual Studio version

    Further, can you put a breakpoint into the code and detect which line is causing the Exception?


    By Blogger Fernando Malard, at 11:26 AM  

Post a Comment

<< Home