Table of Contents

Maison

Module

import bpy
Pygram = bpy.data.texts["pygram.py"].as_module()
Volumes = bpy.data.texts["volumes.py"].as_module()
Pygram.cleanup()

Test

import bpy
Pygram = bpy.data.texts["pygram.py"].as_module()
Volumes = bpy.data.texts["volumes.py"].as_module()
Pygram.cleanup()
 
a = Pygram.Point(0,0,0)
b = Pygram.Point(10,0,0)
l = Pygram.Line(a,b)
v = Pygram.Vector(0,10,0)
j = Pygram.Vector(0,0,10)
 
f = Volumes.extrude(l,v)
c = Volumes.cube(f,j)
print(c)
📢 Object: cube
📢 Face: a 📢 Point:(0,0,0) b 📢 Point:(10,0,0) c 📢 Point:(10.0,10.0,0.0) d 📢 Point:(0.0,10.0,0.0)
📢 Face: a 📢 Point:(10.0,10.0,0.0) b 📢 Point:(0.0,10.0,0.0) c 📢 Point:(0.0,10.0,10.0) d 📢 Point:(10.0,10.0,10.0)
📢 Face: a 📢 Point:(10,0,0) b 📢 Point:(10.0,10.0,0.0) c 📢 Point:(10.0,10.0,10.0) d 📢 Point:(10.0,0.0,10.0)
📢 Face: a 📢 Point:(0,0,0) b 📢 Point:(0.0,10.0,0.0) c 📢 Point:(0.0,10.0,10.0) d 📢 Point:(0.0,0.0,10.0)
📢 Face: a 📢 Point:(0,0,0) b 📢 Point:(10,0,0) c 📢 Point:(10.0,0.0,10.0) d 📢 Point:(0.0,0.0,10.0)

Fonction

def house(x,y,z):
    a = Pygram.Point(0,0,0)
    b = Pygram.Point(10,0,0)
    l = Pygram.Line(a,b)
    v = Pygram.Vector(0,10,0)
    j = Pygram.Vector(0,0,10)
    f = Volumes.extrude(l,v)
    c = Volumes.cube(f,j)
    c.rename("house")
house(0,0,0)

Toit

import bpy
Pygram = bpy.data.texts["pygram.py"].as_module()
Volumes = bpy.data.texts["volumes.py"].as_module()
Pygram.cleanup()
 
def cube(f,v):
  ...
 
 
def house(x,y,z):
    a = Pygram.Point(0,0,0)
    b = Pygram.Point(5,0,0)
    l = Pygram.Line(a,b)
    v = Pygram.Vector(0,5,0)
    h = Pygram.Vector(0,0,2.5)
    f = Volumes.extrude(l,v)
    c = cube(f,h)
    c.rename("house")
 
house(0,0,0)
    # Line 1
    line_1 = Pygram.Line(a1,b1)
    center_1 = line_1.center()
    p1 = center_1.move(v) # move vertically
    print("This is my Line #1")
    print(line_1)

Maison alternative