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

Sign In

Subscribe

Subscribe to Daily Autocad.


Feb 01
Friday
Autocad, ObjectARX
A brief information about ObjectARX…

Autocad Programming

Hello everbody,

Today, I will give brief information about ObjectARX, which is one of the innovative steps in history of AutoCAD. It is another way for programming in AutoCAD, just like AutoLISP and VBA. Main difference of it is the programming languages it uses, which is C++ in versions up to AutoCAD 2007® and C++.NET starting with this version.

However, as it uses C++ language and it requires knowledge of the programming structure of AutoCAD, DLL (dynamically linked library) etc. it took interest of mainly software developers who develop AutoCAD integrated software products, that are customized in special subjects (i.e. plug-ins, add-ons, modules that are used to aid specific kinds of drawings like reinforced concrete, steel detailing drawings, architectural drawings etc.).

Compared to other two customization tools AutoLISP and VBA, ObjectARX is the most complicated one. For example, if you are about to write a code to draw one simple line you can do it in AutoLISP and VBA with only a few lines, besides you can do this inside AutoCAD through the relevant editor. But if you do it with ObjectARX, you will have to prepare a new project in a C++ compiler like Visual Studio, and create up 1-5 (changing from the experience of programmer) code files that needs be compiled together with the AutoCAD libraries the and write up to 100 lines of code. This may sound annoying or just crazy. But the point is, due to the fact that your ObjectARX application is using some part of the original AutoCAD source with ObjectARX, you can control a huge part of run-time environment of AutoCAD. You can manipulate/change the reactions of AutoCAD to specific actions, you can add new reactions that AutoCAD does when predefined conditions occur, you can add temporary graphics, drawing aids, dynamic objects, user interfaces, database connections, communication with other software/hardware etc.. you can even change whatever you don’t like in AutoCAD’s operation sequence or logic :) ; shortly whatever you can program in C++, whatever you can imagine.

What you create with ObjectARX is a DLL file, which can be loaded into AutoCAD, similar to loading AutoLISP or VBA applications. It is not different from any other DLL that AutoCAD uses. This is achieved by using some part of the AutoCAD source code. When AutoDESK introduced ObjectARX concept, what they did is simply to open some of their source code (which is indeed a very precious commercial secret) so that third party software developers could use this source code to develop their own applications that works as a part of AutoCAD. This enabled developers to use AutoCAD only for the user interface of their own program or they simply created some specific tools that work as a part of AutoCAD, help those who already use AutoCAD to prepare their drawings. Main idea is that you can apply the “object-oriented programming” with C++. This means that you can use AutoCAD’s basic objects to create your own objects. When you are making a drawing what you are doing is simply to put together the basic drawing objects like lines, texts, points etc. together in a systematic and oriented manner :) . For example you are creating a signboard by putting together a line object as post a text object as something written on it, and a circle, suppose that it is a circular sign board. If you look into any drawing prepared with AutoCAD or any CAD tool, you can such objects prepared in the same manner. What if you could have directly created a signboard object. Up to this point, idea is same as writing a macro, or creating a block, or an attribute. However idea of creating “custom objects” with ObjectARX is far beyond these. While creating a block, you are limited to what AutoDESK has programmed for BLOCK objects, but with ObjectARX you can take the already existing Block object that AutoDESK has programmed inside AutoCAD and add properties or modify existing properties. You can append your own objects, algorithms, combine different objects together and add dynamic properties to the object that is affected by the things that change when you are drawing etc.

Here I could only give only a brief information about ObjectARX and what you can do with it. However, due to the wide range of possibilities and control it gives to the programmer, its capacity are limited to the capacity of the ObjectARX programmer :) . In my next article, I will explain the components required for creating an ObjectARX application (C compiler and AutoCAD libraries). Please stay tuned:)

Viewed 6,249 times so far... This week: 40 Today: 3 Latest: 4 July 2009, 15:29

Post Tags:

14 Responses to “ A brief information about ObjectARX… ”
  1. Muharrem Kocyigit

    Nov 20, 2006
    Reply

    perfectly, thank you for youre information
    great!!!!

    is it possible programming an ARX-Application with c# ?

  2. Mazhar Basa

    Nov 21, 2006
    Reply

    ARX can be indirectly programmed by any other language, by creating libraries, dlls and then linking your original ARX to them.

    For example, I used a structural analysis program written in FORTRAN in an ARX application. You can even switch from C compiler (visual studio) to FORTRAN compiler (Visual Developer) during debugging. But it is very cumbersome, and still needs a main ARX application written in C.

    However, if you would like to keep your old codes, it is a good practice.

    My worst scenario is to launch an “exe” that is written in an another language through ARX, I have also done that:) I wrote all the data I needed to transfer to the “exe” to a text file and the “exe” reads text file and does whatever it does and writes data back to another text file, and I read data from that text file.

  3. Hi,
    iam new to .net but in my project there is a module i need to append AutoCad file to c# form is it possible?,
    if it possible give me discription how to do this.

  4. Appending meance actually what you want to do, just view the file or edit it also ??

  5. I am also programming ARX-Application with C#.I am so happy to visit your web,and I want to know with you.May be we can comunication with each other by email.Wait for you email.

  6. I found you could not see my email,I give it belows.easypower#126.com(you can replace the # to @)

  7. Mazhar Basa

    Jul 7, 2007
    Reply

    Hi Lee, I will be pleased to help you anytime

  8. MATHIYALAGAN

    Oct 1, 2007
    Reply

    I am a structural engineer in India and involed in programming with VC++. I am trying to extract scheduling data from the 3D Modeling of buildings in Autocad.Further i am trying to link data from Autocad to STAAD.The work is on the way and I will be happy if you can send some of relevent related code samples or modeling or conceptual theoritical data.

    Expecting your positive reply
    MATHI

  9. Hi Mazhar,

    I am writing a ObjectArx application that works realy well. I now want to add some properties from my custom entities to the AutoCAD properties bar. According to the documentation, you must compile your entities into a *.dbx file, create a COM wrapper for them and then somehow compile everything together in order to talk to the properties bar. As I only want to add some properties to the bar, this seems like a bit of an over kill. Is there an easier way? Do you have some example that explains the process step by step?

  10. E. Andrea Pace

    Feb 7, 2008
    Reply

    Good morning. I will have to say that even as an experienced CAD user having been working with AutoCAD applications for nearly 13 years, I really have not had much experience using AutoLisp, ObjectARX or the VBA editor. However, I am very familiar with program crashes due to a runtime error with the C++ issue and some ObjectARX issues. Currently, our office is transitioning to Civil 3D and one user is having such issues numerous times in one day and is not sure what she has done to corrupt the drawing file. I was just wondering if you had any ideas at all that might be helpful. We have company menu we have carried through versions with company created commands and I am wondering if that is an issue or if we have things improperly loaded, or just issues with our smartobjects communicating with other things on the actual system such as Office. Your time is appreciated!

  11. Mazhar Basa

    Jun 5, 2008
    Reply

    Hello Andrea,

    Sorry for the late rsponse.

    I guess you are not making your own objectarx applications and using those inside Civil3D. I suggest that, you should seek the problem in http://discussion.autodesk.com/ but in Civil 3D part not in object ARX. Just enter the error message that you get on the screen and most probably you are not the only one who faced that problem before.

    Using different object arx applications together may also create problems.

  12. Hi Mazhar,

    I want to create a windows application (c# or vb .net) which will create its own objects by using existing AutoCAD objects eg. A “Window” which can be a rectangle (which is an AutoCAD entity ). User should be able to drag this “Window” directly which will have its own attributes.
    Can we achieve this by using ObjectARX or similar tool such as DOTNETARX.

  13. Ervin Djogic

    Sep 5, 2008
    Reply

    Hello

    I have a problem with PSEUDO defined database object.

    Pseudo classes (pseudo defined database objects) is method to substitute run-time class only to alter some behavior or to store additional run-time information. They are saved to file as their base class.

    I have to register my custom classes that when i am reading DWG file and parsing every element, RealDWG library have to get me pointer to the my derived class, (i do not want pointer to the general entity like AcDbPoint), it must be pointer to the derived class (like EXAcDbPointer). This is something like overriding hole entity AcDbPoint with my custom entity ExAcDbPoint, that i can for every point during read DWG file, have pointer to the my derived class ExAcDbPoint.

    class ExAcDbPoint : public AcDbPoint
    {
    public:
    ACRX_DECLARE_MEMBERS(ExAcDbPoint);
    …etc…

    With library DWGDirect++, it is possible to do this behaviour with macros for PSEUDO defines object:

    ODDB_PSEUDO_DECLARE_MEMBERS()
    ODDB_PSEUDO_DEFINE_MEMBERS()

    Is there in RealDWG library somthing that i can call, that can have my custom classes defined and declared as PSEUDO.

    I am porting my application from DWGDirect to the RealDWG and this is importatn for my continoues work on this port.

    Regards
    Ervin

  14. hello,
    i have to develope a .arx file using C#.net code can any one tell me how to do this.


Post a Comment



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