[求助]怎样将Block里面的Hatch改变颜色?
主要问题是怎样能够浏览block里面的东西,然后挑选出HatchPublic Function ChangeHatchColorInBlock(Block As AcadBlock)<BR>Dim elem As Object<BR> ?
For each elem in Block //这是会产生错误的。
?<BR> <BR>End Function If elem.ObjectName = "AcDbHatch" Then elem.Color = acRed '你所要的颜色 这个我知道,只是不知道block这个类里面的东西怎么访问,它的层次结构是怎么样的?block里面陷套的block里面的东西又怎么访问? Sub ChgColor()
Dim pnt, ent As AcadEntity
ThisDrawing.Utility.GetEntity ent, pnt
ChangColor ent.Name
Regen acActiveViewport
End Sub
Sub ChangeColor(BlockName As String)
Dim ent As AcadEntity
For Each ent In ThisDrawing.Blocks(BlockName)
Debug.Print ent.ObjectName
If ent.ObjectName = "AcDbHatch" Then ent.color = acRed
If ent.ObjectName = "AcDbBlockReference" Then ChangColor ent.Name
Next
End Sub
页:
[1]