- 积分
- 5987
- 明经币
- 个
- 注册时间
- 2006-7-8
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
现在多数人是将实体数据存到mdb或xls中。
mdb 文件太大,字段需要定义。xls文件受到65535行的限制。txt文件比较少。下面一例就是将实体数据存到 txt中。- Sub ll()
- Dim LineData As AcadLine, ArcData As AcadArc
- Close #1
- Open "D:\ls.txt" For Output As #1
-
- Write #1, "m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8", "m9", "m10", "m11", "m12"
-
- Dim Ent As AcadEntity
-
- For Each Ent In ThisDrawing.ModelSpace
- m1 = Ent.ObjectName
- m2 = Ent.ObjectID
- Select Case Ent.ObjectName
- Case "AcDbLine"
- Set LineData = Ent
- With LineData
- m3 = Round(.StartPoint(0), 5)
- m4 = Round(.StartPoint(1), 5)
- m5 = Round(.StartPoint(2), 5)
- m6 = Round(.EndPoint(0), 5)
- m7 = Round(.EndPoint(1), 5)
- m8 = Round(.EndPoint(2), 5)
-
- End With
- End Select
- Write #1, m1, m2, m3, m4, m6, m7, m8
-
- Next Ent
- Ent.GetBoundingBox
- Close #1
- End Sub
在AutoCAD的VBA中照样可以用SQL语句,相当方便。
|
|