Active Contributor
48 Posts
0 Kudos
Registered: ‎09-08-2006
Post 1 of 4

VB.NET Intersectwith in R2010

1166 Views, 3 Replies
09-22-2011 01:42 PM



I trying to use the Intersectwith method to identify the crossing of a Ray with a closed linear object such as a circle, ellipse, polyline and spline and thereby determine if the point is inside the closed object.

objRay.IntersectWith(pPolyline, Intersect.OnBothOperands, cc, hIntersectionPoints, IntPtr.Zero, IntPtr.Zero)

' The line of code above is in a called function 'IsPointInPolyLine', but the program stops at the calling line below unless I comment this line out.

Dim bTest As Boolean = IsPointInPolyLine(myPLine, Pt)


However when I try to run the code I get a report that:


"System.MissingMethodException was unhandled by user code
  Message="Method not found: 'Void Autodesk.AutoCAD.DatabaseServices.Entity.IntersectWith(Autodesk.AutoCAD.DatabaseServices.Entity, Autodesk.AutoCAD.DatabaseServices.Intersect, Autodesk.AutoCAD.Geometry.Plane, Autodesk.AutoCAD.Geometry.Point3dCollection, Int64, Int64)'."
       at Laurie.Test.IsPointInPolyLine(Polyline2d pPolyline, Point3d pPoint)
       at Laurie.Test.TestBoolean() in D:\Documents\Visual Studio 2005\Projects\Laurie\Laurie\Test.vb:line 454
       at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
       at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
       at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
       at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()"


This is using Visual Studio 2005 on a 64 bit Win 7 O/S.


There have been previous reports of the this error, but despite searching the newsgroup and google I cannot find one wher a solution is actually offered.


A further point at issue, is that once I get the method to work, is that I'm unclear on what an "AutoCAD.Geometry.Plane" is and how one should be defined in order to use it in the "IntersectWith" method.


Using Auo-complete to create my code I had simply used a line:

"Dim objPlane as New Autodesk.AutoCAD.Geometry.Plane"


If I'm stuck with having to "roll my own" to get around this problem, it easy enough for Polylines and circles, but splines and ellipses would seem to be an issue.  Has anyone tried to do this?




Laurie Comerford


Laurie Comerford
*Expert Elite*
753 Posts
54 Kudos
Registered: ‎02-13-2008
Post 2 of 4

Re: VB.NET Intersectwith in R2010

09-22-2011 03:49 PM in reply to: laurie.comerford

First, I don't have a clue about the System.MissingMethodException...  That seems very strange indeed.


Second, without actually looking up a definition, just winging it, a plane is a conceptual unbounded flat surface, meaning it goes on infinitely in all directions.  Think of a the surface of a piece of very large glass.  Additionally a plane can be at any orientation in space.


That said, it is possible that you don't need one.  There is another overload of the IntersectWith Method that does not require a Plane in the Arguments.  Basically the method without the Plane argument is only looking for "Real" intersections whereas the one with the Plane argument will find Apparent intersections, meaning the lines don't actually touch, they just look like they do, because one is behind or in front of the other.


This is difficult to try and explain without using the word Plane.  Hopefully that is helpful.


As far as creating a Plane, if you do actually need to use it, there are a bunch of different constructors for the Plane object, so it depends on what information you have available.  I think you'll need to provide quite a bit more information about your particular circumstance for us to really help out with that.

Dave O.                                                                  Sig-Logos32.png
*Expert Elite*
9,836 Posts
1,219 Kudos
Registered: ‎06-29-2007
Post 3 of 4

Re: VB.NET Intersectwith in R2010

09-22-2011 11:09 PM in reply to: chiefbraincloud



>> System.MissingMethodException was unhandled by user code Message="Method not found

Just as one idea .... this message will appear when either the method-name is not found within the referenced lib's or if one or more parameters/parameter-types do not fit to the defined signatures of the method/function.


For AutoCAD2010x64 and Framework set to 3.5 and VS2010 I have the following function that works:

Curve.IntersectWith(IntersectWithCurve, ExtendType, RetPointColl, 0, 0)

However sorry, I have no choice (any more) to try that with VS2005 and Framework 2.0 (as I think VS2005 can't operate based on Framework 3.5?)

With AutoCAD 2011 (and later) I revised my code to

Curve.IntersectWith(IntersectWithCurve, ExtendType, RetPointColl, CType(0, System.IntPtr), CType(0, System.IntPtr))

where you wrote System.IntPtr.Zero ==> which I think should be the same .. of course you can try my version.


- alfred -

Ingenieur Studio HOLLAUS ... www.hollaus.at
Valued Contributor
95 Posts
1 Kudo
Registered: ‎11-15-2011
Post 4 of 4

Re: VB.NET Intersectwith in R2010

01-16-2012 01:19 PM in reply to: laurie.comerford

hi laurie


more or less all of the curve inheriting entities have an optional tolerance parameter for their intersect method(s), which can make all the difference; for even more control try out the geometry's curvecurveintersector.



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!