Saturday, May 16, 2009

AU2008 Class

Hello,

Several people have asked me about some advice on creating custom classes inside ObjectARX.
I have made a detailed tutorial and presented it as a Class last year at Autodesk University.

There is an online video recording, PPT and PDF of this class at AU2008 website:
AU2008

For your convinience, I have also posted a direct link to the PDF:
Download

This is the link for related source files:
Projects_Exercise2.zip

This is the link for the Step6 converted to VS2010 SP1, using Toolset V90 and ObjectARX 2012. You will also need VS2008 SP1 installed to be able to compile it.
Exercise2_VS2010_ARX2012.zip

Best regards,
Fernando Malard.

15 comments :

Anonymous said...

Any suggestions on updating from AutoCAD 2008 to AutoCAD 2010 for custom entities.

Thanks,
Mike

Fernando Malard said...

Hello Mike.

Sorry on not getting back before.

There are some issues with methods rename like, for example:

worldDraw() to subWorldDraw()

You will need to rename all old method names by the new subXXX ones.

If you need to maintain the old version (2008) you will need to create a #define which depending of a definition will rename subXXX methods back to XXX allowing thus the compilation with 2008 SDK.

Further, you will need to keep both the solutions and projects for VS2005 and VS2008 which is also kind if annoying.

Good luck.

Anonymous said...

Hi,

It seams that the download link for Projects_Exercise2.zip" is broken.

Could you provide us a new link.

Thanks,

igor

Fernando Malard said...

Hi Igor,

Just fixed the links, please try again.

Thank you.

Anonymous said...

I dont know you're still around here but I'm gonna crazy with this error.
I tried your The Power of ObjectARX class sample for custom dbx object.
I did everything in my project what yu said there but still getting this error.

Creating library D:\Objectarx\MyObjectArx2012\Exercise2\x64\/AuUserInterface.lib and object D:\Objectarx\MyObjectArx2012\Exercise2\x64\/AuUserInterface.exp
2>acrxEntryPoint.obj : error LNK2019: unresolved external symbol "public: __cdecl AuPolyline::AuPolyline(void)" (??0AuPolyline@@QEAA@XZ) referenced in function "public: static void __cdecl CAuUserInterfaceApp::AuUserInterfaceMyCommand1(void)" (?AuUserInterfaceMyCommand1@CAuUserInterfaceApp@@SAXXZ)
2>D:\Objectarx\MyObjectArx2012\Exercise2\x64\/AuUserInterface.arx : fatal error LNK1120: 1 unresolved externals

please help me thanks
Best Regards

Fernando Malard said...

Hello,

Checklist:

- Is your machine a x64 windows machine?
- Did you point to the correct x64 include paths for both INC (also INC-X64) and LIB files?
- Are you using VS2008 SP1?

Hope this help you.

Anonymous said...

Thanks for your quick answer Fernando.

My confgiuration visual studio 2010 with installed visual studio 2008 sp1 and vista 64 bit

Here is the thing when I run my project without any object dbx project my arx project built correct, but when I add dbx project with same conf settings (what you said) to my solution getting this error again.
I did some research on the internet smb says it depends on dbx project situation whether managed or unmanaged I don't know its relevant our problem

Fernando Malard said...

Hi,

Ok, I think your problem is related to the project configuration. When using VS2010 SP1, even with VS2008 SP1 installed, you need to change your settings to make the compiler use the VS2008 engine instead of VS2010. AutoCAD 2012 was built with VS2008 and if you use VS2010 binaries it won't load your module. This can be fixed by a configuration called "Platform Toolset" and it is part of Project Configuration.

Go to: Project > Properties > Configuration Properties > General

There will be an entry called "Platform Toolset" and its default value is V100. Change it to V90 and rebuild your projects. You need to do this for both modules (DBX and ARX).

Let me know if it works now.

Regards,

Anonymous said...

Thanks for helping Fernando but none of them solved my problem.
I'm getting this error again when I add object dbx class definiton
AuPolyline* pAuPolyLine = new AuPolyline();
to my arx project. Without dbx everything built correct with same configuration settings.

By the way I'm using ARX wizard 2012 it changes automatically toolset V100 to V90

Fernando Malard said...

Hi,

ok, I think I will need to migrate the sample to VS2010 and try to solve those issues.

Give me a couple of days and I will post something with the new project attached.

Thank you again for the feedback!

Fernando Malard said...

Hi,

I have found the problem.
As today we have multicore CPUs, Visual Studio takes advantage of that so he may compile the ARX module before DBX thus not finding the class you have defined.

Right click on the ARX module, select "Project Dependencies..." and check your DBX module. This will block Visual Studio to compile the ARX before the DBX.

Let me know if this solves your problem.

Regards,

Anonymous said...

I already did this before nothing's changed
Have you tried your application in Visual studio 2010 with same conf settings may be you can see error more clearly especially with 64 bit.

I wish I could send my project to you but its size so big.

Regards.

Fernando Malard said...

Hi,

I have converted the Exercise2 (Step6) to VS2010 compiling with ObjectARX 2012. See this page's post for the updated link.

Try to check your Include/Reference/Library paths because in VS2010 they are kept inside Project Settings.

Hope this help you to solve your problem.

Regards,

Anonymous said...

At least I understand what's my problem thanks to you its all about because arx wizard doesn't automatically Add New Reference (from common properties/Frame and References for main arx project) when you add dbx project. Sorry I didn't know that.

(If I didn't manage to add custom objects to my project I'd give up my ObjectArx adventures .
Cause only for this purpose I learned C++ instead I already know
C# with Autocad.Net Api but it doesn't support all features as Arx support.)

Best Regards.

Fernando Malard said...

Hi,

Great, I'm glad it helped you!

Good luck with C++ :)

Regards,