.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Intersect with on 2011: 32 Bit. Win 7
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Good day to all.
I have a routine that uses the “intersectwith” function, from AutoCAD 2009.
I recently upgraded to 2011, and I get the following error:
IntersectWith(entityPointer As Autodesk.AutoCAD.DatabaseServices.Entity,
intersectType As Autodesk.AutoCAD.DatabaseServices.Intersect,
points As Autodesk.AutoCAD.Geometry.Point3dCollection,
thisGraphicSystemMarker As Integer,
otherGraphicSystemMarker As Integer)' is obsolete: 'Use the overload taking IntPtr instead.'.
Does anyone know how to fix this, or maybe where there is an example?
Cheers,
Martin. ![]()
Re: Intersect with on 2011: 32 Bit. Win 7
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have exactly the same problem. Anyone?
Re: Intersect with on 2011: 32 Bit. Win 7
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Man this was a while ago!
I got an fix in the form aof a function from the great Tony T.
Here it is:
Imports System.Runtime.CompilerServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports System.Reflection
Public Module PlatformCompatibilityExtensionMethods
Sub New()
Dim types1 As Type() = Nothing
Dim types2 As Type() = Nothing
If (IntPtr.Size > 4) Then
types1 = New Type() {GetType(Entity), GetType(Intersect), GetType(Point3dCollection), GetType(Long), GetType(Long)}
types2 = New Type() {GetType(Entity), GetType(Intersect), GetType(Plane), GetType(Point3dCollection), GetType(Long), GetType(Long)}
Else
types1 = New Type() {GetType(Entity), GetType(Intersect), GetType(Point3dCollection), GetType(Integer), GetType(Integer)}
types2 = New Type() {GetType(Entity), GetType(Intersect), GetType(Plane), GetType(Point3dCollection), GetType(Integer), GetType(Integer)}
End If
PlatformCompatibilityExtensionMethods.intersectWit
PlatformCompatibilityExtensionMethods.intersectWit
End Sub
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal points As Point3dCollection) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, points, CLng(0), CLng(0)}
Else
args = New Object() {other, intersectType, points, CInt(0), CInt(0)}
End If
PlatformCompatibilityExtensionMethods.intersectWit
Return (points.Count - start)
End Function
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal plane As Plane, ByVal points As Point3dCollection) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, plane, points, CLng(0), CLng(0)}
Else
args = New Object() {other, intersectType, plane, points, CInt(0), CInt(0)}
End If
PlatformCompatibilityExtensionMethods.intersectWit
Return (points.Count - start)
End Function
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal points As Point3dCollection, ByVal thisGsMarker As IntPtr, ByVal otherGsMarker As IntPtr) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, points, thisGsMarker.ToInt64, otherGsMarker.ToInt64}
Else
args = New Object() {other, intersectType, points, thisGsMarker.ToInt32, otherGsMarker.ToInt32}
End If
PlatformCompatibilityExtensionMethods.intersectWit
Return (points.Count - start)
End Function
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal plane As Plane, ByVal points As Point3dCollection, ByVal thisGsMarker As IntPtr, ByVal otherGsMarker As IntPtr) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, plane, points, thisGsMarker.ToInt64, otherGsMarker.ToInt64}
Else
args = New Object() {other, intersectType, plane, points, thisGsMarker.ToInt32, otherGsMarker.ToInt32}
End If
PlatformCompatibilityExtensionMethods.intersectWit
Return (points.Count - start)
End Function
Private intersectWithMethod1 As MethodInfo = Nothing
Private intersectWithMethod2 As MethodInfo = Nothing
End Module
Re: Intersect with on 2011: 32 Bit. Win 7
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Even easier is to replace the last two integer arguments with intptr. For those I usually use 0,0 - I find these two arguments are rarely used.
It worked for me to simply replace the last two parameters "0,0" with "New Intptr(), New IntPtr()"
Thanks to cadcamm99 in another post.
