- 积分
- 254
- 明经币
- 个
- 注册时间
- 2007-4-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2014-5-11 17:09:09
|
显示全部楼层
改成这样的:
Sub a()
Dim OBJ As AcadEntity '定义对象入口变量
Dim i As Integer '定义对象绘制顺序变量
i = 0 '初始化对象顺序变量
Open "d:\1.txt" For Append As #1
For Each OBJ In ThisDrawing.ModelSpace '遍历每个AutoCAD模型
If OBJ.ObjectName = "AcDbLine" Then '判断AutoCAD对象是不是直线
startp = OBJ.StartPoint '获取直线起点坐标
endp = OBJ.EndPoint '获取直线端点坐标
Print #1, "(" + CStr(i) + "," + CStr(startp(0)) + "," + CStr(startp(1)) + "," + CStr(endp(0)) + "," + CStr(endp(1)) + ");"
'输出直线端点坐标和该对象的绘制顺序
End If
If OBJ.ObjectName = "AcDbArc" Then '判断AutoCAD对象是不是圆弧
StartAngle = OBJ.StartAngle '获取圆弧起始角度
EndAngle = OBJ.EndAngle '获取圆弧终止角度
Radius = OBJ.Radius '获取圆弧半径
startp = OBJ.StartPoint '获取圆弧起点坐标
endp = OBJ.EndPoint '获取圆弧终点坐标
CenterPoint = OBJ.Center '获取圆弧中心坐标
Print #1, "(" + CStr(i) + "," + CStr(CenterPoint(0)) + "," + CStr(CenterPoint(1)) + "," + CStr(Radius) + "," + CStr(startp(0)) + "," + CStr(startp(1)) + "," + CStr(endp(0)) + "," + CStr(endp(1)) + "," + CStr(StartAngle) + "," + CStr(EndAngle - StartAngle) + ");"
'组合数据,输出圆弧的关键点数据
End If
i = i + 1 '对象绘制顺序序号加1
'Dim a As String
'a = "End If" '这里应该是输出上面要找到的数据,但我不知道怎么搞了
'Print #1, a
Next
Close #1
End Sub |
|