Use ObjectDBX/RealDWG to read PropertySetDef from solid3D

Use ObjectDBX/RealDWG to read PropertySetDef from solid3D

wouterbleumink
Enthusiast Enthusiast
1,633 Views
4 Replies
Message 1 of 5

Use ObjectDBX/RealDWG to read PropertySetDef from solid3D

wouterbleumink
Enthusiast
Enthusiast

Hi all,

I am not a professional programmer, but manage overall Smiley Wink

 

I am working on a tool to do the following:

 

-Open Revit and load a project (manual operation, this is to be a Revit plugin)
-Open a DWG containing multiple solid3D object’s that have PropertySet attached to them.
-Export each individual solid3D to a new file. The filename of the new file is based on the Properties from the solid3D’s PropertySet.
-Close the DWG
-Create a new family in Revit
-Import the individual solid3D from each of the DWG’s just created in a separate family.
-Apply some parameter info to the family
-Load the family in the open project
-Loop for all created DWG’s

 

-(Would be nice do do a partial explode of the import, as it would become a generic model instead of a ImportSymbol, but this is an extra; have not found API functionality for this yet)

 

Now, I created a AutoCAD plugin to do this (first part of creating new DWG’s) without problem’s, so I think the code is OK.

 

I want to run this code from within Revit using the RealDWG method of reading a DWG into a database.

 

I am able to count the number of solid3D’s in the main DWG, but when I try to access the PropertySet, I only get a ProxyObject.

 

I think this is due to the fact that the side-databases are not fully loaded in RealDWG, but how to force this? When I search the for a I found these articles:

http://adndevblog.typepad.com/aec/2013/09/call-c-api-functions-from-net-addin.html
http://adndevblog.typepad.com/autocad/2015/07/exploding-aec-entities-using-realdwg.html
but also:
https://forums.autodesk.com/t5/net/is-there-a-way-to-access-aec-object-aec-wall-etc-properties-from/...

 

In the second posting there is an example to use PInvoke to load the sidedb. When I use that example my Plugin and Revit crashes (unexpected error).

 

Could someone verify that the ordinal mentioned in the example is correct (is a UNNAMED one) or point me on how to fully load the AEC portion of the DWG in RealDWG?

 

Thanx in advance!

 

WBMK

0 Likes
1,634 Views
4 Replies
Replies (4)
Message 2 of 5

Balaji_Ram
Alumni
Alumni

Hi,

 

Sorry, i did not notice the comment to that blog post.

 

The ordinal 897 is right for the "drawingPromoterAndIniter" method.

To verify it you will need access to OMF SDK and use dumpbin on the AecBase.lib

 

I have a screenshot of it from the AecBase.lib in the OMF 2016 SDK.

 

To understand the cause of the crash, i suggest trying the RealDWG application as a stand-alone application.

Does that work in loading the side database ?

 

If that works, there could be other issues when loading in Revit. 

Revit could also be loading RealDWG libraries for its own use that could be causing conflicts.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

wouterbleumink
Enthusiast
Enthusiast

Thank you for your reply!

 

I will try to create a standalone application as you suggested and report back. thank you for confirming the ordinal is correct!

 

Regards,

 

wouter

0 Likes
Message 4 of 5

wouterbleumink
Enthusiast
Enthusiast
Hi, i have not yet succeeded in creating a standalone app for this.. Keep getting the missing reference error. Will try again next year. 😉
Happy Holliday's
0 Likes
Message 5 of 5

Balaji_Ram
Alumni
Alumni

Hello,

 

No problem. Let me know after you have tried it.

 

The existing DumpDwg sample in the RealDWG SDK is already a console app.

 

You can include your code in it to try it out as a stand-alone application.

 

Wish you a Merry Christmas and a happy new year.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes