Vla-swaporder
- 構文
- (vla-swaporder vla-object obj1 obj2 ')
- 機能
- 2 つのオブジェクトの表示順序の位置を入れ替える。
- 引数
-
- vla-object … SortentsTable の VLAオブジェクト
- obj1 … Entity の VLAオブジェクト
- obj2 … Entity の VLAオブジェクト
- 戻り値
- nil
- サンプル
(vl-load-com)
(defun c:Example_SortentsTable()
;; SortentsTable オブジェクトを作成して表示順序を変えるサンプル
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq modelSpace (vla-get-ModelSpace doc))
;; 線の太さとフルカラー表示
(vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
(setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
(vla-SetRGB MyColorObjOne 80 100 244)
;; ポリライン作成
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
(vlax-safearray-fill points '(4 4 0
3 5 0
6 20 0
)
)
(setq plineObj (vla-AddPolyline modelSpace points))
(vla-put-Lineweight plineObj acLnWt211)
(vla-SetRGB MyColorObjOne 90 110 150)
(vla-put-TrueColor plineObj MyColorObjOne)
;; 線分作成
(setq startPoint (vlax-3d-point 5 13 0)
endPoint (vlax-3d-point 5 27 0))
(setq lineObj (vla-AddLine modelSpace startPoint endPoint))
(vla-put-Lineweight lineObj acLnWt211)
(vla-SetRGB MyColorObjOne 50 80 230)
(vla-put-TrueColor lineObj MyColorObjOne)
;; 円作成
(setq centerPoint (vlax-3d-point 10 15 0)
radius 5)
(setq circleObj (vla-AddCircle modelSpace centerPoint radius))
(vla-put-Lineweight circleObj acLnWt211)
(vla-SetRGB MyColorObjOne 60 200 220)
(vla-put-TrueColor circleObj MyColorObjOne)
(vla-ZoomAll acadObj)
(vla-Update acadObj)
;; 拡張ディクショナリを取得し、必要に応じて、SortentsTableオブジェクトを追加
(setq eDictionary (vla-GetExtensionDictionary modelSpace))
;; 取得失敗の防止
(setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))
(if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
;; SortentsTable オブジェクトが無かったら1個追加
(setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
)
(setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
(vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
(vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
(vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))
(setq varObject circleObj)
(setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
(vlax-safearray-put-element arr 0 varObject)
;; 円オブジェクトを背面に移動
(vla-MoveToBottom sentityObj arr)
(vla-Update acadObj)
(alert "\n円を背面にしました")
(vla-swaporder lineObj circleObj)
(alert "\n円と線分の表示順を入れ替えました")
(vlax-release-object MyColorObjOne)
)
関連事項