找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 364|回复: 1

[求助]:如何在VB中实现图案填充?

[复制链接]
发表于 2004-8-30 15:46:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
Dim acadApp As Object, acadDoc As Object, moSpace As Object
Dim TriSin  As Object,Pts(5) As Double

On Error Resume Next
Set acadApp = GetObject(, "AutoCAD.Application")
If err Then
    err.Clear
    Set acadApp = CreateObject("AutoCAD.Application")
    If err Then
          Exit Sub
    End If
End If
acadApp.Visible = True
Set acadDoc = acadApp.ActiveDocument
Set moSpace = acadDoc.ModelSpace
Pts(0) = Pt1: Pts(1) = Pt2
Pts(2) = Pt1 + hight: Pts(3) = Pt2 + hight
Pts(4) = Pt1 - hight: Pts(5) = Pts(3)
Set TriSin = moSpace.AddLightWeightPolyline(Pts)
TriSin.closed = True
如何填充三角形TriSin 呢?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2004-8-30 15:52:31 | 显示全部楼层
看看帮助里的例子
Sub Example_AddHatch()
    ' This example creates an associative gradient hatch in model space.
   
    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
   
    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True
   
    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.16")
    Call col1.SetRGB(255, 0, 0)
    Call col2.SetRGB(0, 255, 0)
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2
   
    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
   
    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
End Sub
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-11-23 09:54 , Processed in 0.264164 second(s), 33 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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