フェンス内の図形を選択し、それらを選択セットに追加します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.SelectByPolygon Mode, PointsList [, FilterType, FilterData]
タイプ: SelectionSet
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: AcSelect 列挙型
アクセス: 入力のみ
タイプ: バリアント型(3 要素の倍精度浮動小数点数型配列)
選択フェンスを指定する 3D WCS 座標の配列。
アクセス: 入力のみ; オプション
タイプ: バリアント型
使用するフィルタのタイプを指定する DXF グループ コード。
アクセス: 入力のみ; オプション
タイプ: バリアント型
フィルタをオンにする値。
戻り値はありません。
次の選択モードを使用できます。
このメソッドは、フィルタ機能をサポートしています。
選択モードのオプションについての詳細は、Select、SelectAtPoint、および SelectOnScreen メソッドを参照してください。
VBA:
Sub Example_SelectByPolygon()
' This example adds objects to a selection set by defining a polygon.
Dim ssetObj As AcadSelectionSet
Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET2")
' Add to the selection set all the objects that lie within a fence
Dim mode As Integer
Dim pointsArray(0 To 11) As Double
mode = acSelectionSetFence
pointsArray(0) = 28.2: pointsArray(1) = 17.2: pointsArray(2) = 0
pointsArray(3) = -5: pointsArray(4) = 13: pointsArray(5) = 0
pointsArray(6) = -3.3: pointsArray(7) = -3.6: pointsArray(8) = 0
pointsArray(9) = 28: pointsArray(10) = -3: pointsArray(11) = 0
ssetObj.SelectByPolygon mode, pointsArray
' Add to the selection set all the Circles that lie within fence
ReDim gpCode(0 To 1) As Integer
gpCode(0) = 0
gpCode(1) = 10
Dim pnt(0 To 2) As Double
pnt(0) = 3: pnt(1) = 6: pnt(2) = 0
ReDim dataValue(0 To 1) As Variant
dataValue(0) = "Circle"
dataValue(1) = pnt
Dim groupCode As Variant, dataCode As Variant
groupCode = gpCode
dataCode = dataValue
ssetObj.SelectByPolygon mode, pointsArray, groupCode, dataCode
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_SelectByPolygon()
;; This example adds objects to a selection set by defining a polygon.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SSET2"))
;; Add to the selection set all the objects that lie within a fence
(setq mode acSelectionSetFence)
(setq pointsArray (vlax-make-safearray vlax-vbDouble '(0 . 11)))
(vlax-safearray-fill pointsArray '(28.2 17.2 0
-5 13 0
-3.3 -3.6 0
28 -3 0
)
)
(vla-SelectByPolygon ssetObj mode pointsArray)
(alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
(vla-Clear ssetObj)
;; Add to the selection set all the Circles that lie within fence and at point 3,6
(setq gpCode (vlax-make-safearray vlax-vbInteger '(0 . 1)))
(vlax-safearray-put-element gpCode 0 0)
(vlax-safearray-put-element gpCode 1 10)
(setq pnt (vlax-3d-point 3 6 0))
(setq dataValue (vlax-make-safearray vlax-vbVariant '(0 . 1)))
(vlax-safearray-put-element dataValue 0 "Circle")
(vlax-safearray-put-element dataValue 1 pnt)
(vla-SelectByPolygon ssetObj mode pointsArray gpCode dataValue)
(alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
(vla-Delete ssetObj)
)