Skip to content

Commit

Permalink
renderscripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yjh0502 committed Jan 1, 2023
1 parent 5143b92 commit 2bca9ad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import bpy

import sys
argv = sys.argv
argv = argv[argv.index("--") + 1:]

prefix = argv[0]
idx = argv[1]

infile = "{}/gcode/gcode_{}.obj".format(prefix, idx)
outfile = "{}/gcode/render/gcode_{}.png".format(prefix, idx)

bpy.context.scene.render.filepath = outfile
bpy.ops.import_scene.obj(filepath=infile, axis_forward="X", axis_up="Z")
ob = bpy.context.selected_objects[0]
ob.data.materials[0] = bpy.data.materials["red"]
bpy.ops.render.render(write_still=True)
bpy.ops.object.delete()
4 changes: 4 additions & 0 deletions render.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash


seq 1 100 | xargs -P8 -n1 "$BLENDER" -b tdp.blend --background --python render.py -- $PWD
Binary file added tdp.blend
Binary file not shown.

0 comments on commit 2bca9ad

Please sign in to comment.