mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Corrected image generation doubled-commoncode bug.
This commit is contained in:
parent
f9aa81e178
commit
20a21a5d9a
2 changed files with 23 additions and 10 deletions
|
@ -120,7 +120,6 @@ def run_openscad_script(libfile, infile, imgfile, imgsize=(320,240), eye=None, s
|
||||||
class ImageProcessing(object):
|
class ImageProcessing(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.examples = []
|
self.examples = []
|
||||||
self.commoncode = []
|
|
||||||
self.imgroot = ""
|
self.imgroot = ""
|
||||||
self.keep_scripts = False
|
self.keep_scripts = False
|
||||||
self.force = False
|
self.force = False
|
||||||
|
@ -132,9 +131,6 @@ class ImageProcessing(object):
|
||||||
def add_image(self, libfile, imgfile, code, extype):
|
def add_image(self, libfile, imgfile, code, extype):
|
||||||
self.examples.append((libfile, imgfile, code, extype))
|
self.examples.append((libfile, imgfile, code, extype))
|
||||||
|
|
||||||
def set_commoncode(self, code):
|
|
||||||
self.commoncode = code
|
|
||||||
|
|
||||||
def process_examples(self, imgroot, force=False, test_only=False):
|
def process_examples(self, imgroot, force=False, test_only=False):
|
||||||
self.imgroot = imgroot
|
self.imgroot = imgroot
|
||||||
self.force = force
|
self.force = force
|
||||||
|
@ -172,8 +168,6 @@ class ImageProcessing(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
script = ""
|
script = ""
|
||||||
for line in self.commoncode:
|
|
||||||
script += line+"\n"
|
|
||||||
for line in code:
|
for line in code:
|
||||||
script += line+"\n"
|
script += line+"\n"
|
||||||
|
|
||||||
|
@ -547,7 +541,17 @@ class LeafNode(object):
|
||||||
("fig%d" % fignum),
|
("fig%d" % fignum),
|
||||||
"gif" if "Spin" in extype else "png"
|
"gif" if "Spin" in extype else "png"
|
||||||
)
|
)
|
||||||
imgprc.add_image(fileroot+".scad", imgfile, excode, extype)
|
icode = []
|
||||||
|
for line in libnode.includes:
|
||||||
|
icode.append(line)
|
||||||
|
for line in libnode.commoncode:
|
||||||
|
icode.append(line)
|
||||||
|
for line in excode:
|
||||||
|
if line.strip().startswith("--"):
|
||||||
|
icode.append(line.strip()[2:])
|
||||||
|
else:
|
||||||
|
icode.append(line)
|
||||||
|
imgprc.add_image(fileroot+".scad", imgfile, icode, extype)
|
||||||
out.append(extitle)
|
out.append(extitle)
|
||||||
out.append("")
|
out.append("")
|
||||||
out.append(
|
out.append(
|
||||||
|
@ -768,7 +772,17 @@ class Section(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
out.append("")
|
out.append("")
|
||||||
imgprc.add_image(fileroot+".scad", imgfile, figcode, figtype)
|
icode = []
|
||||||
|
for line in libnode.includes:
|
||||||
|
icode.append(line)
|
||||||
|
for line in libnode.commoncode:
|
||||||
|
icode.append(line)
|
||||||
|
for line in figcode:
|
||||||
|
if line.strip().startswith("--"):
|
||||||
|
icode.append(line.strip()[2:])
|
||||||
|
else:
|
||||||
|
icode.append(line)
|
||||||
|
imgprc.add_image(fileroot+".scad", imgfile, icode, figtype)
|
||||||
in_block = False
|
in_block = False
|
||||||
for node in self.leaf_nodes:
|
for node in self.leaf_nodes:
|
||||||
out += node.gen_md(fileroot, imgroot, libnode, self)
|
out += node.gen_md(fileroot, imgroot, libnode, self)
|
||||||
|
@ -849,7 +863,6 @@ class LibFile(object):
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
def gen_md(self, fileroot, imgroot):
|
def gen_md(self, fileroot, imgroot):
|
||||||
imgprc.set_commoncode(self.includes + self.commoncode)
|
|
||||||
out = []
|
out = []
|
||||||
if self.name:
|
if self.name:
|
||||||
out.append("# Library File " + mkdn_esc(self.name))
|
out.append("# Library File " + mkdn_esc(self.name))
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,506];
|
BOSL_VERSION = [2,0,507];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue