@maxz wrote:
I would appreciate if somebody can take a look at my script and tell me why
BooleanDifference
is not working .
My script:#Cut slots from tabs, Max Zuijdendorp, November 2016
import rhinoscriptsyntax as rs # Check if a layer "Cutting Blocks" exists, if not, add it. if not rs.IsLayer("Cutting Blocks"): rs.AddLayer("Cutting Blocks", (0,255,255)) # Make "Cutting Blocks" the current layer rs.CurrentLayer("Cutting Blocks") input0 =() blocks =() def cutblocks(): rs.Command ("_ExtractSrf _Pause") rs.Command ("_ExtrudeSrf _BothSides=yes _Solid=yes _DeleteInput=yes 10") blocks = rs.LastCreatedObjects() rs.SelectObjects (blocks) def cutting(): input0 = rs.GetObject("Pick a polysurface to cut from", rs.filter.polysurface) if input0: input1=blocks rs.BooleanDifference(input0,input1) rs.SelectObjects (input0) more=6 while(more==6): cutblocks() more=rs.MessageBox("Do you want to cut more slots?",buttons=3) if (more==7): cutting()
This is the test file I am using: Cutting_test.3dm (59.4 KB)
The objective is to cut matching holes in the top polysurface for the tabs of the lower polysurface. I want to allow for slight differences in the height of the tabs, so the method I have chosen is to copy the top surfaces of the tabs, extrude those to a set distance (10 mm) on both sides, and subtract the resulting polysurfaces from the top polysurface.
I have inserted twoSelectObjects
statements to check visually if all the correct GUI's are being created, which seems to be the case. Nevertheless, I cannot see any holes appearing in the top polysurface.
I have spent the best part of today to get it to work (and re-learning Rhino Python again..), so I would really appreciate some help.Max.
Posts: 6
Participants: 3