Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- from OCC import GC
- from OCC import gp
- from OCC import TopoDS
- from OCC import BRepBuilderAPI
- from OCC import BRepPrimAPI
- from OCC import BRepFill
- from OCC.Display.SimpleGui import init_display
- a = gp.gp_Pnt(-1.0, 0.0, 0.0)
- b = gp.gp_Pnt(0.0, -1.0, 0.0)
- c = gp.gp_Pnt(1.0, 0.0, 0.0)
- d = gp.gp_Pnt(1.0, 0.0, 5.0)
- e = gp.gp_Pnt(0.0, -1.0, 5.0)
- f = gp.gp_Pnt(-1.0, 0.0, 5.0)
- arc1 = GC.GC_MakeArcOfCircle(a, b, c)
- arc1Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(arc1.Value())
- side1Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(c, d)
- arc2 = GC.GC_MakeArcOfCircle(d, e, f)
- arc2Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(arc2.Value())
- side2Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(f, a)
- #side3Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(b, e)
- c0 = BRepFill.OCC.GeomAbs.GeomAbs_C0
- c1 = BRepFill.OCC.GeomAbs.GeomAbs_C1
- c2 = BRepFill.OCC.GeomAbs.GeomAbs_C2
- filling = BRepFill.BRepFill_Filling()
- filling.Add(arc1Edge.Edge(), c0)
- filling.Add(side1Edge.Edge(), c0)
- filling.Add(arc2Edge.Edge(), c0)
- filling.Add(side2Edge.Edge(), c0)
- #filling.Add(side3Edge.Edge(), c0)
- filling.Build()
- face = filling.Face()
- prismVec = gp.gp_Vec(0.0, -5.0, 0.0)
- body = BRepPrimAPI.BRepPrimAPI_MakePrism(face, prismVec)
- display, start_display, add_menu, add_function_to_menu = init_display()
- display.DisplayShape(body.Shape(), update=True)
- start_display()
Advertisement
Add Comment
Please, Sign In to add comment