关于autocad出现子过程或函数未定义的问题
各位大神好,以下是我的代码: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上面是我找到的一个代码,我想要实现的是功能是将图形数据转化为文本文件,不知道对没,如果错了,希望您能帮我改正下和要注意的地方,,非常感谢! 如果你只想要“图形数据转化为文本文件”,那不用编程了。直接存为dxf格式就行。全开放的cad,就是好。dxf是它提供的数据接口。你要用这些数据继续开发,只要了解dxf的格式就可以---老版讲二次开发的书上有 忘了说,dxf默认用cad打开,但你可以用“记事本”之类打开的,就是你说的文本文件了
页:
[1]