Dear all,
with the script below I create several vertices and an interpolating spline for 
the upper and lower part of a NACA airfoil. The first attachment shows the 
results in the pythonOCC 3D viewer, which looks fine.

The second attachment shows a zoom of the leading edge of the profile in 
Salome. 
The profile was exported to STEP format in the script below, which was then 
imported in Salome. Unfortunately the spline does not interpolate the dense 
vertices.

Is this a problem of the STEP export function, of the STEP format, or a problem 
of Salome? Is it possible to improve the resolution of the STEP export, so that 
I can work in Salome without loss of details?

Thanks Jan

This script generated the output:
from OCC import *

from OCC.Utils.DataExchange.STEP import STEPExporter
from OCC.BRepBuilderAPI import *
from OCC.TColgp import *
from OCC.Geom import *
from OCC.GeomAbs import *
from OCC.GeomAPI import *
from OCC.gp import *
from numpy import pi,cos,sin,sqrt

from OCC.Display.SimpleGui import * 
display, start_display, add_menu, add_function_to_menu = init_display()

def naca(x,t,c):
  
y=t/.2*c*(.2969*sqrt(x/c)-.1260*(x/c)-.3516*(x/c)**2+.2843*(x/c)**3-.1015*(x/c)**4)

  return y

N=20;
v=[]
pt=[]
upper = TColgp_Array1OfPnt(1,2*N)
lower = TColgp_Array1OfPnt(1,2*N)
for i in range(2*N):
  if (i<N):
    x=0.1*i/N
  else:
    x=0.1+0.9*(i-N)/(N-1)
  x=10*x;
  y=naca(x,.12,10)
  pt.append(gp_Pnt(x,y,0));
  v.append(BRepBuilderAPI_MakeVertex(pt[-1]).Shape())
  upper.SetValue(i+1, pt[-1])
  lower.SetValue(i+1, gp_Pnt(x,-y,0))

c= GeomAPI_PointsToBSpline(upper).Curve()
Eu = BRepBuilderAPI_MakeEdge(c)
Eu.Build()
c= GeomAPI_PointsToBSpline(lower,3,8,GeomAbs_C2,1e-6).Curve()
El = BRepBuilderAPI_MakeEdge(c)
El.Build()
# Export to STEP
my_step_exporter = STEPExporter("naca.stp")
for vi in v:
  my_step_exporter.AddShape(vi)
  display.DisplayShape(vi)
my_step_exporter.AddShape(Eu.Shape())
my_step_exporter.AddShape(El.Shape())
my_step_exporter.WriteFile()

display.DisplayShape(Eu.Shape())
display.DisplayShape(El.Shape())
start_display()

_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to