- UID
- 292
- 积分
- 26
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-11
- 最后登录
- 1970-1-1
|
发表于 2002-4-18 09:32:41
|
显示全部楼层
参考以下代码
- '因其中有自编函数,无法直接运行,不知能否参考
- Do While i < numberDd
- If i = numberDd - 1 And objPline.GetBulge(numberDd - 2) <> 0 Then
- Exit Do '如果多义线最后一段为圆弧,退出
- End If
-
- pubNumberJd = pubNumberJd + 1
- ReDim Preserve pubJd(0 To pubNumberJd - 1) '动态数组
- td = objPline.GetBulge(i) '顶点凸度
-
- With pubJd(pubNumberJd - 1)
- .bh = pubNumberJd
- If td = 0 Then '下一段不是圆弧
- .r = 0 '作为不设平曲线的转点
-
- '顶点坐标转换到UCS
- ptv = objPline.Coordinate(i)
- Mycad3DPointSet pt, ptv(0), ptv(1), objPline.Elevation
- ptv1 = objUtil.TranslateCoordinates(pt, acOCS, acWorld, False, objPline.Normal)
- ptv2 = objUtil.TranslateCoordinates(ptv1, acWorld, acUCS, False)
- MycadPointCopy .ptjd, ptv2
- i = i + 1
-
- Else '下一段是圆弧,该顶点为ZY点
-
- '计算ZY坐标
- ptv = objPline.Coordinate(i)
- Mycad3DPointSet pt, ptv(0), ptv(1), objPline.Elevation
- ptvzy = objUtil.TranslateCoordinates(pt, acOCS, acWorld, False, objPline.Normal) 'ZY点WCS坐标
- ptv = objUtil.TranslateCoordinates(ptvzy, acWorld, acUCS, False)
- MycadPointCopy .ptzy, ptv 'ZY点UCS坐标
-
- '计算YZ坐标
- ptv = objPline.Coordinate(i + 1)
- Mycad3DPointSet pt, ptv(0), ptv(1), objPline.Elevation
- ptvyz = objUtil.TranslateCoordinates(pt, acOCS, acWorld, False, objPline.Normal) 'YZ点WCS坐标
- ptv = objUtil.TranslateCoordinates(ptvyz, acWorld, acUCS, False)
- MycadPointCopy .ptyz, ptv 'YZ点UCS坐标
- '计算圆心坐标
- ptvo = Plavb_2PtdPto(ptvzy, ptvyz, td) '圆心WCS坐标
- ptv = objUtil.TranslateCoordinates(ptvo, acWorld, acUCS, False)
- MycadPointCopy .pto, ptv '圆心UCS坐标
- '计算曲线元素
- .r = MycadDistance(.pto, .ptzy)
- .l = Abs(4 * .r * Atn(td))
- .zj = .l / .r
- .t = .r * Tan(.zj / 2)
- .e = .r * (1 / Cos(.zj / 2) - 1)
- .j = 2 * .t - .l
-
- '计算交点坐标
- ang1 = objUtil.AngleFromXAxis(ptvo, ptvzy) + PI / 2
- ang2 = objUtil.AngleFromXAxis(ptvo, ptvyz) + PI / 2
- ptv1 = objUtil.PolarPoint(ptvzy, ang1, .r)
- ptv2 = objUtil.PolarPoint(ptvyz, ang2, .r)
- Set objLine1 = moSpace.AddLine(ptvzy, ptv1)
- Set objLine2 = moSpace.AddLine(ptvyz, ptv2)
- ptvjd = objLine1.IntersectWith(objLine2, acExtendBoth) '交点WCS坐标
- objLine1.Delete
- objLine2.Delete
- ptv3 = objUtil.TranslateCoordinates(ptvjd, acWorld, acUCS, False)
- MycadPointCopy .ptjd, ptv3 '交点UCS坐标
- '计算QZ坐标
- ang1 = objUtil.AngleFromXAxis(ptvo, ptvjd)
- ptvqz = objUtil.PolarPoint(ptvo, ang1, .r) 'QZ点WCS坐标
- ptv = objUtil.TranslateCoordinates(ptvqz, acWorld, acUCS, False)
- MycadPointCopy .ptqz, ptv 'QZ点UCS坐标
- If objPline.GetBulge(i + 1) <> 0 Then '下一段还是圆弧
- i = i + 1
- Else
- i = i + 2
- End If
- End If
- End With
- Loop
|
|