import mesh import Numeric pi = Numeric.pi vertical = mesh.box(coords=[[0.0, 0.0], [1.0, 5.0]], outer_box=[[-5.0, -5.0], [5.0, 5.0]], rod_length=0.1) horizontal = vertical.copy() horizontal.rotate(0, 1, pi / 4.0, bc=True) cross = vertical.unite(horizontal) circle = mesh.ellipsoid(length=[1.0, 1.0], shifting=[-2.0, -1.0]) compound = circle + cross cone = mesh.conical(coords1=[0.0, 0.0], rad1=2.0, coords2=[2.0, 0.0], rad2=1.0, shifting=[3.0, -3.0]) hole = mesh.ellipsoid(length=[1.0, 3.0], shifting=[2.0, -1.0], outer_box=[[-5.0, -5.0], [5.0, 5.0]]) hole.rotate(1, 0, 3 / 4.0 * pi) diff = cone - hole compound += diff stick = mesh.box(coords=[[0.0, 0.0], [1.0, 5.0]], shifting=[3.0, -2.0]) stick.rotate(1, 0, pi / 4.0) hole.intersect(stick) compound += hole compound.mesh_it(visual=True)
# save the mesh in a postsript and "pyfem" file ring2.mesh_it(save=["union.ps","union.dat"]) print "Finished union" raw_input() #------------------------------------------------------ ############### create an antidot array of 16 holes #define a new mesher mesher = mesh.mesher() mesher.set_topology_threshold(0.1) driver = mesh.driver() driver.step(100) # first hole in the left bottom corner hole1 = mesh.ellipsoid(length=[1.0,1.0],shifting=[-3.0,-3.0],outer_box=[[-5.0,-5.0],[5.0,5.0]]) # second hole on the right of hole1 hole2= hole1.copy() hole2.shift([2.0,0.0]) # copy the previous couple of holes on the right couple_holes = hole1+hole2 copy_couple_holes= couple_holes.copy() copy_couple_holes.shift([4.0,0.0]) # create the bottom line of holes bottom_holes = couple_holes+copy_couple_holes # create the second line second_line = bottom_holes.copy()