Ejemplo n.º 1
0
# run with ./pyfem test_python_interface.py
import mesh
driver = mesh.driver()
driver.step(100)

### create box
box = mesh.box(coords=[[0.0,0.0],[2.0,1.0]],outer_box=[[-5.0,-5.0],[5.0,5.0]],shifting=[-3.0,-3.0])

box2 = box+[2.0,0.0]         # shifts the box
box4 = box+box2              # create a new object which is a sum of objects
box4.set_shift([0.0,1.5])    # set shift to use in multiplication (repetition)
box3 = box4*3                # repeat the box4 three times
# mesh in files 
box3.mesh_it(visual=True, driver=driver,save=["holes.ps","/tmp/holes.vtk"])
Ejemplo n.º 2
0
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)