各位大神好,以下是我的代码:Sub AcDbLine()Dim OBJ As AcadEntity '定义对象入口变量Dim I As Integer '定义对象绘制顺序变量I = 0 '初始化对象顺序变量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(star - tp(1)) + "," + CStr(endp(0)) + "," + CStr(endp(1)) + ");" '输出直线端点坐标和该对象的绘制顺序End IfIf OBJ.ObjectName = "AcDbArc" Then '判断AutoCAD 对象是不是直线StartAngle = OBJ.StartAngle '获取圆弧起始角度EndAngle = OBJ.EndAngle '获取圆弧终止角度Radius = OBJ.Radius '获取圆弧半径startp = OBJ.StartPoint '获取圆弧起点坐标endp = OBJ.EndPoint '获取圆弧终点坐标CenterPoint = OBJ.Center '获取圆弧中心坐标Print #2, "(" + 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 '对象绘制顺序序号加1NextEnd Sub上面是我找到的一个代码,我想要实现的是功能是将图形数据转化为文本文件,不知道对没,如果错了,希望您能帮我改正下和要注意的地方,,非常感谢! |
|
|
|
|
|
共 2 个关于本帖的回复 最后回复于 2014-4-28 14:42