- UID
- 29897
- 积分
- 517
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-2-17
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
提取pline坐标时应注意lwpline的坐标系变换问题
lwpline的coordinate属性中只有x,y两个坐标值
需要从Elevation 属性中提取高度信息,从Normal 属性中提取法向信息,然后使用坐标变换函数TranslateCoordinates 将lwpline的顶点坐标从ocs换到ucs
这是cad帮助文件中的说明:
To translate a point on a Polyline or LightWeightPolyline object from OCS to WCS:
1. Get the X and Y coordinates of the OCS point from the Coordinate or Coordinates property.
2. Get the Z coordinate of the OCS point from the Elevation property.
3. Get the normal for the polyline from the Normal property.
4. Call TranslateCoordinates using the X, Y, Z coordinates and the Normal.
这是CadAssis中提取pline节点坐标的关键代码:
For nn = 0 To CountVertex '将AddPolyline坐标转化为x,y,z习惯数组格式
Dim pntVertexTemp() As Double
pntVertexTemp = returnObj.Coordinate(nn)
If returnObj.ObjectName = "AcDbPolyline" Then '二维多义线
pntVertexTemp = ArrayConvert2to3(returnObj.Coordinate(nn)) '二维坐标转三维
pntVertexTemp(2) = returnObj.Elevation
pointUCS = acadUtil.TranslateCoordinates(pntVertexTemp, acOCS, acUCS, False, returnObj.Normal) 'Wcs->Ucs
Else
pointUCS = acadUtil.TranslateCoordinates(pntVertexTemp, acWorld, acUCS, False) 'Wcs->Ucs
End If
plinePnt(nn, 0) = pointUCS(0): fptsPlineVertexUcs(nn * 3 + 0) = pointUCS(0)
plinePnt(nn, 1) = pointUCS(1): fptsPlineVertexUcs(nn * 3 + 1) = pointUCS(1)
plinePnt(nn, 2) = pointUCS(2): fptsPlineVertexUcs(nn * 3 + 2) = pointUCS(2)
Next nn |
|