#ターゲットウェルド(片方の頂点へもう片方の頂点をウェルドする) #念のため元の形状をクリップボードに複製しておく #アンドゥする場合は「図面をクリックしないで」クリップボードに複製した形状をペーストしてください #(先に図面をクリックするとペースト位置がずれます) if xshade.scene().is_modify_mode==True and xshade.scene().selection_mode==2 and xshade.scene().active_shape().type==7: xshade.scene().active_shape().copy() #まずは選択してる頂点の数が二点のみかどうか(二点以外は実行しない) if xshade.scene().active_shape().number_of_active_control_points==2: #総頂点数をカウントして変数totalverに入れる totalver=xshade.scene().active_shape().total_number_of_control_points #選択している二頂点の頂点番号をtyouten1,tyouten2に格納 i=0 tyoutensuu=0 while(i0: if tyoutensuu==0: tyouten1=i tyoutensuu=1 else: tyouten2=i i=i+1 #選択番号順に変更 if xshade.scene().active_shape().vertex(tyouten1).active_order>xshade.scene().active_shape().vertex(tyouten2).active_order: tempt=tyouten2 tyouten2=tyouten1 tyouten1=tempt #tyouten2の座標をtyouten1にあわせる xshade.scene().active_shape().vertex(tyouten2).position= xshade.scene().active_shape().vertex(tyouten1).position #重複した頂点の削除 xshade.scene().active_shape().cleanup_redundant_vertices() #クリップボードに形状をコピーした場合、以下の「編集モードに入る」を実行しないと編集モードでなくなってしまいます xshade.scene().enter_modify_mode()