指定されたオブジェクトを囲むボックスの 2 点を取得します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.GetBoundingBox MinPoint, MaxPoint
タイプ: すべての図形オブジェクト、AttributeReference、Dimension
このメソッドが適用されるオブジェクト。
アクセス: 出力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
オブジェクトの境界ボックスの最小点を指定する 3D WCS 座標。
アクセス: 出力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
オブジェクトの境界ボックスの最大点を指定する 3D WCS 座標。
戻り値はありません。
各コーナーは、WCS の X、Y、Z 軸に平行なエッジを持つボックスの WCS 座標で返されます。
VBA:
Sub Example_GetBoundingBox() ' This example creates a line in model space. It then finds the ' bounding box for the line and displays the corners of the box. Dim startPoint(0 To 2) As Double Dim endPoint(0 To 2) As Double Dim lineObj As AcadLine ' Create the Line object in model space startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0# endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0# Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint) ZoomAll Dim minExt As Variant Dim maxExt As Variant ' Return the bounding box for the line and return the minimum ' and maximum extents of the box in the minExt and maxExt variables. lineObj.GetBoundingBox minExt, maxExt ' Print the min and max extents MsgBox "The extents of the bounding box for the line are:" & vbCrLf _ & "Min Extent: " & minExt(0) & "," & minExt(1) & "," & minExt(2) _ & vbCrLf & "Max Extent: " & maxExt(0) & "," & maxExt(1) & "," & maxExt(2), vbInformation, "GetBoundingBox Example" End Sub
Visual LISP:
(vl-load-com) (defun c:Example_GetBoundingBox() ;; This example creates a line in model space. It then finds the ;; bounding box for the line and displays the corners of the box. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create the Line object in model space (setq startPoint (vlax-3D-point 2 2 0)) (setq endPoint (vlax-3D-point 4 4 0)) (setq modelSpace (vla-get-ModelSpace doc)) (setq lineObj (vla-AddLine modelSpace startPoint endPoint)) (vla-ZoomAll acadObj) ;; Return the bounding box for the line and return the minimum ;; and maximum extents of the box in the minExt and maxExt variables. (vla-GetBoundingBox lineObj 'minExt 'maxExt) (setq minExt (vlax-safearray->list minExt) maxExt (vlax-safearray->list maxExt)) ;; Print the min and max extents (alert (strcat "The extents of the bounding box for the line are:" "\nMin Extent: " (rtos (nth 0 minExt) 2) "," (rtos (nth 1 minExt) 2) "," (rtos (nth 2 minExt) 2) "\nMax Extent: " (rtos (nth 0 maxExt) 2) "," (rtos (nth 1 maxExt) 2) "," (rtos (nth 2 maxExt) 2))) )