Boxes.py More than a Box generator Florian Festi 2014/03/15 - - PowerPoint PPT Presentation

boxes py more than a box generator
SMART_READER_LITE
LIVE PREVIEW

Boxes.py More than a Box generator Florian Festi 2014/03/15 - - PowerPoint PPT Presentation

Boxes.py More than a Box generator Florian Festi 2014/03/15 Mainframe Hackspace Oldenburg Outline Brief overview Showing existing objects How to use and adjust Software architecture and how to use it Outlook Motivation


slide-1
SLIDE 1

Boxes.py More than a Box generator

Florian Festi 2014/03/15 Mainframe Hackspace Oldenburg

slide-2
SLIDE 2

Outline

  • Brief overview
  • Showing existing objects
  • How to use and adjust
  • Software architecture and how to use it
  • Outlook
slide-3
SLIDE 3

Motivation

  • Boxes for the Lasercutter
  • Drawing (finger) joints in CAD is a drag
  • Online box generators only allow fixed styles
  • No flexible opensource generators found
slide-4
SLIDE 4

What?

  • Box generator
  • Written in Python
  • Creates SVG
  • Several supported models
  • Library for own creations
  • Supports flex, finger and flat dovetail joints
  • Can be use to create more complicated things than

a simple box

slide-5
SLIDE 5

Features

  • Flex
  • Finger joints
  • Dovetail joints (flat only)
  • Holes in honey comb pattern
  • Several finished Models
slide-6
SLIDE 6

Box.py

slide-7
SLIDE 7

Box2.py

slide-8
SLIDE 8

Box3.py

slide-9
SLIDE 9

Flexbox.py

slide-10
SLIDE 10

Flexbox2.py

slide-11
SLIDE 11

Flexbox3.py

slide-12
SLIDE 12

Typetray

slide-13
SLIDE 13

Magazinefile.py

slide-14
SLIDE 14

Folder.py

slide-15
SLIDE 15

Silverwarebox

slide-16
SLIDE 16

Drillbox.py

slide-17
SLIDE 17

Castle.py

slide-18
SLIDE 18

Lamp.py

slide-19
SLIDE 19

Getting started

  • Get from https://github.com/florianfesti/boxes

– Git clone – Or download

  • Requires Python 2 or 3

– Defaults to /usr/bin/python

  • And Pycairo

– Package pycairo, python-cairo or python3-cairo – Windows install instructions still wanted

slide-20
SLIDE 20

Using boxes.py

  • Select script you want to use

– You don't want boxes.py

  • Adjust sizes and parameters
  • Execute script
  • Find result in box.svg
slide-21
SLIDE 21

Adjusting Sizes

  • Skip to the end of the file
  • Edit params given
  • E.g. in Flexbox2.py:

if __name__=="__main__": b = FlexBox(50, 70, 50, r=25, thickness=3.0) b.render()

slide-22
SLIDE 22

Typical Parameters

  • x, y, z, h: inner sizes

– Often x,y is the side view and z width

  • r: radius of corners
  • thickness: strength of the wood

– Influences how joints are made

  • burn: correction for the beam width

– This is the radius of the beam – the amount of the offset at one side

slide-23
SLIDE 23

Fingerjoint Settings

b.edges["f"].settings.setValues( b.thickness, space=3, finger=3, surroundingspaces=1)

  • Space: width in between fingers
  • Finger: width of fingers
  • Surroundingspaces: width at the end of the edge
  • All in multiples of thickness

– as passed as first param

slide-24
SLIDE 24

Using the boxes Framework

  • Several layers of abstraction
  • Base class Boxes in boxes.py
  • Scripts sub class Boxes
slide-25
SLIDE 25

Primitives and Building blocks

  • Cairo primitives (on self.ctx)
  • Building blocks

– Get coordinates passed to them – Text and all kind of holes

  • self.moveTo(x, y, dir)

– Change coordinate system to given point

  • self.ctx.save()
  • self.ctx.restore()

– To return to previous positions

slide-26
SLIDE 26

Turtle Graphics Commands

  • Edges and corners
  • Start at 0, 0 heading right
  • Move coordinate system to their endpoint
  • And their end orientation
  • Part is above the X Axis

– Go to right and turn mathematically positive – to get a closed part

  • Automatically do burn correction
slide-27
SLIDE 27

Edges

  • Classes on their own
  • Separate Settings classes
  • Allow sharing of settings among both sides
  • Boxes.edges[char] and Boxes.name
  • width: outset needed to begin this edge
  • margin: additional space needed (e.g. fingers)
slide-28
SLIDE 28

Parts

  • Walls and pieces

– rectangularWall() – roundedPlate() – surroundingWall()

  • move parameter

– right, left up, down, only

  • Callback for all sides

– To put holes and other building blocks – Pass either single function or list of callables

slide-29
SLIDE 29

Edges parameter

  • Iterable with characters or Edge objects
  • e, E: straight edge, normal and outset
  • f, F: Finger joints
  • h: Straight edge with holes for finger joint
  • d, D: Dovetails joints
  • X: Flex edge
  • You can register your own edges
  • Or pass them as Objects
slide-30
SLIDE 30

Still missing

  • Command line interface
  • Smarter output file name (scriptname + params)
  • Support for Edges other than 90°

– Switch lamp.py over to hexagonal head

  • Cleaning stuff up
  • Patches welcome!
slide-31
SLIDE 31

Questions?