.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Explode AEC_SCHEDULE_TABLE

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
w.marchewczyk
862 Views, 5 Replies

Explode AEC_SCHEDULE_TABLE

Hello

 

We use Real DWG 2014 in standalone application. I can't explode AecDbScheduleTable objects, collection passed to Explode() method is always empty.

Sample code below:

public static void ExplodeScheduleTable(string strFileName)
        {
            try
            {
                Database db = new Database(false, true);
                db.ReadDwgFile(strFileName, FileShare.None, false, null);
                using (db.TransactionManager.StartTransaction())
                {
                    BlockTable blockTable = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable;
                    if (blockTable != null)
                    {
                        foreach (ObjectId blockId in blockTable)
                        {
                            BlockTableRecord block = blockId.GetObject(OpenMode.ForRead) as BlockTableRecord;
                            if (!block.IsLayout)
                                continue;
                            foreach (ObjectId objectId in block)
                            {
                                try
                                {
                                    Entity dbObject = (Entity)objectId.GetObject(OpenMode.ForWrite, false, true);
                                    if (dbObject.GetRXClass().Name.StartsWith("AecDb"))
                                    {
                                        Console.WriteLine(dbObject.GetRXClass().Name);
                                        DBObjectCollection objects = new DBObjectCollection();
                                        dbObject.Explode(objects);
                                        Console.WriteLine("Exploded:" + objects.Count);
                                    }
                                }
                                catch (Exception exc)
                                {
                                    Console.WriteLine(exc.Message);
                                }
                            }
                        }
                    }
                }
                db.Dispose();
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
        }

After executing this method I can see such result:

AecDbSlab
Exploded:1
AecDbSlab
Exploded:1
AecDbSlab
Exploded:1
AecDbSlab
Exploded:1
AecDbSlab
Exploded:1
AecDbMvBlockRef
Exploded:1
AecDbScheduleTable
Exploded:0
Regards
5 REPLIES 5
Message 2 of 6

An entity is not required to allow itself to be exploded. It can return a null array of objects from its explode method, or it can return eNotImplemented. If the creator of that entity has chosen not to allow it to be explodable, then there's nothing you can do after the fact.

 

But there is a (slightly more complicated) alternative. Depending on what you need, you may have success querying (and recreating) the raw geometry from such entity's using a technique similar to that explained here for Plant 3D objects - http://adndevblog.typepad.com/autocad/2013/07/extracting-the-raw-geometry-from-plant3d-objects.html. An older version of the ObjectARX SDK had a C++ and .NET samples for this. They were called acgisamp or gisamp or something similar.

Cheers,

Stephen Preston
Autodesk Developer Network
Message 3 of 6

I'm trying to use worldDraw() method but it doesn't work for AEC objects. No geometry has been obtained. I tested this using dumpdwg sample in RealDWG 2014.

Regards
Message 4 of 6

AEC objects are usually view dependent, so you'll have to also call viewportDraw.

Cheers,

Stephen Preston
Autodesk Developer Network
Message 5 of 6

Ok, I have implemented ViewportDraw and ViewportGeometry classes. How can I get Autodesk.AutoCAD.GraphicsInterface.Viewport object?

Regards
Message 6 of 6

>>How can I get Autodesk.AutoCAD.GraphicsInterface.Viewport object?

You have to derive your own so you can trap the appropriate calls.

 

I was a bit vague with the sample names in my first reply, so I went back to an old ObjectARX SDK (ObjectARX 2009) to check the exact names. The ObjectARX sample is 'acgisamp' in the graphics subfolder, and the .NET sample is 'GiMeta' in the DotNet subfolder. If you don't have access to ObjectARX SDKs that old, then please send me a message with your private email address and I'll send them to you. The samples are proofs of concept though - not everything you need is necessatily implemented in the samples.

 

The idea is that you implement your own versions of all the Autodesk.AutoCAD.GraphicsInterface classes you need, then you call the entity's WorldDraw function passing in your custom GraphicsInterface.WorldDraw object.

 

If the WorldDraw fucntion returns Fase, then you call the entity's ViewportDraw function passing in an instance of your custom GraphicsInterface.ViewportDraw class.

 

 

 

Cheers,

Stephen Preston
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost