Vla-hittest
- 構文
- Section の場合
- (vla-hittest vla-object varPtHit pHit pSegmentIndex pPtOnSegment pSubItem)
- Table の場合
- (vla-hittest vla-object wpt wviewVec resultRowIndex resultColumnIndex)
- 機能
- 指定された位置の断面または表のセルでヒット テストを実行する。
- 引数
Section の場合
- vla-object … Section の VLAオブジェクト
- varPtHit … ヒット テストが実行される点。
- pHit … ブール型。指定された点が断面上にある場合は True。
- pSegmentIndex … ヒット点上または付近を通過する断面線上のセグメントのインデックス。
- pPtOnSegment … 断面オブジェクト ジオメトリ上の実際の点。このデータが不要な場合は、何も返さないことがある。
- pSubItem … AcSectionSubItem 列挙型。1 つまたは複数の値。このデータが不要な場合は、何も返さないことがある。
- acSectionSubItemBackLine
- acSectionSubItemBackLineBottom
- acSectionSubItemBackLineTop
- acSectionSubItemkNone
- acSectionSubItemSectionLine
- acSectionSubItemSectionLineBottom
- acSectionSubItemSectionLineTop
- acSectionSubItemVerticalLineBottom
- acSectionSubItemVerticalLineTop
Table の場合
- vla-object … Table の VLAオブジェクト
- wpt … 入力クリック点を指定する WCS の 3D 点。
- wviewVec … ヒット テストの視線方向を指定する WCS の 3D ベクトル。
- resultRowIndex … 選択されたセルの行インデックス。
- resultColumnIndex … 選択されたセルの列インデック。 ス
- 戻り値
- Section の場合
- nil
- Table の場合
- ブール型
- ヒット テストが表のセル内にある場合は :vlax-True
- ヒット テストが表のセル内にない場合は :vlax-False
- ブール型
- Table : この関数は、点と視線方向を指定してヒット テストを実行します。放射線によるセル ヒットが返されます。
- サンプル
(vl-load-com)
(defun c:hittest_example ( / acapp acdoc l1 l2 p1 p2 pt ss )
;; 指示した範囲にある表のセルを選択するサンプル
(defun _ss->lst ( ss / i lst )
(repeat (setq i (sslength ss))
(setq lst (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) lst))
))
(defun _hit-test ( pt lst )
(vl-some
(function
(lambda ( obj / row col )
(if (eq :vlax-true
(vla-hittest obj (vlax-3D-point (trans pt 1 0))
(vlax-3D-point (trans (getvar 'VIEWDIR) 1 0)) 'row 'col
))
(list obj row col)
)))
lst
)
)
(setq acapp (vlax-get-acad-object)
acdoc (vla-get-activedocument acapp)
)
(if (setq ss (ssget "_X" (list (cons 0 "ACAD_TABLE") (cons 410 (getvar 'CTAB)))))
(progn
(setq ss (_ss->lst ss))
(while
(and
(setq p1 (getpoint "\n最初のコーナーを指示 : "))
(not (setq l1 (_hit-test p1 ss)))
)
(princ "\nポイントは、表のセル内に存在しません。")
)
(if p1
(progn
(while
(and
(setq p2 (getcorner p1 "\n対角の点を指示 : "))
(not (setq l2 (_hit-test p2 (list (car l1)))))
)
(princ "\n無効な点")
)
(if p2
(vla-setsubselection (car l1) (cadr l1) (cadr l2) (caddr l1) (caddr l2))
))))
(princ "\nこの空間に表がありません。")
)
(princ)
)
関連事項