Govern task context and advance execution pointer
This commit is contained in:
43
tools/web/generated/M16-GAP-00033.py
Normal file
43
tools/web/generated/M16-GAP-00033.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def cube(name: str, location, scale=1.0):
|
||||
mesh = bpy.data.meshes.new(name + "Mesh")
|
||||
vertices = [(-1, -1, -1), (1, -1, -1), (1, 1, -1), (-1, 1, -1), (-1, -1, 1), (1, -1, 1), (1, 1, 1), (-1, 1, 1)]
|
||||
faces = [(0, 1, 2, 3), (4, 7, 6, 5), (0, 4, 5, 1), (1, 5, 6, 2), (2, 6, 7, 3), (4, 0, 3, 7)]
|
||||
mesh.from_pydata(vertices, [], faces)
|
||||
mesh.update()
|
||||
obj = bpy.data.objects.new(name, mesh)
|
||||
bpy.context.collection.objects.link(obj)
|
||||
obj.location = location
|
||||
obj.scale = (scale, scale, scale)
|
||||
return obj
|
||||
|
||||
|
||||
def main(output: pathlib.Path) -> None:
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
source = cube("WebGapBooleanObject", (0.0, 0.0, 0.0), 1.0)
|
||||
cutter = cube("WebGapBooleanCutter", (0.75, 0.0, 0.0), 0.65)
|
||||
cutter.display_type = "WIRE"
|
||||
modifier = source.modifiers.new(name="WebGapBoolean", type="BOOLEAN")
|
||||
modifier.operation = "DIFFERENCE"
|
||||
modifier.solver = "EXACT"
|
||||
modifier.object = cutter
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = True
|
||||
modifier.show_in_editmode = False
|
||||
modifier.show_on_cage = False
|
||||
bpy.context.view_layer.objects.active = source
|
||||
source.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output.resolve()), check_existing=False, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --python M16-GAP-00033.py -- OUTPUT")
|
||||
main(pathlib.Path(arguments[0]))
|
||||
Reference in New Issue
Block a user