指定对象中每个顶点的坐标。 支持的平台:仅窗口 签名工 务 局: object.Coordinates 属性值只读:不 类型:变体(双打数组) 点的数组。 3DFace 对象:变体是 WCS 中三个或四个 3D 点的数组。 3DPolyline 对象:变体是 WCS 中的 3D 点数组。 引线对象:变体是 WCS 中的 3D 点数组。 轻量级折线对象:变体是 OCS 中的 2D 点数组。 Mline 对象:变体是 WCS 中的 3D 点数组。 点对象:变体是 WCS 中 3D 点的数组。 PolyfaceMesh 对象:变体是 WCS 中的 3D 点数组。 多边形网格对象:变体是 WCS 中的 3D 点数组。 折线对象:变体是 3D 点数组:X和Y坐标以 OCS 为单位;将忽略 Z坐标。 实体对象:变体是 WCS 中三个或四个 3D 点的数组。 跟踪对象:变体是 WCS 中四个 3D 点的数组。 所有其他对象:变体是 WCS 中的 3D 点数组。 言论此属性将更新指定对象的坐标。使用标准数组处理技术来处理此属性中包含的坐标。 多边形网格、多边形网格和跟踪:不能使用此属性更改对象中的坐标数。只能更改现有坐标的位置。 3DPolyline、折线和多边形网格:对于简单折线(非样条曲线或曲线拟合),此属性指定简单顶点。对于样条曲线或曲线拟合折线,此属性指定控制点顶点。 设置折线的坐标时,如果提供的坐标少于对象当前拥有的坐标,则折线将被截断。应用于截断顶点的任何拟合点也将被截断。如果提供的坐标多于对象当前拥有的坐标,则额外的折点将追加到折线。 对象的OCS坐标可以使用该方法与其他坐标系相互转换。PolylineLightweightPolylineTranslateCoordinates 例子工 务 局: Sub Example_Coordinates() ' This example creates a polyline. It then uses the Coordinates ' property to return all the coordinates in the polyline. It then ' resets one of the vertices using the Coordinates property. Dim plineObj As AcadPolyline ' Create Polyline Dim points(5) As Double points(0) = 3: points(1) = 7: points(2) = 0 points(3) = 9: points(4) = 2: points(5) = 0 Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points) ThisDrawing.Regen True ' Return all the coordinates of the polyline Dim retCoord As Variant retCoord = plineObj.Coordinates ' Display current coordinates for the second vertex MsgBox "The current coordinates of the second vertex are: " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example" ' Modify the coordinate of the second vertex to (5,5,0). Note that in ' case of a lightweight Polyline, indices will be different because the points are 2D only. points(3) = 5 points(4) = 5 points(5) = 0 plineObj.Coordinates = points ' Update display ThisDrawing.Regen True MsgBox "The new coordinates have been set to " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example" End Sub Visual LISP: (vl-load-com) (defun c:Example_Coordinates() ;; This example creates a polyline. It then uses the Coordinates ;; property to return all the coordinates in the polyline. It then ;; resets one of the vertices using the Coordinates property. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create Polyline (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5))) (vlax-safearray-fill points '(3 7 0 9 2 0 ) ) (setq modelSpace (vla-get-ModelSpace doc)) (setq plineObj (vla-AddPolyline modelSpace points)) (vla-ZoomAll acadObj) ;; Return all the coordinates of the polyline (setq retCoord (vla-get-Coordinates plineObj)) ;; Display current coordinates for the second vertex (alert (strcat "The current coordinates of the second vertex are: " (rtos (vlax-safearray-get-element points 3) 2) ", " (rtos (vlax-safearray-get-element points 4) 2) ", " (rtos (vlax-safearray-get-element points 5) 2))) ;; Modify the coordinate of the second vertex to (5,5,0). Note that in ;; case of a lightweight Polyline, indices will be different because the points are 2D only. (vlax-safearray-put-element points 3 5) (vlax-safearray-put-element points 4 5) (vlax-safearray-put-element points 5 0) (vla-put-Coordinates plineObj points) ;; Update display (vla-Regen doc :vlax-true) (alert (strcat "The new coordinates have been set to: " (rtos (vlax-safearray-get-element points 3) 2) ", " (rtos (vlax-safearray-get-element points 4) 2) ", " (rtos (vlax-safearray-get-element points 5) 2))) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:49
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.