急救,关于autocad用vba程序批量画图
我想用vba程序画一个外圆环,里面圆环里面画个十字!下面是我的程序,但是问题来了,程序运行,每次都是第一次运行出的圆环不是圆,而是八边形。之后,我把图删除了,再运行程序就是圆环了!不知道是什么问题!大家帮我瞧瞧!小白新手在此谢谢各位了!急用的!拜谢了!
Private Sub test()
Dim totalmun1 As Double
totalmun1 = 48841
Dim meshx(48841) As Double
Dim meshy(48841) As Double
Dim elsize(48841) As Double
Dim i As Double
Open "D:\5cheng5.TXT" For Input As #1
i = 1
While Not EOF(1)
Line Input #1, total
tempA = Split(total)
meshx(i) = Val(tempA(0))
meshy(i) = Val(tempA(1))
elsize(i) = Val(tempA(2))
i = i + 1
Wend
Close #1
Dim xmin As Double, xmax As Double, ymin As Double, ymax As Double, radiuin As Double, mm As Double, radiuout As Double, nn As Double
Dim pointsh(0 To 14) As Double
Dim pointsv(0 To 14) As Double
Dim pointi(0 To 2) As Double
Dim pointo(0 To 2) As Double
For i = 1 To 48841 Step 1
xmin = meshx(i) - elsize(i) / 2
xmax = meshx(i) + elsize(i) / 2
ymin = meshy(i) - 0.2 / 2
ymax = meshy(i) + 0.2 / 2
pointsh(0) = xmin: pointsh(1) = ymax: pointsh(2) = 0
pointsh(3) = xmin: pointsh(4) = ymin: pointsh(5) = 0
pointsh(6) = xmax: pointsh(7) = ymin: pointsh(8) = 0
pointsh(9) = xmax: pointsh(10) = ymax: pointsh(11) = 0
pointsh(12) = xmin: pointsh(13) = ymax: pointsh(14) = 0
Dim pline As AcadPolyline
Set pline = ThisDrawing.ModelSpace.AddPolyline(pointsh)
xmin = meshx(i) - 0.2 / 2
xmax = meshx(i) + 0.2 / 2
ymin = meshy(i) - elsize(i) / 2
ymax = meshy(i) + elsize(i) / 2
pointsv(0) = xmin: pointsv(1) = ymax: pointsv(2) = 0
pointsv(3) = xmin: pointsv(4) = ymin: pointsv(5) = 0
pointsv(6) = xmax: pointsv(7) = ymin: pointsv(8) = 0
pointsv(9) = xmax: pointsv(10) = ymax: pointsv(11) = 0
pointsv(12) = xmin: pointsv(13) = ymax: pointsv(14) = 0
Set pline = ThisDrawing.ModelSpace.AddPolyline(pointsv)
pointi(0) = meshx(i): pointi(1) = meshy(i): pointi(2) = 0
radiuin = elsize(i) / 2 + 0.2
mm = radiuin
Dim circleobj As AcadCircle
Set circleobj = ThisDrawing.ModelSpace.AddCircle(pointi, mm)
pointi(0) = meshx(i): pointi(1) = meshy(i): pointi(2) = 0
radiuout = elsize(i) / 2 + 0.2 + 0.15
nn = radiuout
Set circleobj = ThisDrawing.ModelSpace.AddCircle(pointi, nn)
Next i
End Sub
5cheng5的那个txt文件是数据存放的!是一个数组,3列的421行!
[解决办法]
用刷新命令刷新下就好了
[解决办法]
你画完了运行命令 regen
看看
[解决办法]
显示问题,除了刷新之外,把显示精度也调高一点
[解决办法]
这是AUTOCAD的刷新问题,3楼应该是对的。