Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPolygon not work in Civil 2012

1 REPLY 1
Reply
Message 1 of 2
Anonymous
468 Views, 1 Reply

MPolygon not work in Civil 2012

 

In Civil 2012 the type MPolygon is recognized in VSS2010, but when I get the object (using transaction.GetObject) it is not of the type MPolygon but of the type ImpEntity. Casting explicitly to MPolygon fails.
 
In Civil 2011 is working fine.
Does anyone have an idea how to solve this?

 

 

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Hi,

 

We have noticed that already and informed our engineering team for an appropriate fix. In the meantime, here is a workaround using the RXClass which resolves this issue in 2012 release. I am sharing the relevant code snippet below -

 

                   using (DBObject obj = tr.GetObject(mP, OpenMode.ForWrite))

                    {

                        MPolygon mpoly = null;

                        if (obj.GetRXClass() ==

                             RXClass.GetClass(typeof(MPolygon)))

                        {

                            mpoly =

                            (MPolygon)DisposableWrapper.Create(

                            typeof(MPolygon),

                            obj.UnmanagedObject, obj.AutoDelete);

                            Interop.DetachUnmanagedObject(obj);

                        }

                        if (mpoly != null)

                        {

                            // Do something with the MPolygon

                        }

                        else

                        {

                            doc.Editor.WriteMessage("\nNOT an MPolygon ...\r\n");

                        }

                     }

 

Hope this helps,

 

Partha Sarkar

Autodesk Developer Network

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report