- 积分
- 2943
- 明经币
- 个
- 注册时间
- 2003-11-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2005-6-5 22:50:00
|
显示全部楼层
第一个
pt2(0) = 1200: pt1(1) = 1000: pt1(2) = 0
看楼主的意思应该是
pt2(0) = 1200: pt2(1) = 1000: pt2(2) = 0
还有这个
rotationangle = ThisDrawing.Utility.GetAngle(, "指定角度") angle = angle * 3.1415926 / 180 tbangle = Round(angle, 2) rotationangle = tbangle
后面三句删除。
getangle出来的是弧度,不需要转换了。
而且转换的也不对
还有
linobj.Rotate basepoint, rotationangle
应为
lineobj.Rotate basepoint, rotationangle
改正后可以运行
Sub rotateline() Dim lineobj As AcadLine Dim pt1(0 To 2) As Double, pt2(0 To 2) As Double pt1(0) = 1000: pt1(1) = 1000: pt1(2) = 0 pt2(0) = 1200: pt2(1) = 1000: pt2(2) = 0 Set lineobj = ThisDrawing.ModelSpace.AddLine(pt1, pt2) ZoomAll Dim basepoint(0 To 2) As Double Dim rotationangle As Double Dim angle As Double basepoint(0) = pt1(0): basepoint(1) = pt1(1): basepoint(2) = pt1(2) rotationangle = ThisDrawing.Utility.GetAngle(, "指定角度") 'angle = angle * 3.1415926 / 180 'tbangle = Round(angle, 2) 'rotationangle = tbangle lineobj.Rotate basepoint, rotationangle lineobj.Update End Sub
建议,变量定义中应有大写字母,输入时只用小写输入,程序会自动把相应字母变成大写,这样可以知道变量是否输入错误,如lineobj最好定义成lineObj |
|