Center プロパティ(ActiveX)

円弧、円、楕円、ビュー、ビューポートの中心を指定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.Center
object

タイプ: ArcCircleDimRadialLargeEllipsePViewportViewViewport

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: バリアント型(倍精度実数の 3 要素配列)

オブジェクトの中心を表す 3D 座標。既定の中心は(0,0,0)です。

Viewport、View: ビューポート、ビュー オブジェクトの場合、その中心は 2D 座標です。

注意



VBA:

Sub Example_Center()
    
    Dim circObj As AcadCircle
    Dim currCenterPt(0 To 2) As Double
    Dim newCenterPt(0 To 2) As Double
    Dim radius As Double
    
    ' Define the initial center point and radius for the circle
    currCenterPt(0) = 20: currCenterPt(1) = 30: currCenterPt(2) = 0
    radius = 3
    
    ' Create the circle in model space
    Set circObj = ThisDrawing.ModelSpace.AddCircle(currCenterPt, radius)
    ZoomAll
    MsgBox "The center point of the circle is " & currCenterPt(0) & ", " & currCenterPt(1) & ", " & currCenterPt(2), vbInformation, "Center Example"

    ' Change the center point of the circle
    newCenterPt(0) = 25: newCenterPt(1) = 25: newCenterPt(2) = 0
    circObj.center = newCenterPt
    circObj.Update
    
    ' Query the results of the new center position
    ' Notice the output from the center property is a variant
    Dim centerPoint As Variant
    centerPoint = circObj.center
    MsgBox "The center point of the circle is " & centerPoint(0) & ", " & centerPoint(1) & ", " & centerPoint(2), vbInformation, "Center Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Center()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Define the initial center point and radius for the circle
    (setq currCenterPt (vlax-3d-point 20 30 0)
          radius 3)
    
    ;; Create the circle in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circObj (vla-AddCircle modelSpace currCenterPt radius))
    (vla-ZoomAll acadObj)
    (alert (strcat "The center point of the circle is"
		   "\n" (rtos (nth 0 (vlax-safearray->list (vlax-variant-value currCenterPt)))) ", "
		   (rtos (nth 1 (vlax-safearray->list (vlax-variant-value currCenterPt)))) ", "
		   (rtos (nth 2 (vlax-safearray->list (vlax-variant-value currCenterPt))))
           )
    )

    ;; Change the center point of the circle
    (setq newCenterPt (vlax-3d-point 25 25 0))
    (vla-put-Center circObj newCenterPt)
    (vla-Update circObj)
    
    ;; Query the results of the new center position
    ;; Notice the output from the center property is a variant
    (setq centerPoint (vlax-variant-value (vla-get-Center circObj)))
    (alert (strcat "The center point of the circle is"
		   "\n" (rtos (nth 0 (vlax-safearray->list centerPoint))) ", "
		   (rtos (nth 1 (vlax-safearray->list centerPoint))) ", "
		   (rtos (nth 2 (vlax-safearray->list centerPoint)))
           )
    )
)