Interested in making an airfoil. But how to run this code. When I double
clicked it, a window poped up but soon disappeared.
>
> -jelle
>
> from OCC.Utils.Common import interpolate_points_to_spline_no_tangency
> from OCC.Utils.Construct import *
> from OCC.KBE.Level2API import Curve
> from OCC.Utils.Topology import *
> #===============================================================================
> # GUI
> #===============================================================================
> from OCC.Display.SimpleGui import init_display
> display, start_display, add_menu, add_function_to_menu = init_display()
> #===============================================================================
> # CONSTANTS
> #===============================================================================
>
> TOLERANCE = 1e-6
> TRAITS = False
> EXPORT = 'iges' # 'step'
>
> #===============================================================================
> # FUNCTIONS
> #===============================================================================
>
> def naca_curve(length, thickness_to_chord, show=False):
>
> def y(x):
> x_c = x/c
> x_c2 = x_c * x_c
> x_c3 = x_c2 * x_c
> x_c4 = x_c3 * x_c
> y =
> 10*t*c*(0.2929*sqrt(x_c)-0.1260*x_c-0.3516*x_c2+0.2843*x_c3-0.1015*x_c4)
> return y
>
> c = length
> t = thickness_to_chord
>
> points_coord = []
> x = 0.0
> x_step = 0.1
> while x<=c:
> points_coord.append([x,y(x)])
> x += x_step
>
> crv1, crv2 = [], []
>
> for point in points_coord:
> P1 = gp_Pnt(point[0], 0.0, point[1])
> P2 = gp_Pnt(point[0], 0.0, -point[1])
> if show:
> display.DisplayShape(map(make_vertex, [P1,P2]))
>
> crv1.append(P1)
> crv2.append(P2)
>
> #crv2.reverse()
> #crv1 += crv2
>
> interpolated_curve1 =
> make_edge(interpolate_points_to_spline_no_tangency(crv1,
> False,
> False
> )
> )
> return interpolated_curve1
>
>
_________________________________________________________________
一张照片的自白――Windows Live照片的可爱视频介绍
http://windowslivesky.spaces.live.com/blog/cns!5892B6048E2498BD!889.entry
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users