VLA メソッドで使用される 4 x 4 変換マトリックスに適した表現を返します。
サポートされているプラットフォーム: Windows のみ
(vlax-tmatrix lst)
タイプ: リスト
それぞれが 4 つの数値(変換マトリックスの要素を表す)を含む 4 つのリストの値。
タイプ: バリアント型
4×4 の変換マトリックスを表すセーフ配列タイプのバリアント型。
変換マトリックスを定義し、変数 tmatrix に値を割り当てます。
(setq tmatrix (vlax-tmatrix '((1 1 1 0) (1 2 3 0) (2 3 4 5) (2 9 8 3)))) #<variant 8197 ...>
vlax-safearray->list 関数を使用して、tmatrix の値をリスト形式で表示します。
(vlax-safearray->list (vlax-variant-value tmatrix)) ((1.0 1.0 1.0 0.0) (1.0 2.0 3.0 0.0) (2.0 3.0 4.0 5.0) (2.0 9.0 8.0 3.0))
次のコードは、線分を作成し、次に変換マトリックスを使用して 90 度回転します。
(defun Example_TransformBy ( / acadObject acadDocument mSpace lineObj
startPt endPt matList transMat)
(vl-load-com) ; Load ActiveX support
(setq acadObject (vlax-get-acad-object))
(setq acadDocument (vla-get-ActiveDocument acadObject))
(setq mSpace (vla-get-ModelSpace acadDocument))
;;; Create a line
(setq startPt (getpoint "Pick the start point"))
(setq endPt (vlax-3d-point (getpoint startPt "Pick the end point")))
(setq lineObj (vla-addline mSpace (vlax-3d-point startPt) endPt))
;;; Initialize the transMat variable with a transformation matrix
;;; that will rotate an object by 90 degrees about the point(0,0,0).
;;; Begin by Creating a list of four lists, each containing four
;;; numbers, representing transformation matrix elements.
(setq matList (list '(0 -1 0 0) '(1 0 0 0) '(0 0 1 0) '(0 0 0 1)))
;;; Use vlax-tmatrix to convert the list to a variant.
(setq transmat (vlax-tmatrix matlist))
;;; Transform the line using the defined transformation matrix
(vla-transformby lineObj transMat)
(vla-zoomall acadObject)
(princ "The line is transformed ")
(princ)
)