明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1035|回复: 5

VB新手请教个问题,为什么用轻便多义线画出来的矩形不能填充。

[复制链接]
发表于 2020-5-25 11:05:45 | 显示全部楼层 |阅读模式
    Dim HatchObj As AcadHatch
    Dim PatternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
    PatternType = 0
    PatternName = "ANGLE"
    bAssociativity = True
    Set HatchObj = acadapp.ActiveDocument.ModelSpace.AddHatch(PatternType, PatternName, bAssociativity)

  Dim Ld1 As AcadLWPolyline
  Dim Ld2 As AcadSolid

    syu(0) = 0: syu(1) = 0
   syu(2) = 200: syu(3) = 0
   syu(4) = 200: syu(5) = 200
   syu(6) = 0: syu(7) = 200
   syu(8) = 0: syu(9) = 0

    Set Ld1 = acaddoc.ModelSpace.AddLightWeightPolyline(syu)
    HatchObj.AppendOuterLoop (Ld1)
    HatchObj.Evaluate
    acadapp.ActiveDocument.Regen True

发表于 2020-5-25 14:24:51 | 显示全部楼层
    Dim AcadDoc As Object
    Dim HatchObj As AcadHatch
    Dim PatternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
   
    PatternType = 0
    PatternName = "ANGLE"
    bAssociativity = True
   
    Set AcadDoc = ThisDrawing
    Set HatchObj = AcadDoc.ModelSpace.AddHatch(PatternType, PatternName, bAssociativity, 0)
   
    Dim outerLoop(0 To 0) As AcadEntity
    Dim syu(0 To 9) As Double
    syu(0) = 0: syu(1) = 0
    syu(2) = 200: syu(3) = 0
    syu(4) = 200: syu(5) = 200
    syu(6) = 0: syu(7) = 200
    syu(8) = 0: syu(9) = 0

    Set outerLoop(0) = AcadDoc.ModelSpace.AddLightWeightPolyline(syu)
   
    HatchObj.AppendOuterLoop (outerLoop)
    HatchObj.Evaluate
    AcadDoc.Regen True
 楼主| 发表于 2020-5-25 16:51:28 | 显示全部楼层
yshf 发表于 2020-5-25 14:24
Dim AcadDoc As Object
    Dim HatchObj As AcadHatch
    Dim PatternName As String

谢谢您,再问一下,我如果想控制填充的颜色该添加什么语句呢?
发表于 2020-5-25 20:18:09 | 显示全部楼层
    Dim AcadDoc As Object
    Dim HatchObj As AcadHatch
    Dim PatternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean
   
    PatternType = 0
    PatternName = "ANGLE"
    bAssociativity = True
   
    Set AcadDoc = ThisDrawing
    Set HatchObj = AcadDoc.ModelSpace.AddHatch(PatternType, PatternName, bAssociativity, 0)
    HatchObj.color = 1 '红色
   
    Dim outerLoop(0 To 0) As AcadEntity
    Dim syu(0 To 9) As Double
    syu(0) = 0: syu(1) = 0
    syu(2) = 200: syu(3) = 0
    syu(4) = 200: syu(5) = 200
    syu(6) = 0: syu(7) = 200
    syu(8) = 0: syu(9) = 0

    Set outerLoop(0) = AcadDoc.ModelSpace.AddLightWeightPolyline(syu)
   
    HatchObj.AppendOuterLoop (outerLoop)
    HatchObj.Evaluate
    AcadDoc.Regen True
 楼主| 发表于 2020-5-25 21:08:11 | 显示全部楼层
yshf 发表于 2020-5-25 20:18
Dim AcadDoc As Object
    Dim HatchObj As AcadHatch
    Dim PatternName As String

非常感谢
 楼主| 发表于 2020-9-14 17:31:37 | 显示全部楼层
yshf 发表于 2020-5-25 20:18
Dim AcadDoc As Object
    Dim HatchObj As AcadHatch
    Dim PatternName As String

你好,想再次请教一下,如果想填充RGB颜色需要更改哪里,谢谢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-25 04:52 , Processed in 0.149532 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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