def create_cutting_plane_xz(y_pos, bounding_box): """Creates a face in the x-z plane at a given y-position. :param y_pos: y position :type y_pos: float :param bounding_box: Surrounding box of the wing :type bounding_box: instance of OCC.Bnd.Bnd_Box :return: face :rtype: instance of OCC.TopoDS.TopoDS_Face or None """ plane = gp_Pln(gp_Pnt(0, y_pos, 0), gp_Dir(0, 1, 0)) face_builder = BRepBuilderAPI_MakeFace(plane) if face_builder.IsDone(): return face_builder.Face() else: raise Exception('Could not build face') return None
def make_face(*args): face = BRepBuilderAPI_MakeFace(*args) assert (face.IsDone()) result = face.Face() return result
xAxis = OCC.gp.gp_OX() aTrsf = OCC.gp.gp_Trsf() aTrsf.SetMirror(xAxis) aBRepTrsf = Transform(aWire.Wire(), aTrsf) aMirroredShape = aBRepTrsf.Shape() aMirroredWire = OCC.TopoDS.TopoDS_Shape(aMirroredShape) aMirroredWire = OCC.TopoDS.topods().Wire(aMirroredWire) mkWire = MakeWire() mkWire.Add(aWire.Wire()) mkWire.Add(aMirroredWire) myWireProfile = mkWire.Wire() # Body : Prism the Profile myFaceProfile = MakeFace(myWireProfile) if myFaceProfile.IsDone(): bottomFace = myFaceProfile.Face() aPrismVec = gp_Vec(0, 0, myHeight) myBody = MakePrism(myFaceProfile.Shape(), aPrismVec) # Body : Apply Fillets mkFillet = MakeFillet(myBody.Shape()) aEdgeExplorer = Explorer(myBody.Shape(), OCC.TopAbs.TopAbs_EDGE) while aEdgeExplorer.More(): aEdge = OCC.TopoDS.topods_Edge(aEdgeExplorer.Current()) mkFillet.Add(myThickness / 12, aEdge) aEdgeExplorer.Next() myBody = mkFillet.Shape() # Body : Add the Neck neckLocation = OCC.gp.gp_Pnt(0, 0, myHeight)