[例程]图形填充
Public Sub CreateFillSolid()Dim solidObj As AcadSolid '声明填充实体对象变量
'声明4个顶点数组变量
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
Dim point3(0 To 2) As Double
Dim point4(0 To 2) As Double
'保证FILLMODE系统变量的值为1
If ThisDrawing.GetVariable("FILLMODE") = 0 Then
ThisDrawing.SetVariable "FILLMODE", 1
End If
'定义填充一个矩形区域的顶点组
point1(0) = 0#: point1(1) = 0#: point1(2) = 0#
point2(0) = 125#: point2(1) = 0#: point2(2) = 0#
point3(0) = 0#: point3(1) = 128#: point3(2) = 0#
point4(0) = 125#: point4(1) = 128#: point4(2) = 0#
'在模型空间创建填充实体
Set solidObj = ThisDrawing.ModelSpace.AddSolid _
(point1, point2, point3, point4)
'定义填充一对三角形区域的顶点组
point1(0) = 130#: point1(1) = 0#: point1(2) = 0#
point2(0) = 255#: point2(1) = 0#: point2(2) = 0#
point3(0) = 255#: point3(1) = 128#: point3(2) = 0#
point4(0) = 130#: point4(1) = 128#: point4(2) = 0#
'在模型空间创建填充实体
Set solidObj = ThisDrawing.ModelSpace.AddSolid _
(point1, point2, point3, point4)
'定义填充一个三角形区域的顶点组
point1(0) = 0#: point1(1) = 148#: point1(2) = 0#
point2(0) = 125#: point2(1) = 148#: point2(2) = 0#
point3(0) = 125#: point3(1) = 276#: point3(2) = 0#
point4(0) = 125#: point4(1) = 276#: point4(2) = 0#
'在模型空间创建填充实体
Set solidObj = ThisDrawing.ModelSpace.AddSolid _
(point1, point2, point3, point4)
ZoomAll
solidObj.Color = acGreen '将最后的实体设成绿色
End Sub
页:
[1]