搅拌机斜角选择边缘?

发布于 2025-01-13 22:06:02 字数 15387 浏览 2 评论 0原文

我正在尝试为最后绘制的形状添加斜角。它是选定的边。我使用 Blender 3.0 并使用 Python api。

import bpy
shedwidth = 8
shedlength =16
shedheight = 7
inchesinfeet = 12
lengthx = shedlength*inchesinfeet
widthy = 4
heightz = 2
oncenter = 18
floorthickz = 1
floorwidth = 6
n = 3 #numer of lats beneath floor
blockwidth = 6
blocklength = 9
blockheight = 4
blockspacing = 61
latsspacing = shedwidth*inchesinfeet/n
thickness = 0.5

#front side bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,widthy/2,heightz/2), scale=(lengthx,widthy,heightz))

#back end bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-widthy/2,shedwidth*inchesinfeet/2,heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

#back side bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,shedwidth*inchesinfeet-widthy/2,heightz/2), scale=(lengthx,widthy,heightz))

#front end bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,shedwidth*inchesinfeet/2,heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

#front side top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,widthy/2,shedheight*inchesinfeet-heightz/2), scale=(lengthx,widthy,heightz))

#back end top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-widthy/2,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

#back side top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,shedwidth*inchesinfeet-widthy/2,shedheight*inchesinfeet-heightz/2), scale=(lengthx,widthy,heightz))

#front end top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

# front sides
for x in range(1,11):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*oncenter,widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz,widthy,shedheight*inchesinfeet-2*heightz))
 
# back sides
for x in range(1,11):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*oncenter,shedwidth*inchesinfeet-widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz,widthy,shedheight*inchesinfeet-2*heightz))

# back end sides
for x in range(1,6):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-widthy/2,x*oncenter,(shedheight*inchesinfeet)/2), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

# front end (reinforced walls)
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,oncenter,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,oncenter-heightz,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,4*oncenter,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,4*oncenter+heightz,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

#horizontal reinforcement
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(heightz/2,shedheight*inchesinfeet/2+heightz,(shedheight*inchesinfeet)-blockwidth+heightz/2), scale=(heightz,3*oncenter,heightz))



 # back end corners
 # right side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-heightz/2,widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz,widthy,shedheight*inchesinfeet-2*heightz))

 # left side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-heightz, shedwidth*inchesinfeet-heightz/2, shedheight*inchesinfeet/2), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

 # front end corners
 # left side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,shedwidth*inchesinfeet-heightz/2, shedheight*inchesinfeet/2), scale=(widthy, heightz,shedheight*inchesinfeet-2*heightz))

# right side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2, heightz/2, shedheight*inchesinfeet/2), scale=(widthy, widthy/2, shedheight*inchesinfeet-2*heightz))

#floor
for x in range(16):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,x*floorwidth+floorwidth/2,-floorthickz/2), scale=(lengthx,floorwidth,floorthickz))
    
#Under floor
#front rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,heightz/2,-floorthickz-heightz), scale=(lengthx,widthy/2,widthy))

#back end rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-heightz/2,shedwidth*inchesinfeet/2,-floorthickz-heightz), scale=(heightz,shedwidth*inchesinfeet-2*heightz,widthy))

#back side rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,shedwidth*inchesinfeet-heightz/2,-floorthickz-heightz), scale=(lengthx,widthy/2,widthy))

#front end rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(heightz/2,shedwidth*inchesinfeet/2,-floorthickz-heightz), scale=(heightz,shedwidth*inchesinfeet-2*heightz,widthy))

#floor joists
for x in range(11):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-x*oncenter+lengthx-heightz/2,shedwidth*inchesinfeet/2,-floorthickz-heightz), scale=(heightz,shedwidth*inchesinfeet-2*heightz,widthy))
    
#floor lats
for x in range(n):
   bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,x*latsspacing-shedwidth*inchesinfeet+shedwidth*inchesinfeet+latsspacing-floorwidth/2,-floorthickz-heightz-floorthickz/2-heightz), scale=(lengthx,floorwidth,floorthickz))  
   
#extra lats
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,floorwidth/2,-floorthickz-heightz-floorthickz/2-heightz), scale=(lengthx,floorwidth,floorthickz))  
   
#blocks
for y in range(3):
    for x in range(4):
        bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*blockspacing+blocklength/2,y*latsspacing-shedwidth*inchesinfeet+shedwidth*inchesinfeet+latsspacing-floorwidth/2,-blockheight/2-(2*floorthickz)-widthy), scale=(blocklength,blockwidth,blockheight))  
        
for x in range(4):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*blockspacing+blocklength/2,blockwidth/2,-blockheight/2-(2*floorthickz)-widthy), scale=(blocklength,blockwidth,blockheight))

#outside cladding
#front sides
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2-thickness/4,-thickness/2,shedheight*inchesinfeet-blockwidth/2), scale=(lengthx-thickness/2,thickness,blockwidth)) 

#left of left window
for x in range(7):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2,thickness/2,shedheight*inchesinfeet/2), scale=(blockwidth,thickness,oncenter)) 
    
#back sides
for x in range(15):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2-thickness/4,shedwidth*inchesinfeet+thickness/2,shedheight*inchesinfeet-blockwidth/2-x*blockwidth), scale=(lengthx-thickness/2,thickness,blockwidth)) 

#back ends
for x in range(15):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-x*blockwidth-blockwidth/2), scale=(thickness,shedwidth*inchesinfeet,blockwidth))

#front end top piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness/2,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-blockwidth/2), scale=(thickness,shedwidth*inchesinfeet,blockwidth))

# Front end left from outside
for x in range(2,15):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness/2,oncenter/2+4*oncenter+1.5+1,shedheight*inchesinfeet-x*blockwidth+blockwidth/2), scale=(thickness,oncenter+widthy+4+2-1-2,blockwidth)) 

#Front end right from outside
for x in range(3,16):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness,oncenter-2*widthy-heightz-heightz/2+heightz/2+widthy/2-thickness/2-heightz/8,shedheight*inchesinfeet-x*blockwidth+blockwidth+blockwidth/2), scale=(thickness,oncenter+widthy-thickness-heightz-thickness-heightz/4,blockwidth))

#front end bottom piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness/2,shedwidth*inchesinfeet/2,-blockwidth/2), scale=(thickness,shedwidth*inchesinfeet,blockwidth))
'''
#test piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-0,4*oncenter-widthy/2,widthy/2), scale=(lengthx,widthy/2,blockwidth))
'''
'''
#test piece II
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(6,oncenter/2+4*oncenter+1.5+1,4), scale=(4,oncenter+widthy+4+2-1-2,8))
'''
'''
#test piece III
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2+2,4*oncenter+oncenter/2+widthy-2-0.25/2-2/2+4-2-1-1+2+0.25+1-0.5,12-4-0.25+1), scale=(1,oncenter+widthy,2))
'''

#reinforced front sides
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(3*oncenter-heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(4*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(6*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(7*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(9*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(10*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

#corners anticlochwise looking down
#looking from outside

#front side left corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2-2*thickness,-thickness-thickness/2,shedheight*inchesinfeet/2-blockwidth/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

#clear scene, make mesh
bpy.ops.object.mode_set(mode = 'OBJECT')

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2-2*thickness,-thickness-thickness/2,shedheight*inchesinfeet/2-blockwidth/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))
obj = bpy.data.objects["Cube"]
#select vertex
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode = 'EDIT') 
#bpy.ops.mesh.select_mode(type="VERT")
bpy.ops.mesh.select_mode(type="EDGE")
#bpy.ops.mesh.select_mode(type="FACE")
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
#obj.data.vertices[2].select = True
obj.data.edges[9].select = True
#obj.data.polygons[2].select = True
bpy.ops.object.mode_set(mode = 'EDIT') 

bpy.ops.mesh.bevel(
offset_type   = 'OFFSET',
offset        = 10,
segments      = 10,
profile       = 0.5,
vertex_only   = False,
    clamp_overlap = False,
    loop_slide    = True,
    material      = -1
)
    
'''
bpy.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-blockwidth/2+thickness/2,-thickness-thickness/2,shedheight*inchesinfeet/2-blockwidth+blockwidth/2+thickness/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

#back end left corner piece
#bpy.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx+thickness,blockwidth/2-thickness-thickness,shedheight*inchesinfeet/2-blockwidth/2), scale=(thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

#back end right corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx+thickness-thickness/2+thickness/2,blockwidth/2+(shedwidth*inchesinfeet)-blockwidth+thickness+thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

#back side left corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-blockwidth/2+thickness/2,shedwidth*inchesinfeet+thickness+thickness/2,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

#back side right corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2-thickness-thickness,shedwidth*inchesinfeet+thickness/2+thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

# front end left corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,thickness+shedwidth*inchesinfeet-blockwidth/2,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

# front end right corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,blockwidth/2-2*thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

#window left
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,blockwidth/2-2*thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))
#window right
#inside cladding
#front side
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,blockwidth/2-2*thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))
'''

如何对选定的边缘进行斜切?

I am trying to add a bevel to the last shape drawn. It is a selected edge. I am on Blender 3.0 and using the Python api.

import bpy
shedwidth = 8
shedlength =16
shedheight = 7
inchesinfeet = 12
lengthx = shedlength*inchesinfeet
widthy = 4
heightz = 2
oncenter = 18
floorthickz = 1
floorwidth = 6
n = 3 #numer of lats beneath floor
blockwidth = 6
blocklength = 9
blockheight = 4
blockspacing = 61
latsspacing = shedwidth*inchesinfeet/n
thickness = 0.5

#front side bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,widthy/2,heightz/2), scale=(lengthx,widthy,heightz))

#back end bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-widthy/2,shedwidth*inchesinfeet/2,heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

#back side bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,shedwidth*inchesinfeet-widthy/2,heightz/2), scale=(lengthx,widthy,heightz))

#front end bottom
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,shedwidth*inchesinfeet/2,heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

#front side top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,widthy/2,shedheight*inchesinfeet-heightz/2), scale=(lengthx,widthy,heightz))

#back end top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-widthy/2,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

#back side top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,shedwidth*inchesinfeet-widthy/2,shedheight*inchesinfeet-heightz/2), scale=(lengthx,widthy,heightz))

#front end top
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-heightz/2), scale=(widthy,shedwidth*inchesinfeet-2*widthy,heightz))

# front sides
for x in range(1,11):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*oncenter,widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz,widthy,shedheight*inchesinfeet-2*heightz))
 
# back sides
for x in range(1,11):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*oncenter,shedwidth*inchesinfeet-widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz,widthy,shedheight*inchesinfeet-2*heightz))

# back end sides
for x in range(1,6):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-widthy/2,x*oncenter,(shedheight*inchesinfeet)/2), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

# front end (reinforced walls)
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,oncenter,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,oncenter-heightz,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,4*oncenter,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,4*oncenter+heightz,(shedheight*inchesinfeet/2)), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

#horizontal reinforcement
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(heightz/2,shedheight*inchesinfeet/2+heightz,(shedheight*inchesinfeet)-blockwidth+heightz/2), scale=(heightz,3*oncenter,heightz))



 # back end corners
 # right side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-heightz/2,widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz,widthy,shedheight*inchesinfeet-2*heightz))

 # left side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-heightz, shedwidth*inchesinfeet-heightz/2, shedheight*inchesinfeet/2), scale=(widthy,heightz,shedheight*inchesinfeet-2*heightz))

 # front end corners
 # left side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2,shedwidth*inchesinfeet-heightz/2, shedheight*inchesinfeet/2), scale=(widthy, heightz,shedheight*inchesinfeet-2*heightz))

# right side as you look at it from inside
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2, heightz/2, shedheight*inchesinfeet/2), scale=(widthy, widthy/2, shedheight*inchesinfeet-2*heightz))

#floor
for x in range(16):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,x*floorwidth+floorwidth/2,-floorthickz/2), scale=(lengthx,floorwidth,floorthickz))
    
#Under floor
#front rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,heightz/2,-floorthickz-heightz), scale=(lengthx,widthy/2,widthy))

#back end rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-heightz/2,shedwidth*inchesinfeet/2,-floorthickz-heightz), scale=(heightz,shedwidth*inchesinfeet-2*heightz,widthy))

#back side rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,shedwidth*inchesinfeet-heightz/2,-floorthickz-heightz), scale=(lengthx,widthy/2,widthy))

#front end rail
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(heightz/2,shedwidth*inchesinfeet/2,-floorthickz-heightz), scale=(heightz,shedwidth*inchesinfeet-2*heightz,widthy))

#floor joists
for x in range(11):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-x*oncenter+lengthx-heightz/2,shedwidth*inchesinfeet/2,-floorthickz-heightz), scale=(heightz,shedwidth*inchesinfeet-2*heightz,widthy))
    
#floor lats
for x in range(n):
   bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,x*latsspacing-shedwidth*inchesinfeet+shedwidth*inchesinfeet+latsspacing-floorwidth/2,-floorthickz-heightz-floorthickz/2-heightz), scale=(lengthx,floorwidth,floorthickz))  
   
#extra lats
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2,floorwidth/2,-floorthickz-heightz-floorthickz/2-heightz), scale=(lengthx,floorwidth,floorthickz))  
   
#blocks
for y in range(3):
    for x in range(4):
        bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*blockspacing+blocklength/2,y*latsspacing-shedwidth*inchesinfeet+shedwidth*inchesinfeet+latsspacing-floorwidth/2,-blockheight/2-(2*floorthickz)-widthy), scale=(blocklength,blockwidth,blockheight))  
        
for x in range(4):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(x*blockspacing+blocklength/2,blockwidth/2,-blockheight/2-(2*floorthickz)-widthy), scale=(blocklength,blockwidth,blockheight))

#outside cladding
#front sides
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2-thickness/4,-thickness/2,shedheight*inchesinfeet-blockwidth/2), scale=(lengthx-thickness/2,thickness,blockwidth)) 

#left of left window
for x in range(7):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2,thickness/2,shedheight*inchesinfeet/2), scale=(blockwidth,thickness,oncenter)) 
    
#back sides
for x in range(15):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx/2-thickness/4,shedwidth*inchesinfeet+thickness/2,shedheight*inchesinfeet-blockwidth/2-x*blockwidth), scale=(lengthx-thickness/2,thickness,blockwidth)) 

#back ends
for x in range(15):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-x*blockwidth-blockwidth/2), scale=(thickness,shedwidth*inchesinfeet,blockwidth))

#front end top piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness/2,shedwidth*inchesinfeet/2,shedheight*inchesinfeet-blockwidth/2), scale=(thickness,shedwidth*inchesinfeet,blockwidth))

# Front end left from outside
for x in range(2,15):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness/2,oncenter/2+4*oncenter+1.5+1,shedheight*inchesinfeet-x*blockwidth+blockwidth/2), scale=(thickness,oncenter+widthy+4+2-1-2,blockwidth)) 

#Front end right from outside
for x in range(3,16):
    bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness,oncenter-2*widthy-heightz-heightz/2+heightz/2+widthy/2-thickness/2-heightz/8,shedheight*inchesinfeet-x*blockwidth+blockwidth+blockwidth/2), scale=(thickness,oncenter+widthy-thickness-heightz-thickness-heightz/4,blockwidth))

#front end bottom piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness/2,shedwidth*inchesinfeet/2,-blockwidth/2), scale=(thickness,shedwidth*inchesinfeet,blockwidth))
'''
#test piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-0,4*oncenter-widthy/2,widthy/2), scale=(lengthx,widthy/2,blockwidth))
'''
'''
#test piece II
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(6,oncenter/2+4*oncenter+1.5+1,4), scale=(4,oncenter+widthy+4+2-1-2,8))
'''
'''
#test piece III
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(widthy/2+2,4*oncenter+oncenter/2+widthy-2-0.25/2-2/2+4-2-1-1+2+0.25+1-0.5,12-4-0.25+1), scale=(1,oncenter+widthy,2))
'''

#reinforced front sides
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(3*oncenter-heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(4*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(6*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(7*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(9*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(10*oncenter+heightz, widthy/2,(shedheight*inchesinfeet)/2), scale=(heightz, widthy, shedheight*inchesinfeet-2*heightz))

#corners anticlochwise looking down
#looking from outside

#front side left corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2-2*thickness,-thickness-thickness/2,shedheight*inchesinfeet/2-blockwidth/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

#clear scene, make mesh
bpy.ops.object.mode_set(mode = 'OBJECT')

bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2-2*thickness,-thickness-thickness/2,shedheight*inchesinfeet/2-blockwidth/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))
obj = bpy.data.objects["Cube"]
#select vertex
obj = bpy.context.active_object
bpy.ops.object.mode_set(mode = 'EDIT') 
#bpy.ops.mesh.select_mode(type="VERT")
bpy.ops.mesh.select_mode(type="EDGE")
#bpy.ops.mesh.select_mode(type="FACE")
bpy.ops.mesh.select_all(action = 'DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
#obj.data.vertices[2].select = True
obj.data.edges[9].select = True
#obj.data.polygons[2].select = True
bpy.ops.object.mode_set(mode = 'EDIT') 

bpy.ops.mesh.bevel(
offset_type   = 'OFFSET',
offset        = 10,
segments      = 10,
profile       = 0.5,
vertex_only   = False,
    clamp_overlap = False,
    loop_slide    = True,
    material      = -1
)
    
'''
bpy.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-blockwidth/2+thickness/2,-thickness-thickness/2,shedheight*inchesinfeet/2-blockwidth+blockwidth/2+thickness/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

#back end left corner piece
#bpy.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx+thickness,blockwidth/2-thickness-thickness,shedheight*inchesinfeet/2-blockwidth/2), scale=(thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

#back end right corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx+thickness-thickness/2+thickness/2,blockwidth/2+(shedwidth*inchesinfeet)-blockwidth+thickness+thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

#back side left corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(lengthx-blockwidth/2+thickness/2,shedwidth*inchesinfeet+thickness+thickness/2,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

#back side right corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(blockwidth/2-thickness-thickness,shedwidth*inchesinfeet+thickness/2+thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(blockwidth,thickness,shedheight*inchesinfeet+blockwidth))

# front end left corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,thickness+shedwidth*inchesinfeet-blockwidth/2,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

# front end right corner piece
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,blockwidth/2-2*thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))

#window left
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,blockwidth/2-2*thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))
#window right
#inside cladding
#front side
bpy.ops.mesh.primitive_cube_add(size=1, enter_editmode=False, align='WORLD', location=(-thickness-thickness/2,blockwidth/2-2*thickness,shedheight*inchesinfeet/2-blockwidth/2+thickness/2), scale=(-thickness,blockwidth,shedheight*inchesinfeet+blockwidth))
'''

How do you bevel a selected edge?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文