小弟用VB2008开发CAD2008,现在想通过后期绑定使其不依赖CAD版本,之前剖面线的程序:
Dim outerloop(0 To 3) As Acadentity......
Dim hatchobj As AcadHatch
Dim patternName As String
Dim patternType As Integer
Dim Associativity As Boolean
patternName = "ANSI31"
patternType = 1
Associativity = True
hatchobj = acadDoc.ModelSpace.AddHatch(patternType, patternName, Associativity)
hatchobj.AppendOuterLoop(outerloop)
上述程序可以成功运行,后来更改 Dim outerloop(0 To 3) As object
Dim hatchobj As object其他不变,运行时,hatchobj.AppendOuterLoop(outerloop)一直有问题,提示对象数组无效,求各位高手帮帮忙,小弟菜鸟~不胜感激。。。。
Dim hatch() As AcadHatch
dim pline() AcadEntity'多个
ReDim hatch(UBound(pline))
Dim outerLoop(0 To 0) As AcadEntity
For i = 0 To UBound(pline)
Set hatch(i) = ThisDrawing.ModelSpace.AddHatch(acPreDefinedGradient, "LINEAR", True, acGradientObject)
hatch(i).GradientColor1 = color
hatch(i).GradientColor2 = color
Set outerLoop(0) = pline(i)
hatch(i).AppendOuterLoop (outerLoop)
hatch(i).Evaluate
Next i