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.Intersect
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
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?
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.
>> 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 -
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.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.