如何获取CAD多段线各顶点坐标
如何获取CAD各顶点坐标呢?本人一直在试,一直未获成功,心情异常沉重,肯请各位老兄给予指点!!
论坛上有这个方面的资料,建议查询一下
给你个可输出polygon多段线节点的小程序(适用于AutoCAD 2004)
polygon多段线节点输出.rar 语法
object.Coordinate(index)
object
, , , , , , ,
使用该属性的对象。
Coordinate
Variant[变体] (三元素或两元素双精度数组); 可读写
指定顶点的 X、 Y 和 Z 坐标的数组。
LightweightPolyline 对象:变体为两元素,它表示 OCS 坐标系统下的 X 和 Y 坐标。
Polyline 对象:: 变体为三元素,它表示 OCS 坐标系统下的 X 和 Y 坐标。而 Z 坐标在变体中有预留但被忽略。
所有其它对象:变体为三元素,它表示 WCS 坐标系统下的 X 和 Y 坐标;而 Z 坐标在活动 UCS 上默认为 0。
Index
Integer[整数]
在顶点数组中你所要设置或查询的顶点的索引号。顶点数组的基数为 0。
说明
该属性将替换指定对象任何存在的顶点。使用标准的数组处理技术来处理包含在该属性中的值。
3DPolyline, Polyline, PolygonMesh: 对于简单的多段线 (非样条化或曲线拟合),该属性指的是一般的顶点。对于样条化或曲线拟合的多段线,该属性指的是控制点顶点。
Polyline 和 LightweightPolyline 对象的 OCS 坐标可以使用方法与其它坐标系统进行转换。
©2000-2006 版权所有 不得复制传播
该拷贝仅用于乐筑天下网站在线服务使用,如需要购买,请联系本站管理员:mccad,邮件地址:
Sub Example_Coordinate()
' This example creates a polyline in model space and
' queries and changes the coordinate in the first index position.
Dim plineObj As AcadPolyline
Dim points(0 To 14) As Double
' Define the 2D polyline points
points(0) = 1: points(1) = 1: points(2) = 0
points(3) = 1: points(4) = 2: points(5) = 0
points(6) = 2: points(7) = 2: points(8) = 0
points(9) = 3: points(10) = 2: points(11) = 0
points(12) = 4: points(13) = 4: points(14) = 0
' Create a lightweight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ZoomAll
' Find the coordinate in the first index position
Dim coord As Variant
coord = plineObj.Coordinate(0)
MsgBox "The coordinate in the first index position of the polyline is: " & coord(0) & ", " _
& coord(1) & ", " & coord(2)
' Change the coordinate
coord(0) = coord(0) + 1
plineObj.Coordinate(0) = coord
plineObj.Update
' Query the new coordinate
coord = plineObj.Coordinate(0)
MsgBox "The coordinate in the first index position of the polyline is now: " & coord(0) & ", " _
& coord(1) & ", " & coord(2)
End Sub
乐筑天下中文通道里搜Coordinate
谢谢啊 一定要注意这两种多段线的定义.
Dim pl As AcadPolyline
Dim ppl As AcadLWPolyline
谢谢哈! 这个有实用价值。下来学习了。 多谢了,正需要这样的东西。
页:
[1]