- UID
- 784604
- 积分
- 105
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2019-2-27
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
看到VB.NET可以定义HatchLoop类型数据,但在VB6.0中总是提示用户类型未定义,有没有大神知道哦怎么解决下面是代码:
Option Explicit
Private Sub Command1_Click()
Dim acadApp As AcadApplication
Set acadApp = GetObject(, "AutoCAD.Application")
Dim hatchObj As AcadHatch
Dim patternName As String
Dim PatternType As Long
Dim bAssociativity As Boolean
'定义填充
PatternType = 0
patternName = "SOLID"
bAssociativity = True '填充图案与边界相关联
'创建填充对象
Set hatchObj = acadApp.ActiveDocument.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)
'创建两个同心圆作为填充边界
Dim OuterLoop(0 To 0) As AcadEntity
Dim InnerLoop(0 To 0) As AcadEntity
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 1: center(1) = 2: center(2) = 0
radius = 20
Set OuterLoop(0) = acadApp.ActiveDocument.ModelSpace.AddCircle(center, radius)
Set InnerLoop(0) = acadApp.ActiveDocument.ModelSpace.AddCircle(center, radius / 2)
'向填充对象添加填充边界
hatchObj.AppendOuterLoop (OuterLoop)
hatchObj.AppendInnerLoop (InnerLoop)
'用Evaluate方法进行求值并显示填充
hatchObj.Evaluate
acadApp.ActiveDocument.Regen True
ZoomExtents
'输出填充的边界数
Print (hatchObj.NumberOfLoops)
'判断边界的类型
Dim loopNum As Integer
loopNum = hatchObj.NumberOfLoops
Dim num As Integer
num = 0
Dim hatLoop As HatchLoop
hatLoop = Nothing
Do While num < loopNum
Set hatLoop = hatchObj.GetLoopAt(num)
If hatLoop.IsPolyline Then
Print (1)
Else
Print (2)
End If
Loop
End Sub
标红的那句有问题
|
|