|
发表于 2003-3-28 10:19:00
|
显示全部楼层
Sub Example_AddHatch()
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim bAssociativity As Boolean
' Define the hatch
patternName = "ANSI31"
PatternType = 0
bAssociativity = True
' Create the associative Hatch object in model space
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)
' 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 = 10
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
hatchObj.HightLight True
'◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎
SendCommand "_explode" & vbCr '这句需要用户来选择对象
'◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎◎
End Sub
Sub Example_SendCommand()
'运行该方法之前,手动选中由 Example_AddHatch() 添加的hatch
ThisDrawing.SendCommand "_explode" & vbCr
'执行结束 完全达到 分解的效果
End Su |
|