output folder fixes

This commit is contained in:
apun
2025-05-01 04:27:02 -04:00
parent 51352e16f9
commit 197c4692a8
2 changed files with 12 additions and 8 deletions
+7 -4
View File
@@ -21,10 +21,13 @@ def main():
# Take user input
filename = input('Enter a filename to save the output image (default=output.png): ')
base = os.path.splitext(filename)[0] if filename else 'output'
txt_filename = base + '.txt'
ldr_filename = base + '.ldr'
img_filename = base + '.png'
output_dir = os.path.dirname(filename)
if output_dir:
os.makedirs(output_dir, exist_ok=True)
base_name = os.path.splitext(filename)[0] if filename else 'output'
txt_filename = os.path.abspath(base_name + '.txt')
ldr_filename = os.path.abspath(base_name + '.ldr')
img_filename = os.path.abspath(base_name + '.png')
seed = input('Enter a generation seed (default=42): ')
seed = int(seed) if seed else 42
+5 -4
View File
@@ -20,6 +20,9 @@ def render_lego(
fov: float = 45,
img_resolution: int = 512,
) -> None:
in_file = os.path.abspath(in_file)
out_file = os.path.abspath(out_file)
plugin_path = Path(ImportLDraw.__file__).parent
ldraw_lib_path = Path.home() / 'ldraw'
@@ -121,10 +124,8 @@ def main():
args = parser.parse_args()
# Get the absolute path of the input file
in_file = os.path.abspath(args.in_file)
out_file = os.path.abspath(args.out_file)
render_lego(in_file, out_file, square_image=True, instructions_look=False)
print(f'Rendered image to {out_file}')
render_lego(args.in_file, args.out_file, square_image=True, instructions_look=False)
print(f'Rendered image to {args.out_file}')
if __name__ == '__main__':