VB.net Code:
Imports System
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.ApplicationServices
Module Example
<DllImport("acad.exe")> Public Function acedCmd(ByVal vlist As IntPtr) As Integer
End Function
Public Sub Command(ByVal args() As Object)
Dim rb As ResultBuffer
Dim val As Object
For Each val In args
rb = New ResultBuffer()
If (val Is Nothing) Then
rb.Add(New TypedValue(CInt(LispDataType.Text), ""))
Else
Select Case val.GetType().Name
Case "String"
rb.Add(New TypedValue(CInt(LispDataType.Text), val))
Exit Select
Case "Point2d"
rb.Add(New TypedValue(CInt(LispDataType.Point2d), val))
Exit Select
Case "Point3d"
rb.Add(New TypedValue(CInt(LispDataType.Point3d), val))
Exit Select
Case "ObjectId"
rb.Add(New TypedValue(CInt(LispDataType.ObjectId), val))
Exit Select
Case "SelectionSet"
rb.Add(New TypedValue(CInt(LispDataType.SelectionSet), val))
Exit Select
Case "Double"
rb.Add(New TypedValue(CInt(LispDataType.Double), val))
Exit Select
Case "Int16"
rb.Add(New TypedValue(CInt(LispDataType.Int16), val))
Exit Select
Case "Int32"
rb.Add(New TypedValue(CInt(LispDataType.Int32), val))
Exit Select
Case "TypedValue"
rb.Add(val)
Exit Select
End Select
End If
Try
acedCmd(rb.UnmanagedObject)
Catch
Finally
rb.Dispose()
End Try
Next val
End Sub
End Module <p>在theswamp看过你的贴了:)</p><p>总结下,解决方案如下</p><p>1、引用acmgdinternal.dll</p><p>Autodesk.AutoCAD.Internal.Utils.TextScr()</p><p>Autodesk.AutoCAD.Internal.Utils.GraphScr()</p><p>2、P/Invoke</p><p> <br/> private static extern int acedTextScr();</p><p> <br/> private static extern int acedGraphScr();</p><p> public static bool DisplayTextScreen<br/> {<br/> set <br/> {<br/> if (value)<br/> acedTextScr();<br/> else<br/> acedGraphScr();<br/> }<br/> }</p><p><br/> <br/> public static void tt1()<br/> {<br/> DisplayTextScreen = true;<br/> }</p><p> <br/> public static void tt2()<br/> {<br/> DisplayTextScreen = false;<br/> }</p><p></p><p>3、AutoCad2010最简单</p><p>Application.DisplayTextScreen = true;</p>
页:
1
[2]