|
| 1 | +#!/usr/bin/env python |
| 2 | +## |
| 3 | +##This file is part of pythonOCC. |
| 4 | +## |
| 5 | +##pythonOCC is free software: you can redistribute it and/or modify |
| 6 | +##it under the terms of the GNU Lesser General Public License as published by |
| 7 | +##the Free Software Foundation, either version 3 of the License, or |
| 8 | +##(at your option) any later version. |
| 9 | +## |
| 10 | +##pythonOCC is distributed in the hope that it will be useful, |
| 11 | +##but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +##GNU Lesser General Public License for more details. |
| 14 | +## |
| 15 | +##You should have received a copy of the GNU Lesser General Public License |
| 16 | +##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>. |
| 17 | + |
| 18 | +from OCC.gp import gp_Pnt,gp_Dir,gp_Pln |
| 19 | +from OCC.Display.SimpleGui import init_display |
| 20 | +from OCC.ChFi2d import ChFi2d_AnaFilletAlgo |
| 21 | +from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge,BRepBuilderAPI_MakeWire |
| 22 | + |
| 23 | +from core_geometry_utils import make_wire |
| 24 | +display,start_display, add_menu,add_functionto_menu = init_display() |
| 25 | + |
| 26 | +# Defining the points |
| 27 | +p1 = gp_Pnt(0, 0, 0) |
| 28 | +p2 = gp_Pnt(5, 5, 0) |
| 29 | +p3 = gp_Pnt(-5,5, 0) |
| 30 | + |
| 31 | +# Making the edges |
| 32 | +ed1 = BRepBuilderAPI_MakeEdge(p3,p2).Edge() |
| 33 | +ed2 = BRepBuilderAPI_MakeEdge(p2,p1).Edge() |
| 34 | + |
| 35 | +#Making the 2dFillet |
| 36 | +f = ChFi2d_AnaFilletAlgo() |
| 37 | +f.Init(ed1,ed2,gp_Pln()) |
| 38 | +radius = 1.0 |
| 39 | +f.Perform(radius) |
| 40 | +fillet2d = f.Result(ed1,ed2) |
| 41 | + |
| 42 | +# Create and display a wire |
| 43 | +w = make_wire([ed1, fillet2d, ed2]) |
| 44 | +display.DisplayShape(w) |
| 45 | +start_display() |
0 commit comments