오토캐드 vba를이용해서 사각형을 그리려고 하는데요 아래와 같은 코드로 사각형을 그렷는데 한점이 y축에서 떨어지지를 않습니다. 수정 부탁드립니다.
On Error Resume Next
Set acad = GetObject(, “AutoCAD.Application”)
If Err <> 0 Then
Err.Cls
Set acad = CreateObject(“AutoCAD.Application”)
End If
acad.Visible = True
Set aDoc = acad.ActiveDocument
Set adms = aDoc.ModelSpace
”/Dim points(0 To 9) As Double
”/Define the 2D polyline points
points(0) = 0: points(1) = 10
points(2) = 10: points(3) = 10
points(4) = 10: points(5) = 0
points(6) = 0: points(7) = 0
points(eight) = 0: points(9) = 10
‘ Create a light weight Polyline object in model space
Set plineObj = adms.AddLightWeightPolyline(points)
plineObj.updat
위와 같이 하면 그려지는데
points를
points(0) = 10: points(1) = 20
points(2) = 20: points(3) = 20
points(4) = 20: points(5) = 0
points(6) = 10: points(7) = 10
points(eight) = 10: points(9) = 20
같이 그리면 한점이 y에서 떨어지지를 않던라구요…. 왜그런건가요?
eight 라는 변수에 값을 부여한 것이 보이지 않습니다.
혹 points(eight) = 10 과 points(8) = 10 이 같다고 착각하시는 것은 아니신가요?
points(5) = 10으로 고치세요.