- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2007-12-20 14:34:00
|
显示全部楼层
本帖最后由 作者 于 2007-12-20 14:45:05 编辑
- Sub tt()
- On Error Resume Next
- Dim ObjLimits(5) As AcadEntity
- Dim p1, p2, pnt, p3, p4
- Dim dLen As Double
- Dim oLine1 As AcadLine, oLine2 As AcadLine
- Dim iStandandWidth As Double
- Dim i, j
- Dim iMaxLimitNum As Integer
- Dim dAngle As Double
- Dim m As Integer
-
- iStandandWidth = 550
-
- p1 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第一个点:") '抓取起始点
- p2 = ThisDrawing.Utility.GetPoint(p1, vbCrLf & "第二个点:") '抓取终止点,以确定总宽度
-
- iMaxLimitNum = 5
- For i = 0 To 5
- ThisDrawing.Utility.GetEntity ObjLimits(i), pnt, vbCrLf & " 请选取第" & i +1 & "个天花板长度边界(最多可选取6个):"
- If Err Then
- Err.Clear
- iMaxLimitNum = i - 1
- Exit For
- End If
- Next i
-
- Set oLine1 = ThisDrawing.ModelSpace.AddLine(p1, p2)
- dAngle = oLine1.Angle + 2 * Atn(1)
- dLen = oLine1.Length
- m = dLen \ iStandandWidth
- p3 = p1
-
- For i = 1 To m
- p3 = ThisDrawing.Utility.PolarPoint(p3, oLine1.Angle, iStandandWidth)
- p4 = ThisDrawing.Utility.PolarPoint(p3, dAngle, 50)
- Set oLine2 = ThisDrawing.ModelSpace.AddLine(p3, p4)
- For j = 0 To iMaxLimitNum
- p4 = oLine2.IntersectWith(ObjLimits(j), acExtendThisEntity)
- If UBound(p4) = 2 Then Exit For
- Next j
- oLine2.EndPoint = p4
- Next i
-
- oLine1.Delete
- End Sub
|
|