for i in range(n): x2[i], xt, xtt = edge_list[k + 1].evaluate(xi[i]) x = np.vstack((x1, x2)) x[:, 1] = yloc[k // 2] interp = TMR.CurveInterpolation(x) interp.setNumControlPoints(nctl) curve = interp.createCurve(4) top, bottom = curve.split(0.5) top_curves.append(top) bottom_curves.append(bottom) # Loft the curves top_lofter = TMR.CurveLofter(top_curves) top_surface = top_lofter.createSurface(2) bottom_lofter = TMR.CurveLofter(bottom_curves) bottom_surface = bottom_lofter.createSurface(2) face_list = [] ku, kv, top_tu, ttv, wt, Xt = top_surface.getData() ku, kv, bottom_tu, btv, wb, Xb = bottom_surface.getData() for k in range(3): # Create the egads top surface top_tv = [ttv[k + 1], ttv[k + 1], ttv[k + 2], ttv[k + 2]] oclass = egads.SURFACE mtype = egads.BSPLINE
lofts = [] for i in range(5): X = np.zeros((rae2822_pts.shape[0], 3)) X[:, 0] = rae2822_pts[:, 0] X[:, 1] = rae2822_pts[:, 1] X[:] *= scale[i] X[:, 2] = zpts[i] interp = TMR.CurveInterpolation(X) interp.setNumControlPoints(15) ku = 4 lofts.append(interp.createCurve(ku)) kv = 4 lofter = TMR.CurveLofter(lofts) surface = lofter.createSurface(kv) face = TMR.FaceFromSurface(surface) faces = [face] surface.writeToVTK('wing.vtk') # Create the parametric curves p1 = TMR.BsplinePcurve(np.array([[.1, 0.], [.4, .0]])) p2 = TMR.BsplinePcurve(np.array([[.4, 0.], [.4, 1.]])) p3 = TMR.BsplinePcurve(np.array([[.4, 1.], [.1, 1.]])) p4 = TMR.BsplinePcurve(np.array([[.1, 1.], [.1, .0]])) # Create the curves parametrically along the surface curves = [] curves.append(TMR.EdgeFromFace(face, p1))