編集可能な Poly オブジェクトの異なるマテリアル ID 間でエッジを選択したいと考えています。
次の疑似コードは、実行可能な手段を記述したものです。
スクリプト:
macroScript SelMatIDEdges category: "MXS Help" ( --The ActionItem will only be enabled when a single object with --Editable_Poly base object is selected: on isEnabled return selection.count == 1 and classof selection[1].baseobject == Editable_Poly --When executed, on execute do ( theEP = selection[1].baseobject --get the base object of the selected object edgeSelArray = #() --init. an empty array to collect the edges eCount = polyOp.getNumEdges theEP --get the total number of edges for edge = 1 to eCount do --loop through all edges ( --get the faces sharing the current edge theFaces = (polyOp.getFacesUsingEdge theEP #(edge)) as array --if there are two faces sharing the edge, if theFaces.count == 2 do ( --compare their Material IDs. If different, collect the edge if polyOp.getFaceMatID theEP theFaces[1] != polyOp.getFaceMatID theEP theFaces[2] do append edgeSelArray edge )--end if )--end loop --After checking all edges, select the collected ones polyOp.setEdgeSelection theEP edgeSelArray max Modify Mode-- switch to modify panel modPanel.setCurrentObject theEP-- go to the BaseObject level subObjectLevel = 2--and go to Edge SubObject level to show the result )--end on execute )--end macroScript
ボックス プリミティブでは、6 個のマテリアル ID が 6 個 の側面に割り当てられています。この例では、 4x4x4 のセグメントを持つボックスが編集可能ポリゴンに変換され、上記のスクリプトが実行されました。