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

IntersectWith gives MissingMethodException

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
dynamicscope
659 Views, 9 Replies

IntersectWith gives MissingMethodException

Hi, I am using "IntersectWith" method as following...

 

 

   foreach (ObjectId id in col_FillingArea)

                            {

                                Entity ent_FillingArea = tr.GetObject(id, OpenMode.ForRead) as Entity;

 

                                if (ent_FillingArea != null)

                                {

                                    foreach (ObjectId id_Terrain in col_TerrainLine1)

                                    {

                                        Entity ent_TerrainLine = tr.GetObject(id_Terrain, OpenMode.ForRead) as Entity;

 

                                        Point3dCollection pntCol = new Point3dCollection();

 

                                        try

                                        {

                                            ent_FillingArea.IntersectWith(ent_TerrainLine, Intersect.OnBothOperands, pntCol,

new IntPtr(0), new IntPtr(0));

                                        }

                                        catch (Autodesk.AutoCAD.Runtime.Exception e)

                                        {

                                            doc.Editor.WriteMessage("\n"+e.Message+"\n");

                                        }

                                       

                                        foreach (Point3d pnt in pntCol)

                                        {

                                            BlockTable blkTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;

                                            BlockTableRecord blkTblRec = tr.GetObject(blkTbl[BlockTableRecord.ModelSpace],OpenMode.ForWrite) as BlockTableRecord;

 

                                            DBPoint dbPnt = new DBPoint(pnt);

 

                                            blkTblRec.AppendEntity(dbPnt);

                                            tr.AddNewlyCreatedDBObject(dbPnt, true);

                                        }

                                    }

                                }

 

 

But I keep getting "MissingMethodException"

Any idea?

 

I am using ObjectARX 2011, AutoCAD 2010 Civil 3D, and VS 2010.

 

Thank you.

9 REPLIES 9
Message 2 of 10

Hi,

 

what type of entity is your ent_FillingArea?

 

What happens if you try this

Dim tCurve as DatabaseService.Curve = TryCast(ent_FillingArea,DatabaseServices.Curve)

...does this result in a valid object in tCurve or is it then nothing?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 10

The entity are Polylines.

And I tried to cast it as Polyline.

 

No compile error.

Message 4 of 10

Hi,

 

>> No compile error.

Does that mean the code could be compiled but the error raises at runtime?

IMHO you have the wrong references set then.

 

What details does the exception have for you if you use Try...Catch...End Try?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 10
hgasty1001
in reply to: dynamicscope

Hi,

 

"I am using ObjectARX 2011, AutoCAD 2010 Civil 3D, and VS 2010." : Why are you referencing ObjectARX2011 in a 2010 project?

 

Gaston Nunez

Message 6 of 10
dynamicscope
in reply to: hgasty1001

Well, I couldn't find ObjectARX 2010 on the download website.

Plus, I asked Autodesk Tech support about version compatibility, and they answered that AutoCAD 2010, 2011, 2012 are binary compatible. Hence ARX 2011 could work with CAD 2010.

 

Do you still think this could be compatibility issue?

 

Regards,

 

Jake

Message 7 of 10

Well the code doesn't properly catch the exception.

I think the AutoCAD catches the MessingMethodException even before it goes into my catch block.

Weird...

 

Regards,

 

Jake

 

Message 8 of 10
norman.yuan
in reply to: dynamicscope

"binary compatible" means binary BACKWARD compatible (it is hardly one can say an application is FOREWARD compatible). That means, an app compiled with older version of components/libraries will work in a computer where only newer version of the components/libraries avaline, if he components/libraries are backwork compatible. However, if the app is compiled with new version of components/libraries and run in computer where only older components/libraries available, the app may or may not work (most likely not). No software vender would gurantee its software to be FOREWARD compatible, so that their hands are tied to improve/enhance there product, even they do not break existing functionalities (BACKWARD compatibility).

 

"Binary Compatible" here only means that the newer version did not break existing functionalities.

 

So, reference a later version of library and develop against loder version is a bad practice in general, even it may work in particylar cases.

Message 9 of 10
hgasty1001
in reply to: dynamicscope

Hi,

 

You can download ObjectArx 2010 from here: http://forums.autodesk.com/t5/Autodesk-ObjectARX/objectARX-for-autocad-2010/td-p/3423625

 

Gaston Nunez

Message 10 of 10
dynamicscope
in reply to: hgasty1001

Awesome.

 

Now, I will try with ObjectARX 2010.

 

Thank you all for your support.

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