.NET

Reply
Active Member
w.marchewczyk
Posts: 8
Registered: ‎12-10-2013
Message 1 of 6 (353 Views)
Accepted Solution

Explode AEC_SCHEDULE_TABLE

353 Views, 5 Replies
12-10-2013 07:56 AM

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
Board Manager
StephenPreston
Posts: 377
Registered: ‎05-22-2006
Message 2 of 6 (340 Views)

Re: Explode AEC_SCHEDULE_TABLE

12-10-2013 12:30 PM in reply to: w.marchewczyk

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
Active Member
w.marchewczyk
Posts: 8
Registered: ‎12-10-2013
Message 3 of 6 (324 Views)

Re: Explode AEC_SCHEDULE_TABLE

12-11-2013 06:41 AM in reply to: StephenPreston

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
Board Manager
StephenPreston
Posts: 377
Registered: ‎05-22-2006
Message 4 of 6 (319 Views)

Re: Explode AEC_SCHEDULE_TABLE

12-11-2013 08:15 AM in reply to: w.marchewczyk

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

Cheers,

Stephen Preston
Autodesk Developer Network
Active Member
w.marchewczyk
Posts: 8
Registered: ‎12-10-2013
Message 5 of 6 (301 Views)

Re: Explode AEC_SCHEDULE_TABLE

12-13-2013 05:34 AM in reply to: StephenPreston

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

Regards
Board Manager
StephenPreston
Posts: 377
Registered: ‎05-22-2006
Message 6 of 6 (287 Views)

Re: Explode AEC_SCHEDULE_TABLE

12-13-2013 12:07 PM in reply to: w.marchewczyk

>>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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.