- 积分
- 244
- 明经币
- 个
- 注册时间
- 2003-1-9
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-2-26 21:09:00
|
显示全部楼层
可以做到你所要做的工作,给你一段例了。
Dim MyPline As Acad3DPolyline
' On Error Resume Next
point1 = ThisDrawing.Utility.GetPoint(, "Enter first point: ")
point2 = ThisDrawing.Utility.GetPoint(point1, "Enter Other corner: ")
ReDim vpoints(0 To 5) As Double
vpoints(0) = point1(0)
vpoints(1) = point1(1)
vpoints(2) = 0
vpoints(3) = point2(0)
vpoints(4) = point2(1)
vpoints(5) = 0
Set MyPline = ThisDrawing.ModelSpace.Add3DPoly(vpoints)
Dim sset As AcadSelectionSet 'Define sset as a SelectionSet object
Dim elem As Acad3DPolyline
Dim intersectPoint As Variant
'Set sset to a new selection set named SS2 (the name doesn't matter here)
Set sset = ThisDrawing.SelectionSets.Add("SS2")
'Call sset.Select(acSelectionSetWindow, point1, point2)
Call sset.Select(acSelectionSetCrossing, point1, point2)
Dim pointObj As AcadPoint
Dim location(0 To 2) As Double
For I = 1 To sset.count - 1
If sset.Item(I).ObjectName = "AcDb3dPolyline" Then
Set elem = sset.Item(I)
vpoints(2) = elem.Coordinates(2)
vpoints(5) = elem.Coordinates(2)
MyPline.Coordinates = vpoints
' MsgBox vpoints(5), , elem.Coordinates(2)
intersectPoint = MyPline.IntersectWith(elem, acExtendNone)
If VarType(intersectPoint) <> vbEmpty Then
。。。。。。。。此处加入你的程序,OK
End If
End If
Next I
Set sset = Nothing |
|