From ca153c971d641debc2d3bd74798adc0caf46a6d1 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Wed, 10 Feb 2021 10:17:03 +0000 Subject: [PATCH] Fixed platters and panels not working in the GUI, a regression. set_config() now puts $cwd in target.scad. use_stl() and use_dxf() included again instead of used. --- scripts/set_config.py | 6 +++++- utils/core/bom.scad | 14 ++++---------- utils/core/core.scad | 12 ++++++++++++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/set_config.py b/scripts/set_config.py index 88bdbfd..8ce381a 100755 --- a/scripts/set_config.py +++ b/scripts/set_config.py @@ -69,7 +69,11 @@ def set_config(target, usage = None): sys.exit(1) fname = source_dir + "/target.scad" - text = ['include \n' % target, '$target = "%s";\n' % target]; + text = ['include \n' % target, + '$target = "%s";\n' % target, + '$cwd="%s";\n' % os.getcwd().replace('\\', '/') + ] + lines = [""] try: with open(fname,"rt") as f: diff --git a/utils/core/bom.scad b/utils/core/bom.scad index e0b279b..cafa638 100644 --- a/utils/core/bom.scad +++ b/utils/core/bom.scad @@ -146,17 +146,11 @@ module dxf(name) { //! Name a dxf that will appear on the B } } -module use_stl(name) { //! Import an STL to make a build platter - stl(name); - path = is_undef($target) ? "/stls/" : str("/", $target, "/stls/"); - import(str($cwd, path, name, ".stl")); -} +module use_stl(name) //! Import an STL to make a build platter + assert(false); // Here for documentation only, real version in core.scad -module use_dxf(name) { //! Import a DXF to make a build panel - dxf(name); - path = is_undef($target) ? "/dxfs/" : str("/", $target, "/dxfs/"); - import(str($cwd, path, name, ".dxf")); -} +module use_dxf(name) //! Import a DXF to make a build panel + assert(false); // Here for documentation only, real version in core.scad function value_string(value) = is_string(value) ? str("\"", value, "\"") : str(value); //! Convert `value` to a string or quote it if it is already a string diff --git a/utils/core/core.scad b/utils/core/core.scad index 62827b4..21b38f3 100644 --- a/utils/core/core.scad +++ b/utils/core/core.scad @@ -25,3 +25,15 @@ include <../../global_defs.scad> // Global functions and modules // use + +module use_stl(name) { //! Import an STL to make a build platter + stl(name); + path = is_undef($target) ? "../stls/" : str($cwd, "/", $target, "/stls/"); + import(str(path, name, ".stl")); +} + +module use_dxf(name) { //! Import a DXF to make a build panel + dxf(name); + path = is_undef($target) ? "../dxfs/" : str($cwd, "/", $target, "/dxfs/"); + import(str(path, name, ".dxf")); +}