Skip to content

Commit

Permalink
#28 - fix paths and resolution for generated pngs from blender
Browse files Browse the repository at this point in the history
  • Loading branch information
kittlerm authored and kaklik committed Aug 1, 2023
1 parent 7aaa13d commit 4b61fb4
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*.gcode
CAD/slicing/*.ini
*.blend1

# vim backup file
*.swp

# MKT my revers link outside from repository for notes
notes
notes.*

# temporary files
**tmp*
**.tmp*
**temp*
**.temp*
1 change: 1 addition & 0 deletions CAD/src/assembly/assembly.scad
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This enable generation png from blender:
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py
include <../../parameters.scad>
$fn=10;

Expand Down
1 change: 1 addition & 0 deletions CAD/src/assembly/assembly_chassi.scad
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

//@set_slicing_config(../slicing/default.ini)
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py

include <../../parameters.scad>
// include <yasim.scad>
Expand Down
1 change: 1 addition & 0 deletions CAD/src/assembly/assembly_pylon.scad
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py
//@set_slicing_config(../slicing/default.ini)
include <../../parameters.scad>

Expand Down
1 change: 1 addition & 0 deletions CAD/src/assembly/assembly_rotor_head.scad
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py
//@set_slicing_config(../slicing/default.ini)
include <../../parameters.scad>
// include <yasim.scad>
Expand Down
1 change: 1 addition & 0 deletions CAD/src/assembly/assembly_rotorhead_complete.scad
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py
include <../../parameters.scad>

include <position/position_rotorhead.scad>
Expand Down
8 changes: 8 additions & 0 deletions CAD/src/assembly/full_assembly.scad
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// This enable generation png from blender:
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py
//
// FIXME: this may fails in generation PNG from blender
// due to parameter in translate
// p3D do not understand remarks /* .. */
// # skip processing from blender
//@no_blend

//@set_slicing_config(../slicing/default.ini)
include <../../parameters.scad>

Expand Down
2 changes: 1 addition & 1 deletion CAD/src/assembly/test/assembly_888_test.scad
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $fn=10;
//include <position/position_888_1002.scad> // Motorova pricka
//include <position/position_888_1003.scad> // Bocnice
include <../position/position_888_1006.scad> // Policka na payload
//include <position/position_888_1007.scad> // spodni pricka pylonu
include <../position/position_888_1007.scad> // spodni pricka pylonu
//include <position/position_888_1008.scad> // horni pricka pylonu
//include <position/position_888_1009.scad> //
//include <position/position_888_1010.scad> // TFSLOT
Expand Down
6 changes: 6 additions & 0 deletions CAD/src/assembly/yasim_assembly.scad
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// FIXME: this may fails in generation PNG from blender
// due to parameter in translate
// p3D do not understand remarks /* .. */
// # skip processing from blender
//@no_blend
//
//@blender_template(../build_manual/blender/build_manual_template.blend)
//@blender_updater=../build_manual/update_render_src.py
//@set_slicing_config(../slicing/default.ini)
include <../../parameters.scad>
include <yasim.scad>
Expand Down
10 changes: 9 additions & 1 deletion CAD/src/build_manual/update_render_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
print("Cela cesta:", config_folder)
print("Nazev konfigurace", config_name)


# FIXME: add dep check

def import_and_rename(stl, name = None):
print("Importing file '{}' with name '{}'.".format(stl, name))
Expand All @@ -57,7 +57,15 @@ def save_blender_file(filename):

def render_png(filename, frame = 0):
print("Rendering file")
# see https://docs.blender.org/api/current/bpy.types.RenderSettings.html
# or https://blenderartists.org/
bpy.context.scene.render.filepath = filename
#bpy.ops.render.render(write_still=True)
# FIXME: set up from json
bpy.context.scene.render.resolution_x = 1024
bpy.context.scene.render.resolution_y = 1024
bpy.context.scene.render.fps = 1
bpy.context.scene.render.image_settings.compression = 100
bpy.ops.render.render(write_still=True)
print("Saving render")

Expand Down
7 changes: 6 additions & 1 deletion utils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ GRN=" \e[32m "
YEL=" \e[33m "
DEF=" \e[39m "

STRICT=-

all: prepare_config default finish

prepare_config:
Expand All @@ -30,7 +32,7 @@ $(AMF_DIR)/%.amf: $(SRC_DIR)/%.scad
@echo "\n\n"
@echo $<
@echo "\n"
-processor3D \
$(STRICT)processor3D \
--output_folder $(GIT_ROOT)/$(OUTPUT_FOLDER) \
--name_prefix $(NAME_PREFIX) \
$(PROCESSOR3D_PARAM) $<
Expand All @@ -46,6 +48,9 @@ ifdef GCD_DIR
LIST_TARGETS += list-targets-gcd
endif

list:
@echo "OUTPUT_FOLDER: $$(cd $(GIT_ROOT) ; cd $(OUTPUT_FOLDER); pwd -P)"

list-targets: ${LIST_TARGETS}

list-targets-amf:
Expand Down

0 comments on commit 4b61fb4

Please sign in to comment.