明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2412|回复: 0

[例程]图形填充

[复制链接]
发表于 2002-5-28 21:16:00 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 23:59 , Processed in 0.160878 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表