CAD .net MoveToBottom绘图次序置底


    ''' <summary>
    ''' 绘图次序置底
    ''' </summary>
    ''' <param name="doc"></param>
    ''' <param name="entities"></param>
    Public Shared Sub DrawOrderToBottom(doc As Document, entities As List(Of Entity))
        Dim collection As New ObjectIdCollection()
        Dim i As Integer = 0
        While i < entities.Count
            collection.Add(entities(i).ObjectId)
            i += 1
        End While
        Dim db As Database = doc.Database
        Dim ed As Editor = doc.Editor
        Try
            Using doc.LockDocument()
                Using tr As Transaction = db.TransactionManager.StartTransaction()
                    Dim bt As BlockTable = CType(tr.GetObject(db.BlockTableId, OpenMode.ForWrite, False), BlockTable)
                    Dim btr As BlockTableRecord = CType(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False), BlockTableRecord)
                    Dim orderTable As DrawOrderTable = TryCast(tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite), DrawOrderTable)
                    orderTable.MoveToBottom(collection)
                    tr.Commit()
                End Using
            End Using
        Catch exc As Autodesk.AutoCAD.Runtime.Exception
        End Try
    End Sub



使用当前标高替换 Z 值



欢迎关注微信公众账号ByCAD