Hi everyone,
I'm trying to boolean cut a profile surface out of another surface. 
Unfortunately boolean cut doesn't seem to do anything. Can the cuttingShape be 
a kind of surface at all?!
Thanks,
Balint




from OCC.Utils.DataExchange.STEP import *
from OCC.BRepAlgoAPI import *
from OCC.Display.SimpleGui import *
display, start_display, add_menu, add_function_to_menu = init_display()

def boolean_cut(shapeToCutFrom, cuttingShape):
        try:
                cut = BRepAlgoAPI_Cut(shapeToCutFrom, cuttingShape)
                print 'can work?', cut.BuilderCanWork()
                _error = {
                        0: '- Ok',
                        1: '- The Object is created but Nothing is Done',
                        2: '- Null source shapes is not allowed',
                        3: '- Check types of the arguments',
                        4: '- Can not allocate memory for the DSFiller',
                        5: '- The Builder can not work with such types of 
arguments',
                        6: '- Unknown operation is not allowed',
                        7: '- Can not allocate memory for the Builder',
                        }
                print 'error status:', _error[cut.ErrorStatus()]
                cut.RefineEdges()
                cut.FuseEdges()
                shp = cut.Shape()
                cut.Destroy()
                return shp
        except:
                print 'FAILED TO BOOLEAN CUT'
                return shapeToCutFrom


# STEP IMPORTS:
HubImporter = STEPImporter("hub1.stp")
HubImporter.ReadFile()
shapeList = HubImporter.GetShapes()
hubSurface = shapeList[0]
#display.DisplayShape(hubSurface)

CutImporter = STEPImporter("cuttingProfile.stp")
CutImporter.ReadFile()
shapeList = CutImporter.GetShapes()
cuttingProfile = shapeList[0]
display.DisplayShape(cuttingProfile)


# CUT:
hubWithHole = boolean_cut(hubSurface, cuttingProfile)
display.DisplayShape(hubWithHole)

start_display()

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

Attachment: hub1.stp
Description: Binary data

Attachment: cuttingProfile.stp
Description: Binary data

_______________________________________________
Pythonocc-users mailing list
[email protected]
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to