Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Colors
Public Class Class1
<CommandMethod("com1")> _
Sub proj1()
Dim db As Database
Dim bt As BlockTable
Dim ms As BlockTableRecord
Dim myDWG As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = myDWG.Editor
Using trans As Transaction = myDWG.TransactionManager.StartTransaction()
db = Application.DocumentManager.MdiActiveDocument.Database
bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead)
ms = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
For Each entidadeId As ObjectId In ms
Dim entidade As Entity = trans.GetObject(entidadeId, OpenMode.ForWrite)
With entidade
.ColorIndex = 256
.Linetype = "ByLayer"
.LineWeight = LineWeight.ByLayer
End With
Next
trans.Commit()
End Using
End Sub
End Class
Sem comentários:
Enviar um comentário