Skip to content

Commit daac1e4

Browse files
authored
Merge pull request #286 from tpaviot/review/2d_fillet_example
Added 2d fillet example
2 parents b66be5b + d24afab commit daac1e4

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

examples/core_2d_fillet.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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()

examples/core_geometry_airfoil.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ def __init__(self, chord, span, profile):
4848

4949
def make_shape(self):
5050
# 1 - retrieve the data from the UIUC airfoil data page
51-
foil_dat_url = 'http://www.ae.illinois.edu/m-selig/ads/coord_seligFmt/%s.dat' % self.profile
51+
foil_dat_url = 'http://m-selig.ae.illinois.edu/ads/coord_seligFmt/%s.dat' % self.profile
52+
print("Connecting to m-selig, retrieving foil data")
5253
f = urllib2.urlopen(foil_dat_url)
53-
54+
print("Building foil geometry")
5455
plan = gp_Pln(gp_Pnt(0., 0., 0.), gp_Dir(0., 0., 1.)) # Z=0 plan / XY plan
5556
section_pts_2d = []
5657

@@ -104,8 +105,8 @@ def _Tcol_dim_1(li, _type):
104105
return pts
105106

106107
if __name__ == '__main__':
108+
airfoil = UiucAirfoil(50., 200., 'b737a')
107109
from OCC.Display.SimpleGui import init_display
108110
display, start_display, add_menu, add_function_to_menu = init_display()
109-
airfoil = UiucAirfoil(50., 200., 'b737a')
110111
display.DisplayShape(airfoil.shape, update=True)
111112
start_display()

0 commit comments

Comments
 (0)