def AddPlot(self, plot_cmd): if plot_cmd == "cplot": plt.cplot(self.nurbs) elif plot_cmd == "kplot": plt.kplot(self.nurbs) elif plot_cmd == "plot": plt.plot(self.nurbs) elif plot_cmd == "curve": plt.curve(self.nurbs) elif plot_cmd == "surface": plt.surface(self.nurbs) elif plot_cmd == "cpoint": plt.cpoint(self.nurbs) elif plot_cmd == "cwire": plt.cwire(self.nurbs) elif plot_cmd == "kpoint": plt.kpoint(self.nurbs) elif plot_cmd == "kwire": plt.kwire(self.nurbs)
import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass vol = make_vol() plt.figure() plt.cpoint(vol) plt.cwire(vol) plt.figure() plt.kpoint(vol) plt.kwire(vol) plt.figure() plt.curve(vol) plt.figure() plt.surface(vol) plt.figure() plt.cplot(vol) plt.kplot(vol) plt.plot(vol) plt.show()
Lx = LargoX # Horizontal length of the rectangle Nx = nx # number of elements in the horizontal direction (x direction) p = 1 # Order of the basis functions C = 0 # Inter-element continuity #geom = bilinear([[[ 0., 0.],[ 0., Ly]],[[ Lx, 0.],[ Lx, Ly]]]) #geom = bilinear([[[ -Lx/2.0, -Ly/2.0],[ -Lx/2.0, Ly/2.0]],[[ Lx/2.0, -Ly/2.0],[ Lx/2.0, Ly/2.0]]]) points = np.zeros((2,2), dtype='d') points[0,0] = -Lx/2.0 points[1,0] = +Lx/2.0 geom = linear(points) geom = refine( geom, factor=1, degree=p) geom = refine( geom, factor=Nx ) #geom.unclamp(0) #geom.unclamp(1) PetIGA().write(fileName, geom, nsd=1) if 0: from igakit.plot import plt plt.figure() plt.cplot(geom) plt.kplot(geom) plt.show()
from igakit.cad import * c1 = circle(radius=1, angle=Pi / 2) c2 = c1.copy().unclamp(0) from igakit.plot import plt import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass plt.figure() plt.cplot(c1) plt.kplot(c1) plt.figure() plt.cplot(c2) plt.kplot(c2) plt.show()
from igakit.cad import * c1 = circle(radius=1, angle=Pi/2) c2 = c1.copy().unclamp(0) from igakit.plot import plt import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass plt.figure() plt.cplot(c1) plt.kplot(c1) plt.figure() plt.cplot(c2) plt.kplot(c2) plt.show()
elbow = revolve(annulus, point=(Rb,0,0), axis=(0,-1,0), angle=Pi/2) bentpipe = join(pipe.reverse(2), elbow, axis=2) # --- nrb = bentpipe from igakit.plot import plt import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass #plt.use('mayavi') #plt.use('matplotlib') plt.figure() plt.cpoint(nrb) plt.cwire(nrb, mode='tube') plt.kpoint(nrb) plt.kwire(nrb, mode='tube') plt.plot(nrb, opacity=0.1) plt.figure() plt.kplot(nrb, color=(0,0,1)) plt.plot(nrb) plt.show()
# make a ruled surface out of the two arcs srf = ruled(C0, C1) # make the radial direction first srf.transpose() # refine the surface to have: # * 3x6 nonempty knot spans # * degree two in both directions # * maximum allowable continuity srf1 = refine(srf, factor=[3,6], degree=2) # refine the surface to have: # * 5x10 nonempty knot spans # * degree three in both directions # * C^0 continuity srf2 = refine(srf, factor=[5,10], degree=3, continuity=0) import sys from igakit.plot import plt try: backend = sys.argv[1] plt.use(backend) except IndexError: pass for nrb in (srf, srf1, srf2): plt.figure() plt.cplot(nrb) plt.kplot(nrb) plt.show()
1, 1, 1, 1,] crv = NURBS([U], C) return crv import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass crv = make_crv() plt.figure() plt.cpoint(crv) plt.cwire(crv) plt.figure() plt.kpoint(crv) plt.kwire(crv) plt.figure() plt.curve(crv) plt.figure() plt.cplot(crv) plt.kplot(crv) plt.plot(crv) plt.show()
#nrb2 = nrb.clone().refine([],[0.5],[0.25, 0.5, 0.75]) import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass #plt.use('mayavi') #plt.use('matplotlib') plt.figure() plt.cpoint(nrb) plt.cwire(nrb) plt.figure() plt.kpoint(nrb) plt.kwire(nrb) plt.figure() plt.curve(nrb) plt.figure() plt.surface(nrb) plt.figure() plt.cplot(nrb) plt.kplot(nrb) plt.plot(nrb) plt.show()
return srf import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass srf = make_srf() plt.figure() plt.cpoint(srf) plt.cwire(srf) plt.figure() plt.kpoint(srf) plt.kwire(srf) plt.figure() plt.curve(srf) plt.figure() plt.surface(srf) plt.figure() plt.cplot(srf) plt.kplot(srf) plt.plot(srf) plt.show()
import sys try: backend = sys.argv[1] plt.use(backend) except IndexError: pass srf = make_srf() plt.figure() plt.cpoint(srf) plt.cwire(srf) plt.figure() plt.kpoint(srf) plt.kwire(srf) plt.figure() plt.curve(srf) plt.figure() plt.surface(srf) plt.figure() plt.cplot(srf) plt.kplot(srf) plt.plot(srf) plt.show()