dcs是高版本的函数,低版本的只能使用ARX函数下面代码是根据Keen的C#代码改写的- Imports System.Runtime.InteropServices
- Imports Autodesk.AutoCAD.Geometry
- Imports Autodesk.AutoCAD.DatabaseServices
- Module UCStoDcs
- <DllImport("acad.exe", CallingConvention:=CallingConvention.Cdecl, EntryPoint:="acedTrans")> _
- Public Function acedTrans(ByVal point() As Double, ByVal fromRb As IntPtr, ByVal torb As IntPtr, ByVal disp As Int16, ByVal result() As Double) As Int16
- End Function
- Public Function UCStoDisplay(ByVal Pointlist As List(Of Point3d)) As List(Of Point3d)
- Dim rbFrom As ResultBuffer = New ResultBuffer(New TypedValue(5003, 0))
- Dim rbTo As ResultBuffer = New ResultBuffer(New TypedValue(5003, 2))
- Dim Mretlist As New List(Of Point3d)
- Dim Mdcs = New Double() {0, 0, 0}
- For Each pt As Point3d In Pointlist
- acedTrans(pt.ToArray(), rbFrom.UnmanagedObject, rbTo.UnmanagedObject, 0, Mdcs)
- Mretlist.Add(New Point3d(Mdcs))
- Next
- Return Mretlist
- End Function
- End Module
查查arx函数,各种转就出来了,新版的net尤其是13对这方面做 了很多,也很全面了。 |