您好,请您帮助我转换此代码(后期绑定),以便它可以在不引用特定acx的情况下适用于大多数版本的AutoCAD。tlb?
- Sub ExportLine()
- Dim acadApp As Object
- Dim acadDoc As Object
- Dim currentSelectionSet As Object
- Dim ent As Object
- Dim oLine As Object
- Dim n As Long
- Dim intGroupCode(0) As Integer
- Dim varDataCode(0) As Variant
- Set acadApp = GetObject(, "AutoCAD.Application")
- Set acadDoc = acadApp.ActiveDocument
- intGroupCode(0) = 0
- varDataCode(0) = "Line"
- acadDoc.SelectionSets.Item("Lne").Delete
- Set currentSelectionSet = acadDoc.SelectionSets.Add("Lne")
-
- n = 1
- For Each ent In currentSelectionSet
-
-
- If TypeOf ent Is AcadLine Then 'This line is a problem
-
- Set oLine = ent
- Cells(n, 1) = oLine.StartPoint(0)
- Cells(n, 2) = oLine.StartPoint(1)
- Cells(n, 3) = oLine.StartPoint(2)
- Cells(n, 4) = oLine.EndPoint(0)
- Cells(n, 5) = oLine.EndPoint(1)
- Cells(n, 6) = oLine.EndPoint(2)
-
- End If
-
- Next
- Set acadApp = Nothing
- Set acadDoc = Nothing
- MsgBox "Done"
- Exit Sub
|