Remove .open() call from the .render() method
Having this call there was necessary in the past as the open() method would need the canvas size as a parameter. This is now determined automatically after rendering. Still calling open() is deprecated but won't result in an error.
This commit is contained in:
parent
861c8451e2
commit
0d07f48b7f
|
@ -219,6 +219,7 @@ class Boxes:
|
|||
|
||||
def __init__(self):
|
||||
self.formats = formats.Formats()
|
||||
self.ctx = None
|
||||
description = self.__doc__
|
||||
if self.description:
|
||||
description += "\n\n" + self.description
|
||||
|
@ -277,6 +278,8 @@ class Boxes:
|
|||
|
||||
Call this function from your .render() method
|
||||
"""
|
||||
if self.ctx is not None:
|
||||
return
|
||||
|
||||
self.bedBoltSettings = (3, 5.5, 2, 20, 15) # d, d_nut, h_nut, l, l1
|
||||
self.hexHolesSettings = (5, 3, 'circle') # r, dist, style
|
||||
|
|
|
@ -47,8 +47,6 @@ class BOX(Boxes): # Change class name!
|
|||
# adjust to the variables you want in the local scope
|
||||
x, y, h = self.x, self.y, self.h
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
# Create new Edges here if needed E.g.:
|
||||
s = edges.FingerJointSettings(self.thickness, relative=False,
|
||||
|
|
|
@ -36,8 +36,6 @@ class AllEdges(Boxes):
|
|||
def render(self):
|
||||
x = self.x
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
chars = list(self.edges.keys())
|
||||
chars.sort(key=lambda c: c.lower() + (c if c.isupper() else ''))
|
||||
|
|
|
@ -72,7 +72,6 @@ class AngledBox(Boxes):
|
|||
self.move(tx, ty, move)
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y, h, n = self.x, self.y, self.h, self.n
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@ class AngledCutJig(Boxes): # Change class name!
|
|||
# adjust to the variables you want in the local scope
|
||||
x, y = self.x, self.y
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
th = x * math.tan(math.radians(90-self.angle))
|
||||
l = (x**2 + th**2)**0.5
|
||||
|
|
|
@ -76,8 +76,6 @@ class Arcade(Boxes):
|
|||
self.top = 100-t
|
||||
self.topback = 200-0.5*t
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
# Floor
|
||||
self.rectangularWall(width, self.bottom, "efff", move="up")
|
||||
# Back
|
||||
|
|
|
@ -106,7 +106,6 @@ class BinTray(Boxes):
|
|||
hi = self.hi = h
|
||||
t = self.thickness
|
||||
|
||||
self.open()
|
||||
|
||||
self.addPart(BinFrontEdge(self, self))
|
||||
self.addPart(BinFrontSideEdge(self, self))
|
||||
|
|
|
@ -96,7 +96,6 @@ class CardBox(Boxes):
|
|||
self.fingerHolesAt(0.5*t + (c+t)*i, 0, y, 90)
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
h = self.h
|
||||
t = self.thickness
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ class Castle(Boxes):
|
|||
self.addSettingsArgs(edges.FingerJointSettings)
|
||||
|
||||
def render(self, t_x=70, t_h=250, w1_x=300, w1_h=120, w2_x=100, w2_h=120):
|
||||
self.open()
|
||||
s = edges.FingerJointSettings(10.0, relative=True,
|
||||
space=1, finger=1,
|
||||
width=self.thickness)
|
||||
|
|
|
@ -28,7 +28,6 @@ class ClosedBox(Boxes):
|
|||
self.buildArgParser("x", "y", "h", "outside")
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y, h = self.x, self.y, self.h
|
||||
|
||||
|
|
|
@ -49,8 +49,6 @@ class ConcaveKnob(Boxes):
|
|||
|
||||
def render(self):
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
self.parts.concaveKnob(self.diameter, self.serrations,
|
||||
self.rounded, self.angle,
|
||||
callback=lambda:self.dHole(0, 0,
|
||||
|
|
|
@ -40,8 +40,6 @@ class Display(Boxes):
|
|||
x, h, r = self.x, self.h, self.radius
|
||||
a = self.angle
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
self.roundedPlate(0.7*x, x, r, "e", move="up")
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ class DisplayCase(Boxes):
|
|||
)
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y, h = self.x, self.y, self.h
|
||||
|
||||
|
|
|
@ -61,8 +61,6 @@ class DisplayShelf(Boxes): # change class name here and below
|
|||
if self.outside:
|
||||
x = self.adjustSize(x)
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
a = math.radians(self.angle)
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ in 0.5mm steps, 3 holes each size"""
|
|||
x, y, h = self.x, self.y, self.h
|
||||
t = self.thickness
|
||||
|
||||
self.open()
|
||||
self.edges["f"].settings.setValues(self.thickness, space=3, finger=3, surroundingspaces=1)
|
||||
|
||||
self.rectangularWall(x, h, "FfeF", callback=[self.holesx], move="right")
|
||||
|
|
|
@ -56,7 +56,6 @@ class ElectronicsBox(Boxes):
|
|||
self.fingerHolesAt(self.y, self.h-1.5*t, self.triangle, 180)
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
t = self.thickness
|
||||
self.h = h = self.h + 2*t # compensate for lid
|
||||
|
|
|
@ -116,7 +116,6 @@ class FlexBox(boxes.Boxes):
|
|||
r = min(r, x / 2.0)
|
||||
self.radius = r = min(r, max(0, (y - self.latchsize) / 2.0))
|
||||
|
||||
self.open()
|
||||
|
||||
self.surroundingWall(move="up")
|
||||
self.flexBoxSide(self.x, self.y, self.radius, move="right")
|
||||
|
|
|
@ -105,7 +105,6 @@ class FlexBox2(Boxes):
|
|||
self.radius = min(self.radius, max(0, self.h - self.latchsize))
|
||||
self.c4 = c4 = math.pi * self.radius * 0.5
|
||||
|
||||
self.open()
|
||||
|
||||
self.moveTo(2 * self.thickness, self.thickness)
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ class FlexBox3(Boxes):
|
|||
width = 2 * x + y - 2 * r + c4 + 14 * thickness + 3 * h # lock
|
||||
height = y + z + 8 * thickness
|
||||
|
||||
self.open()
|
||||
|
||||
s = edges.FingerJointSettings(self.thickness, finger=1.,
|
||||
space=1., surroundingspaces=1)
|
||||
|
|
|
@ -110,7 +110,6 @@ class FlexBox4(Boxes):
|
|||
self.radius = min(self.radius, max(0, self.y - self.latchsize))
|
||||
self.c4 = c4 = math.pi * self.radius * 0.5
|
||||
|
||||
self.open()
|
||||
|
||||
self.surroundingWall(move="up")
|
||||
self.flexBoxSide(self.x, self.y, self.radius, move="right")
|
||||
|
|
|
@ -29,7 +29,6 @@ class FlexTest(Boxes):
|
|||
|
||||
def render(self):
|
||||
x, y = self.x, self.y
|
||||
self.open()
|
||||
|
||||
self.moveTo(5, 5)
|
||||
self.edge(10)
|
||||
|
|
|
@ -32,7 +32,6 @@ class FlexTest2(Boxes):
|
|||
def render(self):
|
||||
x, y = self.x, self.y
|
||||
|
||||
self.open()
|
||||
self.rectangularWall(x, y, callback=[lambda: self.flex2D(x, y, self.fw)])
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ class Folder(Boxes):
|
|||
def render(self):
|
||||
x, y, r, h = self.x, self.y, self.r, self.h
|
||||
c2 = math.pi * h
|
||||
self.open()
|
||||
self.moveTo(r + self.thickness, self.thickness)
|
||||
self.edge(x - r)
|
||||
self.edges["X"](c2, y)
|
||||
|
|
|
@ -56,8 +56,6 @@ class Gears(Boxes):
|
|||
def render(self):
|
||||
# adjust to the variables you want in the local scope
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
if not self.shaft2:
|
||||
self.shaft2 = self.shaft1
|
||||
|
|
|
@ -42,8 +42,6 @@ class GearBox(Boxes):
|
|||
help="number of stages in the gear reduction")
|
||||
|
||||
def render(self):
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
if self.teeth2 < self.teeth1:
|
||||
self.teeth2, self.teeth1 = self.teeth1, self.teeth2
|
||||
|
|
|
@ -34,7 +34,6 @@ class HingeBox(Boxes):
|
|||
help="split the lid in y direction (mm)")
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y, h, hl = self.x, self.y, self.h, self.lidheight
|
||||
s = self.splitlid
|
||||
|
|
|
@ -43,7 +43,6 @@ class Hook(Boxes):
|
|||
help="angle of the support underneeth")
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
self.angle = min(self.angle, 80)
|
||||
t = self.thickness
|
||||
|
|
|
@ -33,7 +33,6 @@ class IntegratedHingeBox(Boxes):
|
|||
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y, h, hl = self.x, self.y, self.h, self.lidheight
|
||||
|
||||
|
|
|
@ -80,8 +80,6 @@ class JigsawPuzzle(Boxes): # change class name here and below
|
|||
def render(self):
|
||||
size = self.size
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
self.burn = 0.0
|
||||
self.moveTo(10, 10)
|
||||
self.hilbert(self.depth)
|
||||
|
|
|
@ -90,7 +90,6 @@ class Lamp(Boxes):
|
|||
h : height box
|
||||
"""
|
||||
|
||||
self.open()
|
||||
|
||||
# self.edges["f"].settings = (5, 5) # XXX
|
||||
|
||||
|
|
|
@ -85,7 +85,6 @@ parts sliding on each other to reduce friction.
|
|||
def render(self):
|
||||
t = self. thickness
|
||||
h_max, h_min, h_extra = self.maxheight, self.minheight,self.extraheight
|
||||
self.open()
|
||||
|
||||
if h_extra and h_extra < 2*t:
|
||||
h_extra = 2*t
|
||||
|
|
|
@ -35,7 +35,6 @@ class LBeam(Boxes):
|
|||
y = self.adjustSize(y, False)
|
||||
|
||||
|
||||
self.open()
|
||||
|
||||
self.rectangularWall(x, h, "eFee", move="right")
|
||||
self.rectangularWall(y, h, "eeef")
|
||||
|
|
|
@ -69,7 +69,6 @@ class MagazinFile(Boxes):
|
|||
self.hi = hi = self.hi or (h / 2.0)
|
||||
t = self.thickness
|
||||
|
||||
self.open()
|
||||
|
||||
with self.saved_context():
|
||||
self.rectangularWall(x, h, "Ffef", move="up")
|
||||
|
|
|
@ -36,7 +36,6 @@ class NemaMount(Boxes):
|
|||
|
||||
x = y = h = motor + 2*t
|
||||
|
||||
self.open()
|
||||
|
||||
self.rectangularWall(x, y, "ffef", callback=[
|
||||
lambda: self.NEMA(self.size, x/2, y/2)], move="right")
|
||||
|
|
|
@ -35,7 +35,6 @@ class OpenBox(Boxes):
|
|||
y = self.adjustSize(y, False)
|
||||
h = self.adjustSize(h, False)
|
||||
|
||||
self.open()
|
||||
|
||||
d2 = [edges.Bolts(2)]
|
||||
d3 = [edges.Bolts(3)]
|
||||
|
|
|
@ -126,8 +126,6 @@ class OrganPipe(Boxes): # Change class name!
|
|||
|
||||
total_length = resonator_length + base_length
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
e = ["f", "e",
|
||||
edges.CompoundEdge(self, "fef", (resonator_length - mouth_height - 10*t, mouth_height + 10*t, base_length)), "f"]
|
||||
|
|
|
@ -98,7 +98,6 @@ class OttoBody(Boxes):
|
|||
self.move(w+4, h+8+t, move)
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
self.x = x = 60.
|
||||
self.y = y = 60.
|
||||
|
|
|
@ -104,8 +104,6 @@ class OttoLegs(Boxes):
|
|||
def render(self):
|
||||
# adjust to the variables you want in the local scope
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
ws = 25
|
||||
lx, ly, lh = 12.4, 23.5, max(self.length, ws+6+t)
|
||||
|
|
|
@ -45,8 +45,6 @@ class OttoSoles(Boxes):
|
|||
w2 = w * 2**0.5 - c2 / 2
|
||||
d = w * math.tan(math.radians(22.5))
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
self.edges["d"].settings.setValues(w, size=0.4, depth=0.3,
|
||||
radius=0.05)
|
||||
|
|
|
@ -68,8 +68,6 @@ class PaintStorage(Boxes):
|
|||
x, y = self.x, self.y
|
||||
t = self.thickness
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
stack = self.edges['s'].settings
|
||||
h = self.canheight - stack.height - stack.holedistance + t
|
||||
|
|
|
@ -49,8 +49,6 @@ class Planetary(Boxes):
|
|||
# help="number of stages in the gear reduction")
|
||||
|
||||
def render(self):
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
ringteeth = self.sunteeth + 2 * self.planetteeth
|
||||
spoke_width = 3 * self.shaft
|
||||
|
|
|
@ -77,8 +77,6 @@ class Planetary2(Boxes):
|
|||
|
||||
|
||||
def render(self):
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
ringteeth = self.sunteeth + 2 * self.planetteeth
|
||||
t = self.thickness
|
||||
|
|
|
@ -99,8 +99,6 @@ class PoleHook(Boxes): # change class name here and below
|
|||
# adjust to the variables you want in the local scope
|
||||
d = self.diameter
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
shh = self.screwheadheight
|
||||
self.bedBoltSettings = (self.screw, self.screwhead, shh, d/4+shh, d/4) # d, d_nut, h_nut, l, l
|
||||
|
|
|
@ -69,8 +69,6 @@ class Pulley(Boxes):
|
|||
def render(self):
|
||||
# adjust to the variables you want in the local scope
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
if self.top:
|
||||
self.disk(
|
||||
|
|
|
@ -63,7 +63,6 @@ class Rack19Box(Boxes):
|
|||
|
||||
|
||||
def _render(self, type):
|
||||
self.open()
|
||||
|
||||
t = self.thickness
|
||||
self.h = h = self.height * 44.45 - 0.787 - t
|
||||
|
|
|
@ -64,7 +64,6 @@ class RackBox(Boxes):
|
|||
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
t = self.thickness
|
||||
self.h = h = self.h + 2*t # compensate for lid
|
||||
|
|
|
@ -62,8 +62,6 @@ class RectangularWall(Boxes):
|
|||
|
||||
def render(self):
|
||||
# adjust to the variables you want in the local scope
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
t = self.thickness
|
||||
|
||||
self.edgetypes = [self.bottom_edge, self.right_edge, self.top_edge, self.left_edge]
|
||||
|
|
|
@ -38,7 +38,6 @@ class RegularBox(Boxes):
|
|||
help="style of the top and lid")
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
r, h, n = self.radius, self.h, self.n
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@ class RobotArm(Boxes): # change class name here and below
|
|||
help="length of segment axle to axle")
|
||||
|
||||
def render(self):
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
for i in range(5, 0,-1):
|
||||
armtype = getattr(self, "type%i" % i)
|
||||
|
|
|
@ -189,8 +189,6 @@ class Rotary(Boxes):
|
|||
a = self.a = self.axle
|
||||
bw, bh = self.beamwidth, self.beamheight
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
# self.spacing = 0.1 * t
|
||||
|
||||
# Change settings of default edges if needed. E.g.:
|
||||
|
|
|
@ -58,7 +58,6 @@ class RoundedBox(Boxes):
|
|||
self.corner(90, r)
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y, h, r = self.x, self.y, self.h, self.radius
|
||||
|
||||
|
|
|
@ -163,8 +163,6 @@ class RoyalGame(Boxes): # Change class name!
|
|||
self.size = size = x / 8.0
|
||||
h = size/2 * 3**0.5
|
||||
y = 3 * size
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
self.rectangularWall(x, h, "FLFF", move="right")
|
||||
self.rectangularWall(y, h, "nlmE", callback=[
|
||||
|
|
|
@ -159,8 +159,6 @@ class ShutterBox(Boxes):
|
|||
self.radius = r = min(r, h/2)
|
||||
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
self.ctx.save()
|
||||
self.side(x, h, r, style, move="right")
|
||||
self.side(x, h, r, style, move="right")
|
||||
|
|
|
@ -91,7 +91,6 @@ class Silverware(Boxes):
|
|||
h = self.h
|
||||
r = self.cornerradius
|
||||
|
||||
self.open()
|
||||
t = self.thickness
|
||||
b = self.burn
|
||||
|
||||
|
|
|
@ -86,8 +86,6 @@ class Stachel(Boxes):
|
|||
|
||||
|
||||
def render(self):
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
ri = self.flutediameter / 2.0
|
||||
ro = ri + self.wall
|
||||
|
|
|
@ -122,8 +122,6 @@ When turned by 90°, it can be also used to create a bottle holder."""
|
|||
|
||||
th = n * (h + t) - t
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
self.addPart(ShadyEdge(self, None))
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ class TrayInsert(Boxes):
|
|||
h = self.h
|
||||
t = self.thickness
|
||||
|
||||
self.open()
|
||||
|
||||
# Inner walls
|
||||
for i in range(len(self.sx) - 1):
|
||||
|
|
|
@ -151,7 +151,6 @@ class TrayLayout2(TrayLayout):
|
|||
for f in line:
|
||||
hasfloor |= f
|
||||
|
||||
self.open()
|
||||
|
||||
self.edges["s"] = boxes.edges.Slot(self, self.hi / 2.0)
|
||||
self.edges["C"] = boxes.edges.CrossingFingerHoleEdge(self, self.hi)
|
||||
|
|
|
@ -44,8 +44,6 @@ class TwoPiece(Boxes):
|
|||
y -= 4*t + 2*p
|
||||
h -= 2 * t
|
||||
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
|
||||
# Adjust h edge with play
|
||||
self.edges["f"].settings.setValues(t, False, edge_width=self.edges["f"].settings.edge_width + p)
|
||||
|
|
|
@ -88,7 +88,6 @@ class TypeTray(_TopEdge):
|
|||
hi = self.hi = self.hi or h
|
||||
t = self.thickness
|
||||
|
||||
self.open()
|
||||
|
||||
# outer walls
|
||||
b = self.bottom_edge
|
||||
|
|
|
@ -93,7 +93,6 @@ class UBox(_TopEdge, _ChestLid):
|
|||
|
||||
self.radius = r = min(r, x/2.0, y)
|
||||
|
||||
self.open()
|
||||
|
||||
t1, t2, t3, t4 = self.topEdges(self.top_edge)
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ class UnevenHeightBox(Boxes):
|
|||
|
||||
|
||||
def render(self):
|
||||
self.open()
|
||||
|
||||
x, y = self.x, self.y
|
||||
heights = [self.height0, self.height1, self.height2, self.height3]
|
||||
|
|
|
@ -56,7 +56,6 @@ class UniversalBox(_TopEdge, _ChestLid):
|
|||
x, y, h = self.x, self.y, self.h
|
||||
t = self.thickness
|
||||
|
||||
self.open()
|
||||
|
||||
t1, t2, t3, t4 = self.topEdges(self.top_edge)
|
||||
b = self.edges.get(self.bottom_edge, self.edges["F"])
|
||||
|
|
|
@ -46,8 +46,6 @@ class WaivyKnob(Boxes):
|
|||
|
||||
def render(self):
|
||||
t = self.thickness
|
||||
# Initialize canvas
|
||||
self.open()
|
||||
angle = self.serrationangle
|
||||
self.parts.waivyKnob(self.diameter, self.serrations, angle,
|
||||
callback=lambda:self.dHole(0, 0, d=self.bolthole,
|
||||
|
|
|
@ -110,7 +110,6 @@ class WineRack(Boxes):
|
|||
self.cy = cy = int((y-dy-t) // (r+dy))
|
||||
self.delta = 3**0.5/6.*t
|
||||
|
||||
self.open()
|
||||
self.rectangularWall(x, y, callback=[self.wallCB], move="up")
|
||||
self.rectangularWall(x, y, callback=[lambda:self.wallCB(backwall=True)], move="up")
|
||||
self.rectangularWall(x, y, callback=[lambda:self.wallCB(frontwall=True)], move="up")
|
||||
|
|
|
@ -68,6 +68,7 @@ def run_generator(name, args):
|
|||
if lower_name in generators.keys():
|
||||
box = generators[lower_name]()
|
||||
box.parseArgs(args)
|
||||
box.open()
|
||||
box.render()
|
||||
box.close()
|
||||
else:
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"scrolled": true
|
||||
},
|
||||
|
@ -36,7 +36,7 @@
|
|||
"data": {
|
||||
"image/svg+xml": [
|
||||
"<svg height=\"210mm\" version=\"1.1\" viewBox=\"0 9790 170 210\" width=\"170mm\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
|
||||
"<g id=\"surface4\">\n",
|
||||
"<g id=\"surface11\">\n",
|
||||
"<path d=\"M 150 50.103125 L 0 50.103125 M 0 50.103125 L -3 50.103125 C -3.054688 50.103125 -3.101562 50.060156 -3.101562 50.001562 M -3.101562 50.001562 L -3.101562 50.001562 M -3.101562 50.001562 L -3.101562 37.001562 M -3.101562 37.001562 C -3.101562 36.946875 -3.058594 36.9 -3 36.9 M -3 36.9 L 0 36.9 C -0.0546875 36.9 -0.101562 36.942969 -0.101562 37.001562 M -0.101562 37.001562 L -0.101562 28.001562 C -0.101562 28.05625 -0.0585938 28.103125 0 28.103125 M 0 28.103125 L -3 28.103125 C -3.054688 28.103125 -3.101562 28.060156 -3.101562 28.001562 M -3.101562 28.001562 L -3.101562 22.001562 M -3.101562 22.001562 C -3.101562 21.946875 -3.058594 21.9 -3 21.9 M -3 21.9 L 0 21.9 C -0.0546875 21.9 -0.101562 21.942969 -0.101562 22.001562 M -0.101562 22.001562 L -0.101562 13.001562 C -0.101562 13.05625 -0.0585938 13.103125 0 13.103125 M 0 13.103125 L -3 13.103125 C -3.054688 13.103125 -3.101562 13.060156 -3.101562 13.001562 M -3.101562 13.001562 L -3.101562 0.0015625 M -3.101562 0.0015625 L -3.101562 -5.998438 C -3.101562 -6.053125 -3.058594 -6.1 -3 -6.1 M -3 -6.1 L 0 -6.1 M 0 0.0015625 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-1,-0.000000000000000122,-0.000000000000000122,1,153.851562,9949.045313)\"/>\n",
|
||||
"<path d=\"M 0 -0.000000000000028422 C 1.867188 -0.000000000000028422 1.867188 -2.796875 0 -2.796875 C -1.863281 -2.796875 -1.863281 -0.000000000000028422 0 -0.000000000000028422 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(-0.000000000000000184,-1,-1,0.000000000000000184,142.453125,9959.046875)\"/>\n",
|
||||
"<path d=\"M 0 0 C -0.0546875 0 -0.101562 0.046875 -0.101562 0.101562 M -0.101562 0.101562 L -0.101562 -2.898438 C -0.101562 -2.84375 -0.0585938 -2.796875 0 -2.796875 M 0 -2.796875 L -9 -2.796875 C -8.945312 -2.796875 -8.898438 -2.839844 -8.898438 -2.898438 M -8.898438 -2.898438 L -8.898438 0.101562 C -8.898438 0.046875 -8.941406 0 -9 0 M -9 0 L 0 0 \" style=\"fill:none;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,100%);stroke-opacity:1;stroke-miterlimit:10;\" transform=\"matrix(1,-0,-0,-1,143.351562,9946.046875)\"/>\n",
|
||||
|
@ -96,7 +96,6 @@
|
|||
" def render(self):\n",
|
||||
" x, y, h = self.x, self.y, self.h\n",
|
||||
" t = self.thickness\n",
|
||||
" self.open()\n",
|
||||
" \n",
|
||||
" # render-magic goes here\n",
|
||||
" \n",
|
||||
|
@ -113,6 +112,7 @@
|
|||
"b = Example()\n",
|
||||
"fd, fn = tempfile.mkstemp()\n",
|
||||
"b.parseArgs(['--reference=0', '--debug=0', '--output=' + fn])\n",
|
||||
"b.open()\n",
|
||||
"b.render()\n",
|
||||
"b.close()\n",
|
||||
"\n",
|
||||
|
|
|
@ -395,6 +395,7 @@ Create boxes and more with a laser cutter!
|
|||
box.format,
|
||||
[('Content-type', 'application/unknown; charset=utf-8')]))
|
||||
fd, box.output = tempfile.mkstemp()
|
||||
box.open()
|
||||
box.render()
|
||||
box.close()
|
||||
result = open(box.output).readlines()
|
||||
|
|
Loading…
Reference in New Issue