AEI script

Full Version: How to set slice plane by 3 vertexs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
if $selection.count == 1 and classof $ == Editable_Poly and ($.EditablePoly.getSelection #Vertex as array ).count == 3 do --Get ready,only when selection is a polygon object and 3 vertexs ware selected .
    vertsel = $.EditablePoly.getSelection #Vertex as array  --save the vertex selection 
    vertsel[1] = polyop.getvert $ vertsel[1]  --save the vertext postion 
    vertsel[2] = polyop.getvert $ vertsel[2]
    vertsel[3] = polyop.getvert $ vertsel[3]
    vertsel[2] = vertsel[1] - vertsel[2]  -- get a vector 
    vertsel[3] = vertsel[1] - vertsel[3]  -- get another vector 
    if not polyop.inSlicePlaneMode $ do $.toggleCommandMode #SlicePlane  --set the sliceplanemode on
    polyop.setsliceplane $ (ray vertsel[1] (cross vertsel[2] vertsel[3])) 10  --set the sliceplane to target ,as the 2 vectors above defind a plane which was the target plane , but we can't set directly ,so we get cross product from them ,as the ray function could gave us the target , and it need two parameter , one is a vertex which on the target plane , another is the normal vector of the target plane which is the cross product .