如题,editor.SetCurrentView函数,不能修改视图的着色模式。代码如下:
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.Runtime
<Assembly: CommandClass(GetType(Study))>
Public Class Study
<CommandMethod(“test”, CommandFlags.Modal)>
Public Sub Test()
Dim db As Database = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database
Dim ed As Editor = ZwSoft.ZwCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim tm As TransactionManager = db.TransactionManager
Dim myT As Transaction = tm.StartTransaction()
Try
Dim vsDictionary As DBDictionary = CType(myT.GetObject(db.VisualStyleDictionaryId, OpenMode.ForRead), DBDictionary)
Dim oView As ViewTableRecord = ed.GetCurrentView
oView.VisualStyleId = vsDictionary.GetAt(“Flat”)
ed.SetCurrentView(oView)
Catch ex As Exception
myT.Commit()
End Try
End Sub
End Class
同样的代码在AutoCAD上是可以的。
如何解决?有替代方法吗?