オブジェクトの各頂点の座標を指定します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.Coordinates
タイプ: 3DFace、3DPolyline 、Leader、LWPolyline、MLine、Point、PolyfaceMesh、PolygonMesh、Polyline、Solid、SubDMesh、SubDMeshVertex、Trace
このプロパティが適用されるオブジェクト。
読み込み専用: いいえ
タイプ: バリアント型(倍精度実数の配列)
点の配列。
3DFace オブジェクト: バリアントは、WCS の 3 つまたは 4 つの 3D 点の配列です。
3DPolyline オブジェクト: バリアントは、WCS の 3D 点の配列です。
Leader オブジェクト: バリアントは、WCS の 3D 点の配列です。
LightweightPolyline オブジェクト: バリアントは、OCS の 2D 点の配列です。
Mline オブジェクト: バリアントは、WCS の 3D 点の配列です。
Point オブジェクト: バリアントは、WCS の 3D 点の配列です。
PolyfaceMesh オブジェクト: バリアントは、WCS の 3D 点の配列です。
PolygonMesh オブジェクト: バリアントは、WCS の 3D 点の配列です。
Polyline オブジェクト: バリアントは、3D 点の配列です(X と Y 座標は OCS で、Z 座標は無視されます)。
Solid オブジェクト: バリアントは、WCS の 3 つまたは 4 つの 3D 点の配列です。
Trace オブジェクト: バリアントは、WCS の 4 つの 3D 点の配列です。
他のすべてのオブジェクト: バリアントは、WCS の 3D 点配列です。
このプロパティは、指定されたオブジェクトの座標を更新します。このプロパティ内の座標を処理するには、標準的な配列操作方法を使用してください。
PolyfaceMesh、PolygonMesh、Trace: このプロパティを使用してオブジェクト内の座標数を変更することはできません。既存の座標の位置のみを変更することができます。
3DPolyline、Polyline、PolygonMesh: 単純なポリライン(スプライン化またはカーブ フィットされていないポリライン)の場合、このプロパティは単純な頂点を指定します。スプライン化またはカーブ フィットしたポリラインの場合、制御点の頂点も含んでいます。
ポリラインの座標を設定するときに、オブジェクトが現在所有しているよりも少ない座標を指定すると、ポリラインは切り捨てられます。切り捨てられた頂点に適用されていたフィット点もすべて切り捨てられます。オブジェクトが現在所有しているよりも多い座標を指定すると、ポリラインに余分な頂点が追加されます。
Polyline および LightweightPolyline オブジェクトの OCS 座標は、TranslateCoordinates メソッドにより他の座標システムとの間で相互変換可能です。
VBA:
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)))
)