.NET

Reply
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 1 of 10 (262 Views)
Accepted Solution

IntersectWith gives MissingMethodException

262 Views, 9 Replies
06-11-2012 08:47 PM

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.

"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.

*Expert Elite*
Alfred.NESWADBA
Posts: 9,061
Registered: ‎06-29-2007
Message 2 of 10 (252 Views)

Re: IntersectWith gives MissingMethodException

06-12-2012 01:06 AM in reply to: dynamicscope

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
-------------------------------------------------------------------------
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 3 of 10 (248 Views)

Re: IntersectWith gives MissingMethodException

06-12-2012 02:34 AM in reply to: Alfred.NESWADBA

The entity are Polylines.

And I tried to cast it as Polyline.

 

No compile error.

*Expert Elite*
Alfred.NESWADBA
Posts: 9,061
Registered: ‎06-29-2007
Message 4 of 10 (247 Views)

Re: IntersectWith gives MissingMethodException

06-12-2012 02:38 AM in reply to: dynamicscope

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
-------------------------------------------------------------------------
Valued Mentor
gasty1001
Posts: 475
Registered: ‎04-11-2010
Message 5 of 10 (235 Views)

Re: IntersectWith gives MissingMethodException

06-12-2012 07:26 AM 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

Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 6 of 10 (211 Views)

Re: IntersectWith gives MissingMethodException

06-25-2012 01:37 AM in reply to: gasty1001

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

Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 7 of 10 (207 Views)

Re: IntersectWith gives MissingMethodException

06-25-2012 01:39 AM in reply to: Alfred.NESWADBA

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

 

*Expert Elite*
norman.yuan
Posts: 993
Registered: ‎04-27-2009
Message 8 of 10 (199 Views)

Re: IntersectWith gives MissingMethodException

06-25-2012 06:47 AM 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.

Valued Mentor
gasty1001
Posts: 475
Registered: ‎04-11-2010
Message 9 of 10 (194 Views)

Re: IntersectWith gives MissingMethodException

06-25-2012 07:25 AM 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

Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 10 of 10 (180 Views)

Re: IntersectWith gives MissingMethodException

06-26-2012 07:27 PM in reply to: gasty1001

Awesome.

 

Now, I will try with ObjectARX 2010.

 

Thank you all for your support.

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.