Guest User

Cutting Edge

a guest
Oct 6th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. # coding: utf-8
  2. from OCC import GC
  3. from OCC import gp
  4. from OCC import TopoDS
  5. from OCC import BRepBuilderAPI
  6. from OCC import BRepPrimAPI
  7. from OCC import BRepFill
  8. from OCC.Display.SimpleGui import init_display
  9.  
  10. a = gp.gp_Pnt(-1.0, 0.0, 0.0)
  11. b = gp.gp_Pnt(0.0, -1.0, 0.0)
  12. c = gp.gp_Pnt(1.0, 0.0, 0.0)
  13. d = gp.gp_Pnt(1.0, 0.0, 5.0)
  14. e = gp.gp_Pnt(0.0, -1.0, 5.0)
  15. f = gp.gp_Pnt(-1.0, 0.0, 5.0)
  16.  
  17. arc1 = GC.GC_MakeArcOfCircle(a, b, c)
  18. arc1Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(arc1.Value())
  19. side1Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(c, d)
  20. arc2 = GC.GC_MakeArcOfCircle(d, e, f)
  21. arc2Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(arc2.Value())
  22. side2Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(f, a)
  23. #side3Edge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(b, e)
  24.  
  25. c0 = BRepFill.OCC.GeomAbs.GeomAbs_C0
  26. c1 = BRepFill.OCC.GeomAbs.GeomAbs_C1
  27. c2 = BRepFill.OCC.GeomAbs.GeomAbs_C2
  28. filling = BRepFill.BRepFill_Filling()
  29.  
  30. filling.Add(arc1Edge.Edge(), c0)
  31. filling.Add(side1Edge.Edge(), c0)
  32. filling.Add(arc2Edge.Edge(), c0)
  33. filling.Add(side2Edge.Edge(), c0)
  34. #filling.Add(side3Edge.Edge(), c0)
  35.  
  36. filling.Build()
  37. face = filling.Face()
  38.  
  39. prismVec = gp.gp_Vec(0.0, -5.0, 0.0)
  40. body = BRepPrimAPI.BRepPrimAPI_MakePrism(face, prismVec)
  41. display, start_display, add_menu, add_function_to_menu = init_display()
  42. display.DisplayShape(body.Shape(), update=True)
  43. start_display()
Advertisement
Add Comment
Please, Sign In to add comment