• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set slice plane by 3 vertexs
#1
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 .
)
  Reply


Messages In This Thread
How to set slice plane by 3 vertexs - by AEI - 12-20-2017, 06:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)