Esempio n. 1
0
    VIEW(BeltTower)

# =======================================
# Fabric
# =======================================

print "Started to construct the final UNION."
Fabric = STRUCT(
    PLASM_T(3)(
        (RAISE(PLASM_NDIFF)(BasementHeight)))(Basement), Steps, FirstFloor,
    PLASM_T(3)(FirstFloorHeight)(Kernel), FirstColumnRing,
    PLASM_T(3)((RAISE(PLASM_NDIFF)([FirstFloorHeight,
                                    (0.095 * ScaleFactor)]))), Terrace,
    (COMP([PLASM_STRUCT, DOUBLE_DIESIS(5)
           ]))([SecondColumnRing,
                PLASM_T(3)((WallHeight / 5.0)), Terrace]),
    PLASM_T(3)(WallHeight), TowerCap, TopTower,
    PLASM_T(3)((RAISE(PLASM_NDIFF)([MAX(3)(TowerCap), 0.3]))), BeltTower)

out = Fabric

#Plasm.save(out,':models/pisa.hpc.gz')
print "Pisa evaluated in", time.clock() - start, "seconds."
VIEW(out)

# STL output:
import plasm_stl
filename = "pisa.stl"
plasm_stl.toSTL(out, filename)
print "STL file written to", filename
		FirstFloor, 
		PLASM_T(3)(FirstFloorHeight)(Kernel), 
		FirstColumnRing, 
		PLASM_T(3)((RAISE(PLASM_NDIFF)([FirstFloorHeight, (0.095*ScaleFactor)]))), 
		Terrace, (
		COMP([PLASM_STRUCT, DOUBLE_DIESIS(5)]))([
			SecondColumnRing, 
			PLASM_T(3)((WallHeight/5.0)), 
			Terrace
		]), 
		PLASM_T(3)(WallHeight), 
		TowerCap, 
		TopTower, 
		PLASM_T(3)((RAISE(PLASM_NDIFF)([MAX(3)(TowerCap),0.3]))), 
		BeltTower
	)

out = Fabric

#Plasm.save(out,':models/pisa.hpc.gz')
print "Pisa evaluated in", time.clock() - start, "seconds."
VIEW(out)

# STL output:
import plasm_stl
filename = "pisa.stl"
plasm_stl.toSTL(out, filename)
print "STL file written to", filename


Esempio n. 3
0
Rin = 0.08
bt = 0.005
cyl_inner = CYLINDER(Rin, Hout, 128)
cyl_inner = T(cyl_inner, 0, 0, bt)

# Subtract inner cylinder from outer:
out = DIFF(cyl_outer, cyl_inner)

# Tiny cylinder to cut off the radiuses:
Rtiny = 0.02
Htiny = 2 * Rout + 0.02
cyl = CYLINDER(Rtiny, Htiny)

# Lay the first cylinder horizontall over the ashtray:
cyl1 = T(cyl, 0, 0, -Htiny/2.)
cyl1 = R(cyl1, 2, PI/2)
cyl1 = T(cyl1, 0, 0, Rtiny + Hout/2.0)

# Just rotate by 90 degrees about the z axis:
cyl2 = R(cyl1, 3, PI/2)

# Cutting off the radiuses at once
out = DIFF(out, cyl1, cyl2)
 
# Display the result:
VIEW(out)

# STL output:
import plasm_stl
plasm_stl.toSTL(out)
Esempio n. 4
0
bt = 0.005
cyl_inner = CYLINDER(Rin, Hout, 128)
cyl_inner = T(cyl_inner, 0, 0, bt)

# Subtract inner cylinder from outer:
out = DIFF(cyl_outer, cyl_inner)

# Tiny cylinder to cut off the radiuses:
Rtiny = 0.02
Htiny = 2 * Rout + 0.02
cyl = CYLINDER(Rtiny, Htiny)

# Lay the first cylinder horizontall over the ashtray:
cyl1 = T(cyl, 0, 0, -Htiny / 2.)
cyl1 = R(cyl1, 2, PI / 2)
cyl1 = T(cyl1, 0, 0, Rtiny + Hout / 2.0)

# Just rotate by 90 degrees about the z axis:
cyl2 = R(cyl1, 3, PI / 2)

# Cutting off the radiuses at once
out = DIFF(out, cyl1, cyl2)

# Display the result:
VIEW(out)

# STL output:
import plasm_stl

plasm_stl.toSTL(out)
from pyplasm import *

# Create a cube of size 2:
c = CUBE(2)
# Create a cylinder of radius 0.75 and height 4:
cyl = CYLINDER(0.75, 4)
# Translate the cube by -1 in each axial direction:
c = T(c, -1, -1, -1)
# Translate the cylinder by -2 in the z-direction:
cyl = T(cyl, 0, 0, -2)
# Subtract cylinder from the cube:
c = DIFF(c, cyl)
# Rotate the cylinder by 90 degrees about the x-axis:
cyl = R(cyl, 1, PI/2)
# Subtract the cylinder from the cube:
c = DIFF(c, cyl)
# Rotate the cylinder by 90 degrees about the z-axis:
cyl = R(cyl, 3, PI/2)
# Subtract the cylinder from the cube:
c = DIFF(c, cyl)
# View the result. 
VIEW(c)

# STL output:
import plasm_stl
filename = "drilled-cube.stl"
plasm_stl.toSTL(c, filename)
print "STL file written to", filename