tiancao1001 于 2009-11-24 04:50 PM 发表评论: |
这是个例子,天正对象(很到属性我们不知道,程序也不好访问,只能通过list名称查看,但是程序怎么得到list查询的结果呢?)
Public Class tdb <CommandMethod("tdb")> _ Public Sub TZBH() On Error Resume Next Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Dim acEditor As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor '过滤条件 Dim acTypValAr(0) As TypedValue acTypValAr.SetValue(New TypedValue(DxfCode.Start, "TCH_OPENING"), 0) 'acTypValAr.SetValue(New TypedValue(DxfCode.Start, "BlockReference"), 0) Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr) Dim acSSPrompt As PromptSelectionResult = acEditor.GetSelection(acSelFtr) Dim acSSet As SelectionSet = acSSPrompt.Value Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() Dim I As Long For I = 0 To acSSet.Count - 1 Dim e As Entity = acTrans.GetObject(acSSet.Item(I).ObjectId, OpenMode.ForRead) Application.SetSystemVariable("LOGFILEMODE", 1) 'Log开 e.List() '就是AutoCAD的list命令 Application.SetSystemVariable("LOGFILEMODE", 0) 'Log关 Dim LogPath As String = Application.GetSystemVariable("LOGFILENAME") acDoc.Editor.WriteMessage(vbCrLf + LogPath) MsgBox(LogPath) Dim DataString As Object DataString = ReadFile(LogPath) Dim J As Int16 = UBound(DataString) Dim N As Int16 Dim Str As String = "" For N = J - 13 To J Str = Str & vbCrLf & DataString(N) Next MsgBox(Str) Next acTrans.Commit() End Using MsgBox(Err.Source) End Sub Function ReadFile(ByVal Path As String) As Object Dim DataString() As String = Nothing Dim F As System.IO.StreamReader F = FileIO.FileSystem.OpenTextFileReader(Path, System.Text.Encoding.Default) Dim I As Long Do While Not F.EndOfStream ReDim Preserve DataString(I) DataString(I) = F.ReadLine I = I + 1 Loop ReadFile = DataString End Function End Class 输入tdb命令后,选择天正的窗户,得到list查询的结果显示在msgbox中。 |
|
查看所评论的日志:请教 vb.net 向cad发送一个命令后,得到cad执行命令后在命令行输出的内容?? |
tiancao1001 于 2009-11-12 03:16 PM 发表评论: |
Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen() 这句好像在两个模式下也都不好用,我试过了。 |
|
查看所评论的日志:.Net 使AutoCAD主窗口获得焦点 |
tiancao1001 于 2009-11-04 10:25 AM 发表评论: |
是这样的:对于AutoCAD 2010,Application类中封装了BeginDoubleClick事件,AutoCAD 2009及以下,是没这个事件的。所以想写个双击事件是不可能的了,但是现在很多用人不用高版本的AutoCAD。 |
|
查看所评论的日志:在VB.NET 中注册基于 COM 的事件 |
tiancao1001 于 2009-11-03 08:19 AM 发表评论: |
|
查看所评论的日志:决定将工具箱用VB.net从写 |
tiancao1001 于 2009-10-30 09:01 AM 发表评论: |
|
查看所评论的日志:CAD VBA 实现图纸的快速打印 |
tiancao1001 于 2009-10-30 09:01 AM 发表评论: |
|
查看所评论的日志:VBA 调用AutoCAD “选择颜色对话框" |
tiancao1001 于 2009-10-28 11:28 AM 发表评论: |
上面的代码不是就是调用cad选择颜色对话框的吗?? |
|
查看所评论的日志:VBA 调用AutoCAD “选择颜色对话框" |
tiancao1001 于 2009-09-30 11:05 AM 发表评论: |
以后再再也不用天正了,新版本的对象竟然不支持vba访问了。 |
|
查看所评论的日志:天正8.0全系列注册机 |