Help with my Draw on face and extrude script


#1

Ok heres the problem sometimes my script doesn’t perform the operations for subtracting ect…

heres the script

import rhinoscriptsyntax as rs
import scriptcontext
import System
import select
opt = ("Subtract", "No", "Yes"),("Union", "No", "Yes"),("Split", "No", "Yes"),("Intersect", "No", "Yes")
Chk = rs.GetBoolean("Select",opt,(True,False,False,False))
#object to be subtracted from
print Chk
Subtract = rs.GetObject("Select Object to manipulate",False,True,None,False)
rs.Sleep(300)
rs.Command("CPlane _Surface")
rs.Command("Polygon")
Curve = rs.Command("SelLast")
rs.Sleep(300)
rs.Command("ExtrudeCrv")
subtracty = rs.FirstObject()
box = rs.BoundingBox(Subtract,rs.ViewCPlane(),False)
rs.Sleep(300)
print "check to see if objects intersect"
#some times it skips this part completely on certain sides/faces idk why
if Chk == (True,False,False,False):
    rs.BooleanDifference(Subtract,subtracty,delete_input=True)
    print "Subtracting"
if Chk ==(False,True,False,False):
    rs.BooleanUnion((Subtract,subtracty),False)   
    print "Unioning"
if Chk ==(False,False,True,False):
    rs.SplitBrep(Subtract,subtracty,False) 
    print "Spliting"
if Chk ==(False,False,False,True):
    rs.BooleanIntersection(Subtract,subtracty,False) 
    print "Intersecting"

rs.UnselectAllObjects()
print "BOoooyya"

I created this because I love the way sketchups pushpull tool worked and to speed up my flow


#2

Nvm I Found why it was skipping those steps
needed to just change the bracketing of my Chk From () to []

if Chk == [True,False,False,False]:
    rs.BooleanDifference(Subtract,subtracty,delete_input=True)
    print "Subtracting"
if Chk ==[False,True,False,False]:
    rs.BooleanUnion((Subtract,subtracty),False)   
    print "Unioning"
if Chk ==[False,False,True,False]:
    rs.SplitBrep(Subtract,subtracty,False) 
    print "Spliting"
if Chk ==[False,False,False,True]:
    rs.BooleanIntersection(Subtract,subtracty,False) 
    print "Intersecting"

#3
import rhinoscriptsyntax as rs
import scriptcontext
import System
import select
opt = ("Subtract", "No", "Yes"),("Union", "No", "Yes"),("Split", "No", "Yes"),("Intersect", "No", "Yes")
Chk = rs.GetBoolean("Select",opt,(True,False,False,False))
#object to be subtracted from
print Chk
Subtract = rs.GetObject("Select Object to manipulate",False,True,None,False)
rs.Sleep(300)
rs.Command("CPlane _Surface")
rs.Command("Polyline")
Curve = rs.Command("SelLast")
rs.Sleep(300)
rs.Command("ExtrudeCrv")
subtracty = rs.FirstObject()
box = rs.BoundingBox(Subtract,rs.ViewCPlane(),False)
rs.Sleep(300)
print "check to see if objects intersect"
#some times it skips this part completely on certain sides/faces idk why
if Chk == [True,False,False,False]:
    rs.BooleanDifference(Subtract,subtracty,delete_input=True)
    print "Subtracting"
if Chk ==[False,True,False,False]:
    rs.BooleanUnion((Subtract,subtracty),False)   
    print "Unioning"
if Chk ==[False,False,True,False]:
    rs.SplitBrep(Subtract,subtracty,False) 
    print "Spliting"
if Chk ==[False,False,False,True]:
    rs.BooleanIntersection(Subtract,subtracty,False) 
    print "Intersecting"

rs.UnselectAllObjects()
print "BOoooyya"

so there you have it my version of sketchup’s push pull tool


#4

Hey there, this tool seems interesting, please care to explain how to use it. Thanks