選択された頂点の座標値を知りたい (スクリプト)

選択された頂点の座標値を表示するには、以下のコードをスクリプトウィンドウで実行します。

shape = xshade.scene().active_shape()

if len(shape.active_vertex_indices) > 0:
  # 選択頂点番号
  vIndex = shape.active_vertex_indices[0]
  
  # 選択頂点の座標を表示
  if shape.type == 7:  # ポリゴンメッシュの場合
    print shape.vertex(vIndex).position
  
  if shape.type == 4:  # 線形状の場合
    print shape.control_point(vIndex).position

このコードは選択された形状(線形状またはポリゴンメッシュ)の、
一番はじめに選択されている頂点の座標値を、メッセージウィンドウに表示します。

この記事のURLとタイトルをコピーする
Translate »