import copy #外形面選択 #選択している面を囲む面だけを選択状態にします #動作条件 #選択形状がポリゴンメッシュ #編集モードに入っている #面編集モード #面を一つ以上選択している #shade1301に対応 dousasuru=0 xscene=xshade.scene() ashape=xscene.active_shape() #まずは動作条件を満たしているかチェック if xshade.scene().active_shape().type==7: if xshade.scene().selection_mode==0 and xscene.is_modify_mode==True: aflist=[] for i in range(ashape.number_of_faces): if ashape.face(i).active==True: aflist.append(i) if len(aflist)>0:dousasuru=1 if dousasuru>0: #上位パートに変換がかかっているなら動作しない if xshade.scene().active_shape().local_to_world_matrix!=((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0)): dousasuru=0 dialog=xshade.create_dialog() dialog.append_push_button('上位パートに変換がかかっているため') dialog.append_push_button('スクリプトが実行できません') dialog.ask('エラー') if dousasuru==1: #ここに初期値 renzoku=1 while (renzoku==1): #元の形状をコピーして下に置いておく xscene.copy() xscene.paste() xscene.select_sister() xscene.enter_modify_mode() #選択している面の頂点リストを作成し、その頂点を有する面を選択状態にする plist=[] for i in aflist: tempvlist=ashape.face(i).vertex_indices plist+=tempvlist for i in range(ashape.number_of_faces): tempvlist=ashape.face(i).vertex_indices hantei=0 for gg in tempvlist: if hantei==1:break for hh in plist: if gg==hh: hantei=1 break if hantei==1: ashape.face(i).active=True #元の面の選択解除 for i in aflist: ashape.face(i).active=False xscene.exit_modify_mode() xscene.enter_modify_mode() #ダイアログ表示と元に戻すか聞く dialog2=xshade.create_dialog() dialog2.append_push_button('処理を確定しますか?') xshade.idle(120) xshade.scene().update_figure_window() kekka2=dialog2.ask('外形面選択') if kekka2==False: idou=0 if ashape.has_sis==True:idou=1 xscene.clear() if idou==1:xscene.select_brother() xscene.enter_modify_mode() ashape=xscene.active_shape() renzoku=0 else: renzoku=0 xscene.select_brother() xscene.clear() xscene.enter_modify_mode()