有人可以解释一下我哪里错了。
我可以在模型空间中创建一个圆形阴影区域,但我现在想直接对块执行相同的绘图。
一件奇怪的事情是,要做到这一点,由于某种原因,circleObj 需要是一个数组圆圈Obj(0 To 0) 作为 AcadEntity,否则它不会附加舱口。
这是我到目前为止编写的用于写入块的代码:我收到一个编译错误,说无法在我显示的位置分配给数组。有没有解决这个问题的方法。为什么它需要是一个数组?
- Sub MakeBlock()
- Dim blockObj As AcadBlock
- Dim PatternType As Long
- Dim bAssociativity As Boolean
- Dim insertionPnt(0 To 2) As Double
- insertionPnt(0) = 0
- insertionPnt(1) = 0
- insertionPnt(2) = 0
- With AcadDoc
- ' Define the block
- Set blockObj = .Blocks.Add(insertionPnt, "CircleBlock")
- ' Define the hatch
- PatternType = 0
- bAssociativity = True
- HatchPattern = "SOLID"
- ' Create the associative Hatch object in model space
- Set hatchObj = blockObj.AddHatch(PatternType, HatchPattern, bAssociativity)
- hatchObj.PatternScale = 1
- ' Create the outer boundary for the hatch. (a circle)
- Set circleObj = blockObj.AddCircle(Center, radius) '<=============I get the error on this line
- ' Append the outerboundary to the hatch object, and display the hatch
- hatchObj.AppendOuterLoop (circleObj)
- hatchObj.Evaluate
- 'Add Point
- Dim pointObj As AcadPoint
- Set pointObj = blockObj.AddPoint(insertionPnt)
- End With
- End Sub
jonesy: 添加代码标签
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |