Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- from math import pi
- C=bpy.context
- D=bpy.data
- O=bpy.ops
- for o in D.objects:
- D.objects.remove(o)
- for m in D.meshes:
- D.meshes.remove(m)
- for c in D.collections:
- D.collections.remove(c)
- class Tavolino:
- def __init__(self,lar=2,lun=.8,spe=.05,alt=.7,dia=.05,gap=.05,loc=(0,0),rot=0,n_sedie=1):
- rotrad=rot*2*pi/360
- O.mesh.primitive_cube_add(size=2,location=(loc[0],loc[1],alt+spe/2),scale=(lar,lun,spe),rotation=(0,0,rotrad))
- tavola=C.object
- loc_x=lar/2-dia/2-gap
- loc_y=lun/2-dia/2-gap
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt,location=(loc_x,loc_y,-alt/2-spe/2))
- gambo1=C.object
- gambo1.parent=tavola
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt,location=(loc_x,-loc_y,-alt/2-spe/2))
- gambo2=C.object
- gambo2.parent=tavola
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt,location=(-loc_x,loc_y,-alt/2-spe/2))
- gambo3=C.object
- gambo3.parent=tavola
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt,location=(-loc_x,-loc_y,-alt/2-spe/2))
- gambo4=C.object
- gambo4.parent=tavola
- def sedia(lun_s2,lun_s3):
- O.mesh.primitive_cube_add(size=2,location=(lun_s2,0,-alt/2),scale=(lun/2,lun/2,spe))
- seduta=C.object
- seduta.parent=tavola
- O.mesh.primitive_cube_add(size=2,location=(lun_s3,0,alt/4+spe),scale=(lun/2,lun/2,spe),rotation=(0,1.5707,0))
- spalliera=C.object
- spalliera.parent=seduta
- loc_xs=lar/8-dia/2-gap*1.5
- loc_ys=lun/3.5-dia/21-gap*1.5
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt/2,location=(loc_xs,loc_ys,-alt/4-spe/2))
- gambo1s=C.object
- gambo1s.parent=seduta
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt/2,location=(loc_xs,-loc_ys,-alt/4-spe/2))
- gambo2s=C.object
- gambo2s.parent=seduta
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt/2,location=(-loc_xs,loc_ys,-alt/4-spe/2))
- gambo3s=C.object
- gambo3s.parent=seduta
- bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=dia/2,depth=alt/2,location=(-loc_xs,-loc_ys,-alt/4-spe/2))
- gambo4s=C.object
- gambo4s.parent=seduta
- if n_sedie == 1:
- lun_s2 = lun+lun/2
- lun_s3 = lun/4-spe/2
- sedia(lun_s2,lun_s3)
- if n_sedie == 2:
- lun_s2 = lun+lun/2
- lun_s3 = lun/4-spe/2
- sedia(lun_s2,lun_s3)
- lun_s2 = -lun-lun/2
- lun_s3 = -lun/4+spe/2
- sedia(lun_s2,lun_s3)
- if n_sedie == 0:
- print("pizza")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement