你好
我需要在多个关卡数块,我可以用5个关卡。
也许有人可以帮忙,有什么建议吗?
顺致敬意,
- <Autodesk.AutoCAD.Runtime.CommandMethod("Bcount")>
- Public Sub Blockcount()
- Dim myExcel As Object = CreateObject("Excel.Application")
- myExcel.Visible = True
- Dim myWB As Object = myExcel.Workbooks.Add
- Dim myDesktop As String = My.Computer.FileSystem.SpecialDirectories.Desktop
- Dim curRow As Integer = 1
- Dim doc As Document = Application.DocumentManager.MdiActiveDocument
- Dim db As Database = doc.Database
- Dim ed As Editor = doc.Editor
- Using trx As Transaction = db.TransactionManager.StartTransaction()
- Dim bt As BlockTable = trx.GetObject(db.BlockTableId, OpenMode.ForRead)
- For Each btrId As ObjectId In bt
- Dim btr As BlockTableRecord = trx.GetObject(btrId, OpenMode.ForRead)
- Dim refIds As ObjectIdCollection = btr.GetBlockReferenceIds(False, False)
- If btr.Name.Contains("Y") Then
- If Not btr.IsLayout Then
- myExcel.ActiveSheet.Cells(curRow, "F").value = refIds.Count.ToString
- myExcel.ActiveSheet.Cells(curRow, "A").value = DateTime.Now.ToString
- myExcel.ActiveSheet.Cells(curRow, "B").value = doc.Window.Text
- myExcel.ActiveSheet.Cells(curRow, "C").value = "Price"
- myExcel.ActiveSheet.Cells(curRow, "D").value = btr.Name
- myExcel.ActiveSheet.Cells(curRow, "E").value = btr.Comments
- curRow += 1
- End If
- End If
- Next
- db.Dispose()
- End Using
- myWB.SaveAs(IO.Path.Combine(myDesktop, "Furnitura.xlsx"))
- myWB = Nothing
- myExcel = Nothing
- End Sub
|