Fix typos and docstrings
This commit is contained in:
parent
d2d2d15de3
commit
5fae61bd0d
|
@ -46,16 +46,15 @@ def dist(dx, dy):
|
|||
Return distance
|
||||
|
||||
:param dx: delta x
|
||||
:param dy: delat y
|
||||
:param dy: delay y
|
||||
"""
|
||||
return (dx * dx + dy * dy) ** 0.5
|
||||
|
||||
def restore(func):
|
||||
"""
|
||||
Wrapper: Restore coordiantes after function
|
||||
Wrapper: Restore coordinates after function
|
||||
|
||||
:param func: function to wrap
|
||||
|
||||
"""
|
||||
|
||||
@wraps(func)
|
||||
|
@ -73,7 +72,6 @@ def holeCol(func):
|
|||
Wrapper: color holes differently
|
||||
|
||||
:param func: function to wrap
|
||||
|
||||
"""
|
||||
|
||||
@wraps(func)
|
||||
|
@ -150,7 +148,6 @@ def argparseSections(s):
|
|||
Parse sections parameter
|
||||
|
||||
:param s: string to parse
|
||||
|
||||
"""
|
||||
|
||||
result = []
|
||||
|
@ -405,8 +402,8 @@ class Boxes:
|
|||
"""
|
||||
Add commonly used arguments
|
||||
|
||||
:param \*l: parameter names
|
||||
:param \*\*kw: parameters with new default values
|
||||
:param l: parameter names
|
||||
:param kw: parameters with new default values
|
||||
|
||||
Supported parameters are
|
||||
|
||||
|
@ -509,7 +506,6 @@ class Boxes:
|
|||
Parse command line parameters
|
||||
|
||||
:param args: (Default value = None) parameters, None for using sys.argv
|
||||
|
||||
"""
|
||||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
|
@ -543,7 +539,6 @@ class Boxes:
|
|||
|
||||
:param part: Callable
|
||||
:param name: (Default value = None) attribute name (__name__ as default)
|
||||
|
||||
"""
|
||||
if name is None:
|
||||
name = part.__class__.__name__
|
||||
|
@ -654,7 +649,8 @@ class Boxes:
|
|||
def render(self):
|
||||
"""Implement this method in your subclass.
|
||||
|
||||
You will typically need to call .parseArgs() before calling this one"""
|
||||
You will typically need to call .parseArgs() before calling this one
|
||||
"""
|
||||
self.open()
|
||||
# Change settings and create new Edges and part classes here
|
||||
raise NotImplementedError
|
||||
|
@ -667,7 +663,6 @@ class Boxes:
|
|||
:param number: number of the callback
|
||||
:param x: (Default value = 0.0) x position to be call on
|
||||
:param y: (Default value = None) y position to be called on (default does burn correction)
|
||||
|
||||
"""
|
||||
if y is None:
|
||||
y = self.burn
|
||||
|
@ -694,7 +689,6 @@ class Boxes:
|
|||
|
||||
:param param: list or item
|
||||
:param idx: index in list
|
||||
|
||||
"""
|
||||
if isinstance(param, list):
|
||||
if len(param) > idx:
|
||||
|
@ -740,7 +734,6 @@ class Boxes:
|
|||
|
||||
:param degrees: angle
|
||||
:param radius: (Default value = 0)
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
|
@ -798,7 +791,6 @@ class Boxes:
|
|||
"""
|
||||
Simple line
|
||||
:param length: length in mm
|
||||
|
||||
"""
|
||||
self.ctx.move_to(0, 0)
|
||||
if tabs and self.tabs:
|
||||
|
@ -823,7 +815,7 @@ class Boxes:
|
|||
|
||||
def step(self, out):
|
||||
"""
|
||||
Create a parallel step prependicular to the current direction
|
||||
Create a parallel step perpendicular to the current direction
|
||||
Positive values move to the outside of the part
|
||||
"""
|
||||
if out > 1E-5:
|
||||
|
@ -844,7 +836,6 @@ class Boxes:
|
|||
:param y2:
|
||||
:param x3:
|
||||
:param y3:
|
||||
|
||||
"""
|
||||
self.ctx.curve_to(x1, y1, x2, y2, x3, y3)
|
||||
dx = x3 - x2
|
||||
|
@ -856,7 +847,7 @@ class Boxes:
|
|||
"""
|
||||
Draw multiple connected lines
|
||||
|
||||
:param \*args: Alternating length in mm and angle in degrees.
|
||||
:param args: Alternating length in mm and angle in degrees.
|
||||
|
||||
lengths may be a tuple (length, #tabs)
|
||||
angles may be tuple (angle, radius)
|
||||
|
@ -878,8 +869,7 @@ class Boxes:
|
|||
Draw an edge with slot for a bed bolt
|
||||
|
||||
:param length: length of the edge in mm
|
||||
:param bedBoltSettings: (Default value = None) Dimmensions of the slot
|
||||
|
||||
:param bedBoltSettings: (Default value = None) Dimensions of the slot
|
||||
"""
|
||||
d, d_nut, h_nut, l, l1 = bedBoltSettings or self.bedBoltSettings
|
||||
self.edge((length - d) / 2.0, tabs=tabs//2)
|
||||
|
@ -953,7 +943,7 @@ class Boxes:
|
|||
"""Create regular polygon as a wall
|
||||
|
||||
:param corners: number of corners of the polygon
|
||||
:param radius: distance center to one of the corners
|
||||
:param r: radius distance center to one of the corners
|
||||
:param h: distance center to one of the sides (height of sector)
|
||||
:param side: length of one side
|
||||
:param edges: (Default value = "e", may be string/list of length corners)
|
||||
|
@ -1002,11 +992,10 @@ class Boxes:
|
|||
self.move(tw, th, move)
|
||||
|
||||
def grip(self, length, depth):
|
||||
"""Corrugated edge useful as an gipping area
|
||||
"""Corrugated edge useful as a gipping area
|
||||
|
||||
:param length: length
|
||||
:param depth: depth of the grooves
|
||||
|
||||
"""
|
||||
grooves = max(int(length // (depth * 2.0)) + 1, 1)
|
||||
depth = length / grooves / 4.0
|
||||
|
@ -1017,9 +1006,7 @@ class Boxes:
|
|||
|
||||
def _latchHole(self, length):
|
||||
"""
|
||||
|
||||
:param length:
|
||||
|
||||
"""
|
||||
self.edge(1.1 * self.thickness)
|
||||
self.corner(-90)
|
||||
|
@ -1029,9 +1016,7 @@ class Boxes:
|
|||
|
||||
def _latchGrip(self, length):
|
||||
"""
|
||||
|
||||
:param length:
|
||||
|
||||
"""
|
||||
self.corner(90, self.thickness / 4.0)
|
||||
self.grip(length / 2.0 - self.thickness / 2.0 - 0.2 * self.thickness, self.thickness / 2.0)
|
||||
|
@ -1043,7 +1028,6 @@ class Boxes:
|
|||
:param length: length in mm
|
||||
:param positive: (Default value = True) False: Door side; True: Box side
|
||||
:param reverse: (Default value = False) True when running away from the latch
|
||||
|
||||
"""
|
||||
if positive:
|
||||
if reverse:
|
||||
|
@ -1075,7 +1059,6 @@ class Boxes:
|
|||
:param h: height in mm
|
||||
:param hl: height if th grip hole
|
||||
:param r: (Default value = 30) radius of the corners
|
||||
|
||||
"""
|
||||
d = (x - hl - 2 * r) / 2.0
|
||||
|
||||
|
@ -1108,7 +1091,6 @@ class Boxes:
|
|||
:param x:
|
||||
:param y: (Default value = 0.0)
|
||||
:param degrees: (Default value = 0)
|
||||
|
||||
"""
|
||||
self.ctx.move_to(0, 0)
|
||||
self.ctx.translate(x, y)
|
||||
|
@ -1137,7 +1119,6 @@ class Boxes:
|
|||
Set coordinate system to current position (end point)
|
||||
|
||||
:param angle: (Default value = 0) heading
|
||||
|
||||
"""
|
||||
self.ctx.translate(*self.ctx.get_current_point())
|
||||
self.ctx.rotate(angle)
|
||||
|
@ -1147,16 +1128,15 @@ class Boxes:
|
|||
where can be combinations of "up" or "down", "left" or "right", "only",
|
||||
"mirror" and "rotated"
|
||||
when "only" is included the move is only done when before is True
|
||||
"mirror" will flip the part along the y axis
|
||||
"mirror" will flip the part along the y-axis
|
||||
"rotated" draws the parts rotated 90 counter clockwise
|
||||
The function returns whether actual drawing of the part
|
||||
should be ommited.
|
||||
should be omitted.
|
||||
|
||||
:param x: width of part
|
||||
:param y: height of part
|
||||
:param where: which direction to move
|
||||
:param before: (Default value = False) called before or after part being drawn
|
||||
|
||||
"""
|
||||
if not where:
|
||||
where = ""
|
||||
|
@ -1221,9 +1201,8 @@ class Boxes:
|
|||
Draw a round disc
|
||||
|
||||
:param x: position
|
||||
:param y: postion
|
||||
:param y: position
|
||||
:param r: radius
|
||||
|
||||
"""
|
||||
r += self.burn
|
||||
self.moveTo(x + r, y)
|
||||
|
@ -1242,11 +1221,10 @@ class Boxes:
|
|||
Draw a hole in shape of an n-edged regular polygon
|
||||
|
||||
:param x: position
|
||||
:param y: postion
|
||||
:param y: position
|
||||
:param r: radius
|
||||
:param n: number of edges
|
||||
:param a: rotation angle
|
||||
|
||||
"""
|
||||
|
||||
if not r:
|
||||
|
@ -1287,9 +1265,8 @@ class Boxes:
|
|||
Draw a round hole
|
||||
|
||||
:param x: position
|
||||
:param y: postion
|
||||
:param y: position
|
||||
:param r: radius
|
||||
|
||||
"""
|
||||
|
||||
if not r:
|
||||
|
@ -1313,7 +1290,6 @@ class Boxes:
|
|||
:param r: (Default value = 0) radius of the corners
|
||||
:param center_x: (Default value = True) if True, x position is the center, else the start
|
||||
:param center_y: (Default value = True) if True, y position is the center, else the start
|
||||
|
||||
"""
|
||||
r = min(r, dx/2., dy/2.)
|
||||
x_start = x if center_x else x + dx / 2.0
|
||||
|
@ -1336,8 +1312,7 @@ class Boxes:
|
|||
:param d: diameter
|
||||
:param w: width measured against flat side in mm
|
||||
:param rel_w: width in percent
|
||||
:param angle: orentation (rotation) of the flat side
|
||||
|
||||
:param angle: orientation (rotation) of the flat side
|
||||
"""
|
||||
|
||||
if r is None:
|
||||
|
@ -1370,7 +1345,6 @@ class Boxes:
|
|||
:param w: width measured against flat side in mm
|
||||
:param rel_w: width in percent
|
||||
:param angle: orientation (rotation) of the flat sides
|
||||
|
||||
"""
|
||||
|
||||
if r is None:
|
||||
|
@ -1401,11 +1375,10 @@ class Boxes:
|
|||
Draw a pear shaped mounting hole for sliding over a screw head. Total height = 1.5* d_shaft + d_head
|
||||
|
||||
:param x: position
|
||||
:param y: postion
|
||||
:param y: position
|
||||
:param d_shaft: diameter of the screw shaft
|
||||
:param d_head: diameter of the screw head
|
||||
:param angle: rotation angle of the hole
|
||||
|
||||
"""
|
||||
|
||||
if d_shaft < (2 * self.burn):
|
||||
|
@ -1438,7 +1411,6 @@ class Boxes:
|
|||
:param y: (Default value = 0)
|
||||
:param angle: (Default value = 0)
|
||||
:param align: (Default value = "") string with combinations of (top|middle|bottom) and (left|center|right) separated by a space
|
||||
|
||||
"""
|
||||
self.moveTo(x, y, angle)
|
||||
text = text.split("\n")
|
||||
|
@ -1537,7 +1509,7 @@ class Boxes:
|
|||
:param x: (Default value = 0)
|
||||
:param y: (Default value = 0)
|
||||
:param angle: (Default value = 0)
|
||||
|
||||
:param screwholes:
|
||||
"""
|
||||
width, flange, holedistance, diameter = self.nema_sizes[size]
|
||||
if screwholes:
|
||||
|
@ -1558,7 +1530,7 @@ class Boxes:
|
|||
draw border polygon (for debugging only)
|
||||
|
||||
:param border: array with coordinate [(x0,y0), (x1,y1),...] of the border polygon
|
||||
|
||||
:param color:
|
||||
"""
|
||||
self.set_source_color(color)
|
||||
self.ctx.save()
|
||||
|
@ -1591,7 +1563,6 @@ class Boxes:
|
|||
:param style: defines hole style - currently one of "round", "triangle", "square", "hexagon" or "octagon"
|
||||
:param bar_length: maximum bar length
|
||||
:param max_random: maximum number of random holes
|
||||
|
||||
"""
|
||||
if pattern not in ["random", "hex", "square", "hbar", "vbar"]:
|
||||
return
|
||||
|
@ -1769,7 +1740,7 @@ class Boxes:
|
|||
|
||||
# and process line
|
||||
while not xw > x_end:
|
||||
# are we in inner polygone already?
|
||||
# are we in inner polygon already?
|
||||
if (len(inner_line_split) > inner_line_index and
|
||||
xw > inner_line_split.geoms[inner_line_index].bounds[0]):
|
||||
# place inner, full size polygons
|
||||
|
@ -1828,7 +1799,7 @@ class Boxes:
|
|||
segment_max = 0
|
||||
segment_toggle ^= 1
|
||||
|
||||
# create line from left to right and cut according to shrinked polygon
|
||||
# create line from left to right and cut according to shrunk polygon
|
||||
line_complete = LineString([(min_x - 1, y), (max_x + 1, y)])
|
||||
line_split = split(line_complete, cutPoly)
|
||||
|
||||
|
@ -1927,8 +1898,6 @@ class Boxes:
|
|||
:param settings: (Default value = None)
|
||||
:param skip: (Default value = None) function to check if hole should be present
|
||||
gets x, y, r, b, posx, posy
|
||||
|
||||
|
||||
"""
|
||||
|
||||
if settings is None:
|
||||
|
@ -1966,7 +1935,6 @@ class Boxes:
|
|||
|
||||
:param d: diameter of the circle
|
||||
:param settings: (Default value = None)
|
||||
|
||||
"""
|
||||
d2 = d / 2.0
|
||||
self.hexHolesRectangle(d, d, settings=settings, skip=self.__skipcircle)
|
||||
|
@ -1979,19 +1947,16 @@ class Boxes:
|
|||
:param y: height
|
||||
:param rc: radius of the corners
|
||||
:param settings: (Default value = None)
|
||||
|
||||
"""
|
||||
|
||||
def skip(x, y, r, b, posx, posy):
|
||||
"""
|
||||
|
||||
:param x:
|
||||
:param y:
|
||||
:param r:
|
||||
:param b:
|
||||
:param posx:
|
||||
:param posy:
|
||||
|
||||
"""
|
||||
posx = abs(posx - (x / 2.0))
|
||||
posy = abs(posy - (y / 2.0))
|
||||
|
@ -2012,7 +1977,6 @@ class Boxes:
|
|||
:param h: height
|
||||
:param settings: (Default value = None)
|
||||
:param grow: (Default value = None)
|
||||
|
||||
"""
|
||||
if settings is None:
|
||||
settings = self.hexHolesSettings
|
||||
|
@ -2027,7 +1991,7 @@ class Boxes:
|
|||
if grow == 'space ':
|
||||
b += leftover / (cy - 1) / 2
|
||||
|
||||
# recalulate with adjusted values
|
||||
# recalculate with adjusted values
|
||||
w = r + b / 2.0
|
||||
dist = w * math.cos(math.pi / 6.0)
|
||||
|
||||
|
@ -2087,7 +2051,7 @@ class Boxes:
|
|||
:param x: x position of the center
|
||||
:param y: y position of the center
|
||||
:param angle: angle in which the rectangle is placed
|
||||
:param outside: meassure size from the outside of the walls - not the inside
|
||||
:param outside: measure size from the outside of the walls - not the inside
|
||||
"""
|
||||
self.moveTo(x, y, angle)
|
||||
d = 0.5*self.thickness
|
||||
|
@ -2128,6 +2092,7 @@ class Boxes:
|
|||
:param x: width
|
||||
:param y: height
|
||||
:param r: radius of the corners
|
||||
:param edge:
|
||||
:param callback: (Default value = None)
|
||||
:param holesMargin: (Default value = None) set to get hex holes
|
||||
:param holesSettings: (Default value = None)
|
||||
|
@ -2136,7 +2101,6 @@ class Boxes:
|
|||
:param wallpieces: (Default value = 1) # of separate surrounding walls
|
||||
:param extend_corners: (Default value = True) have corners outset with the edges
|
||||
:param move: (Default value = None)
|
||||
|
||||
"""
|
||||
corner_holes = True
|
||||
|
||||
|
@ -2245,7 +2209,7 @@ class Boxes:
|
|||
callback=None,
|
||||
move=None):
|
||||
"""
|
||||
Wall(s) with flex fiting around a roundedPlate()
|
||||
Wall(s) with flex filing around a roundedPlate()
|
||||
|
||||
For the callbacks the sides are counted depending on pieces
|
||||
|
||||
|
@ -2260,7 +2224,6 @@ class Boxes:
|
|||
:param pieces: (Default value = 1) number of separate pieces
|
||||
:param callback: (Default value = None)
|
||||
:param move: (Default value = None)
|
||||
|
||||
"""
|
||||
t = self.thickness
|
||||
c4 = (r + self.burn) * math.pi * 0.5 # circumference of quarter circle
|
||||
|
@ -2364,7 +2327,6 @@ class Boxes:
|
|||
:param callback: (Default value = None)
|
||||
:param move: (Default value = None)
|
||||
:param label: rendered to identify parts, it is not ment to be cut or etched (Default value = "")
|
||||
|
||||
"""
|
||||
if len(edges) != 4:
|
||||
raise ValueError("four edges required")
|
||||
|
@ -2472,7 +2434,7 @@ class Boxes:
|
|||
:param x: width
|
||||
:param y: height
|
||||
:param edges: (Default value = "eee") bottom, right[, diagonal]
|
||||
:param r: radius towards the hypothenuse
|
||||
:param r: radius towards the hypotenuse
|
||||
:param num: (Default value = 1) number of triangles
|
||||
:param bedBolts: (Default value = None)
|
||||
:param bedBoltSettings: (Default value = None)
|
||||
|
@ -2702,12 +2664,11 @@ class Boxes:
|
|||
Polygon wall for all kind of multi-edged objects
|
||||
|
||||
:param borders: array of distance and angles to draw
|
||||
:param edge: (Default value = "f") Edges to apply. If the array of borders contains more segments that edges, the edge will wrap. Only edge types without start and end width suppported for now.
|
||||
:param edge: (Default value = "f") Edges to apply. If the array of borders contains more segments that edges, the edge will wrap. Only edge types without start and end width supported for now.
|
||||
:param turtle: (Default value = False)
|
||||
:param callback: (Default value = None)
|
||||
:param move: (Default value = None)
|
||||
:param label: rendered to identify parts, it is not ment to be cut or etched (Default value = "")
|
||||
|
||||
"""
|
||||
try:
|
||||
edges = [self.edges.get(e, e) for e in edge]
|
||||
|
@ -2836,10 +2797,10 @@ class Boxes:
|
|||
|
||||
:param n: number of parts
|
||||
:param width: number of parts in a row (0 for same as n)
|
||||
:param move: (Default value = None)
|
||||
:param move: (Default value = "")
|
||||
:param part: callable that draws a part and knows move param
|
||||
:param \*l: params for part
|
||||
:param \*\*kw: keyword params for part
|
||||
:param l: params for part
|
||||
:param kw: keyword params for part
|
||||
"""
|
||||
if n <= 0:
|
||||
return
|
||||
|
|
|
@ -9,7 +9,7 @@ from boxes.extents import Extents
|
|||
EPS = 1e-4
|
||||
PADDING = 10
|
||||
|
||||
RANDOMIZE_COLORS = False # enable to ease check for continuity of pathes
|
||||
RANDOMIZE_COLORS = False # enable to ease check for continuity of paths
|
||||
|
||||
|
||||
def points_equal(x1, y1, x2, y2):
|
||||
|
@ -989,7 +989,7 @@ def line_intersection(line1, line2):
|
|||
|
||||
div = det(xdiff, ydiff)
|
||||
if div == 0:
|
||||
# todo: deal with paralel line intersection / overlay
|
||||
# todo: deal with parallel line intersection / overlay
|
||||
return False, None, None
|
||||
|
||||
d = (det(*line1), det(*line2))
|
||||
|
|
|
@ -29,7 +29,6 @@ def argparseSections(s):
|
|||
Parse sections parameter
|
||||
|
||||
:param s: string to parse
|
||||
|
||||
"""
|
||||
|
||||
result = []
|
||||
|
@ -78,14 +77,12 @@ class BoltPolicy(object):
|
|||
|
||||
Distributes (bed) bolts on a number of segments
|
||||
(fingers of a finger joint)
|
||||
|
||||
"""
|
||||
|
||||
def drawbolt(self, pos):
|
||||
"""Add a bolt to this segment?
|
||||
|
||||
:param pos: number of the finger
|
||||
|
||||
"""
|
||||
return False
|
||||
|
||||
|
@ -93,7 +90,6 @@ class BoltPolicy(object):
|
|||
"""Return next smaller, possible number of fingers
|
||||
|
||||
:param numfingers: number of fingers to aim for
|
||||
|
||||
"""
|
||||
return numfingers
|
||||
|
||||
|
@ -102,7 +98,6 @@ class BoltPolicy(object):
|
|||
Return same or next smaller even number
|
||||
|
||||
:param numFingers:
|
||||
|
||||
"""
|
||||
return (numFingers // 2) * 2
|
||||
|
||||
|
@ -111,7 +106,6 @@ class BoltPolicy(object):
|
|||
Return same or next smaller odd number
|
||||
|
||||
:param numFingers:
|
||||
|
||||
"""
|
||||
if numFingers % 2:
|
||||
return numFingers
|
||||
|
@ -138,7 +132,6 @@ class Bolts(BoltPolicy):
|
|||
Return if this finger needs a bolt
|
||||
|
||||
:param pos: number of this finger
|
||||
|
||||
"""
|
||||
if pos > self.fingers // 2:
|
||||
pos = self.fingers - pos
|
||||
|
@ -165,7 +158,7 @@ class Settings(object):
|
|||
of the material used.
|
||||
|
||||
Overload the absolute_params and relative_params class attributes with
|
||||
the suported keys and default values. The values are available via
|
||||
the supported keys and default values. The values are available via
|
||||
attribute access.
|
||||
"""
|
||||
absolute_params: Dict[str, Any] = {} # TODO find better typing.
|
||||
|
@ -242,7 +235,6 @@ class Settings(object):
|
|||
:param boxes: Boxes object
|
||||
:param chars: sequence of chars to be used by Edge objects
|
||||
:param add: add the resulting Edge objects to the Boxes object's edges
|
||||
|
||||
"""
|
||||
edges = []
|
||||
return self._edgeObjects(edges, boxes, chars, add)
|
||||
|
@ -265,9 +257,8 @@ class Settings(object):
|
|||
Set values
|
||||
|
||||
:param thickness: thickness of the material used
|
||||
:param relative: (Default value = True) Do scale by thickness
|
||||
:param \*\*kw: parameters to set
|
||||
|
||||
:param relative: Do scale by thickness (Default value = True)
|
||||
:param kw: parameters to set
|
||||
"""
|
||||
factor = 1.0
|
||||
if relative:
|
||||
|
@ -349,7 +340,7 @@ class Edge(BaseEdge):
|
|||
def __call__(self, length, bedBolts=None, bedBoltSettings=None, **kw):
|
||||
"""Draw edge of length mm"""
|
||||
if bedBolts:
|
||||
# distribute the bolts aequidistantly
|
||||
# distribute the bolts equidistantly
|
||||
interval_length = length / bedBolts.bolts
|
||||
if self.positive:
|
||||
d = (bedBoltSettings or self.bedBoltSettings)[0]
|
||||
|
@ -768,7 +759,7 @@ class CompoundEdge(BaseEdge):
|
|||
#############################################################################
|
||||
|
||||
class Slot(BaseEdge):
|
||||
"""Edge with an slot to slid another pice through """
|
||||
"""Edge with a slot to slide another piece through """
|
||||
|
||||
description = "Slot"
|
||||
|
||||
|
@ -1043,7 +1034,6 @@ class FingerHoles(FingerJointBase):
|
|||
:param angle: (Default value = 90)
|
||||
:param bedBolts: (Default value = None)
|
||||
:param bedBoltSettings: (Default value = None)
|
||||
|
||||
"""
|
||||
with self.boxes.saved_context():
|
||||
self.boxes.moveTo(x, y, angle)
|
||||
|
@ -1638,8 +1628,7 @@ class ChestHinge(BaseEdge):
|
|||
return self.settings.pin_height+self.settings.hinge_strength
|
||||
|
||||
class ChestHingeTop(ChestHinge):
|
||||
|
||||
"Edge above a chest hinge"
|
||||
"""Edge above a chest hinge"""
|
||||
|
||||
char = "p"
|
||||
|
||||
|
@ -1921,7 +1910,6 @@ class CabinetHingeEdge(BaseEdge):
|
|||
#############################################################################
|
||||
|
||||
class LidSettings(FingerJointSettings):
|
||||
|
||||
"""Settings for Slide-on Lids
|
||||
|
||||
Note that edge_width below also determines how much the sides extend above the lid.
|
||||
|
@ -1933,8 +1921,6 @@ Values:
|
|||
* second_pin : True : additional pin for better positioning
|
||||
* spring : "both" : position(s) of the extra locking springs in the lid
|
||||
* hole_width : 0 : width of the "finger hole" in mm
|
||||
|
||||
|
||||
"""
|
||||
__doc__ += FingerJointSettings.__doc__ or ""
|
||||
|
||||
|
@ -2342,7 +2328,7 @@ Values:
|
|||
|
||||
* absolute
|
||||
|
||||
* stretch : 1.05 : Hint of how much the flex part should be shortend
|
||||
* stretch : 1.05 : Hint of how much the flex part should be shortened
|
||||
|
||||
* relative (in multiples of thickness)
|
||||
|
||||
|
@ -2422,7 +2408,6 @@ class FlexEdge(BaseEdge):
|
|||
self.ctx.translate(*self.ctx.get_current_point())
|
||||
|
||||
class GearSettings(Settings):
|
||||
|
||||
"""Settings for rack (and pinion) edge
|
||||
Values:
|
||||
* absolute_params
|
||||
|
@ -2469,7 +2454,6 @@ class RackEdge(BaseEdge):
|
|||
return self.settings.dimension * 1.1
|
||||
|
||||
class RoundedTriangleEdgeSettings(Settings):
|
||||
|
||||
"""Settings for RoundedTriangleEdge
|
||||
Values:
|
||||
|
||||
|
@ -2550,7 +2534,6 @@ class RoundedTriangleFingerHolesEdge(RoundedTriangleEdge):
|
|||
|
||||
|
||||
class HandleEdgeSettings(Settings):
|
||||
|
||||
"""Settings for HandleEdge
|
||||
Values:
|
||||
|
||||
|
|
|
@ -1,44 +1,40 @@
|
|||
#!/usr/bin/env python3
|
||||
""
|
||||
|
||||
'''
|
||||
Copyright (C) 2007 Aaron Spike (aaron @ ekips.org)
|
||||
Copyright (C) 2007 Tavmjong Bah (tavmjong @ free.fr)
|
||||
Copyright (C) http://cnc-club.ru/forum/viewtopic.php?f=33&t=434&p=2594#p2500
|
||||
Copyright (C) 2014 Jürgen Weigert (juewei@fabmail.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
2014-03-20 jw@suse.de 0.2 Option --accuracy=0 for automatic added.
|
||||
2014-03-21 sent upstream: https://bugs.launchpad.net/inkscape/+bug/1295641
|
||||
2014-03-21 jw@suse.de 0.3 Fixed center of rotation for gears with odd number of teeth.
|
||||
2014-04-04 juewei 0.7 Revamped calc_unit_factor().
|
||||
2014-04-05 juewei 0.7a Correctly positioned rack gear.
|
||||
The geometry above the meshing line is wrong.
|
||||
2014-04-06 juewei 0.7b Undercut detection added. Reference:
|
||||
http://nptel.ac.in/courses/IIT-MADRAS/Machine_Design_II/pdf/2_2.pdf
|
||||
Manually merged https://github.com/jnweiger/inkscape-gears-dev/pull/15
|
||||
2014-04-07 juewei 0.7c Manually merged https://github.com/jnweiger/inkscape-gears-dev/pull/17
|
||||
2014-04-09 juewei 0.8 Fixed https://github.com/jnweiger/inkscape-gears-dev/issues/19
|
||||
Ring gears are ready for production now. Thanks neon22 for driving this.
|
||||
Profile shift implemented (Advanced Tab), fixing
|
||||
https://github.com/jnweiger/inkscape-gears-dev/issues/9
|
||||
2015-05-29 juewei 0.9 ported to inkscape 0.91
|
||||
AttributeError: 'module' object inkex has no attribute 'uutounit
|
||||
Fixed https://github.com/jnweiger/inkscape-gears-dev
|
||||
'''
|
||||
# Copyright (C) 2007 Aaron Spike (aaron @ ekips.org)
|
||||
# Copyright (C) 2007 Tavmjong Bah (tavmjong @ free.fr)
|
||||
# Copyright (C) http://cnc-club.ru/forum/viewtopic.php?f=33&t=434&p=2594#p2500
|
||||
# Copyright (C) 2014 Jürgen Weigert (juewei@fabmail.org)
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# 2014-03-20 jw@suse.de 0.2 Option --accuracy=0 for automatic added.
|
||||
# 2014-03-21 sent upstream: https://bugs.launchpad.net/inkscape/+bug/1295641
|
||||
# 2014-03-21 jw@suse.de 0.3 Fixed center of rotation for gears with odd number of teeth.
|
||||
# 2014-04-04 juewei 0.7 Revamped calc_unit_factor().
|
||||
# 2014-04-05 juewei 0.7a Correctly positioned rack gear.
|
||||
# The geometry above the meshing line is wrong.
|
||||
# 2014-04-06 juewei 0.7b Undercut detection added. Reference:
|
||||
# http://nptel.ac.in/courses/IIT-MADRAS/Machine_Design_II/pdf/2_2.pdf
|
||||
# Manually merged https://github.com/jnweiger/inkscape-gears-dev/pull/15
|
||||
# 2014-04-07 juewei 0.7c Manually merged https://github.com/jnweiger/inkscape-gears-dev/pull/17
|
||||
# 2014-04-09 juewei 0.8 Fixed https://github.com/jnweiger/inkscape-gears-dev/issues/19
|
||||
# Ring gears are ready for production now. Thanks neon22 for driving this.
|
||||
# Profile shift implemented (Advanced Tab), fixing
|
||||
# https://github.com/jnweiger/inkscape-gears-dev/issues/9
|
||||
# 2015-05-29 juewei 0.9 ported to inkscape 0.91
|
||||
# AttributeError: 'module' object inkex has no attribute 'uutounit
|
||||
# Fixed https://github.com/jnweiger/inkscape-gears-dev
|
||||
|
||||
from math import pi, cos, sin, tan, radians, degrees, ceil, asin, acos, sqrt
|
||||
from os import devnull # for debugging
|
||||
|
@ -57,12 +53,11 @@ def linspace(a,b,n):
|
|||
return [a+x*(b-a)/(n-1) for x in range(0,n)]
|
||||
|
||||
def involute_intersect_angle(Rb, R):
|
||||
" "
|
||||
Rb, R = float(Rb), float(R)
|
||||
return (sqrt(R**2 - Rb**2) / (Rb)) - (acos(Rb / R))
|
||||
|
||||
def point_on_circle(radius, angle):
|
||||
" return xy coord of the point at distance radius from origin at angle "
|
||||
""" return xy coord of the point at distance radius from origin at angle """
|
||||
x = radius * cos(angle)
|
||||
y = radius * sin(angle)
|
||||
return (x, y)
|
||||
|
@ -308,7 +303,7 @@ class Gears():
|
|||
self.OptionParser.add_option("-A", "--accuracy",
|
||||
action="store", type="int",
|
||||
dest="accuracy", default=0,
|
||||
help="Accuracy of involute: automatic: 5..20 (default), best: 20(default), medium 10, low: 5; good acuracy is important with a low tooth count")
|
||||
help="Accuracy of involute: automatic: 5..20 (default), best: 20(default), medium 10, low: 5; good accuracy is important with a low tooth count")
|
||||
# Clearance: Radial distance between top of tooth on one gear to bottom of gap on another.
|
||||
self.OptionParser.add_option("", "--clearance",
|
||||
action="store", type="float",
|
||||
|
@ -409,8 +404,7 @@ class Gears():
|
|||
self.boxes.ctx.restore()
|
||||
|
||||
def calc_circular_pitch(self):
|
||||
""" We use math based on circular pitch.
|
||||
"""
|
||||
"""We use math based on circular pitch."""
|
||||
dimension = self.options.dimension
|
||||
if self.options.system == 'CP': # circular pitch
|
||||
circular_pitch = dimension * 25.4
|
||||
|
|
|
@ -51,7 +51,7 @@ class BOX(Boxes): # Change class name!
|
|||
space = 10, finger=10,
|
||||
width=self.thickness)
|
||||
p = edges.FingerJointEdge(self, s)
|
||||
p.char = "a" # 'a', 'A', 'b' and 'B' is reserved for beeing used within generators
|
||||
p.char = "a" # 'a', 'A', 'b' and 'B' is reserved for being used within generators
|
||||
self.addPart(p)
|
||||
|
||||
# render your parts here
|
||||
|
|
|
@ -654,7 +654,7 @@ protruding underneath.
|
|||
|
||||
def render_upper_token_trays(self, tray_inner_height, box_width):
|
||||
"""
|
||||
Upper level : multiple trays for each ressource
|
||||
Upper level : multiple trays for each resource
|
||||
(beside horses which are on the lower level)
|
||||
"""
|
||||
tray_height = tray_inner_height + self.thickness
|
||||
|
|
|
@ -36,7 +36,7 @@ class BirdHouse(Boxes):
|
|||
lengths = (x, h, t, roof, roof, t, h)
|
||||
|
||||
edges = [self.edges.get(e, e) for e in edges]
|
||||
edges.append(edges[0]) # wrap arround
|
||||
edges.append(edges[0]) # wrap around
|
||||
|
||||
tw = x + edges[1].spacing() + edges[-2].spacing()
|
||||
th = h + x/2 + t + edges[0].spacing() + max(edges[3].spacing(), edges[4].spacing())
|
||||
|
|
|
@ -19,7 +19,7 @@ from boxes import *
|
|||
class BottleStack(Boxes):
|
||||
"""Stack bottles in a fridge"""
|
||||
|
||||
description = """When rendered with the "double" option the parts with the double slots get connected the shorter beams in the asymetrical slots.
|
||||
description = """When rendered with the "double" option the parts with the double slots get connected the shorter beams in the asymmetrical slots.
|
||||
|
||||
Without the "double" option the stand is a bit more narrow.
|
||||
"""
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERself.canHightANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
|
@ -83,7 +83,7 @@ for AA batteries:
|
|||
|
||||
![CanStorage for AA batteries](static/samples/CanStorageAA.jpg)
|
||||
|
||||
for canned tomatos:
|
||||
for canned tomatoes:
|
||||
"""
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ for canned tomatos:
|
|||
help="outer diameter of the cans to be stored (in mm)")
|
||||
self.argparser.add_argument(
|
||||
"--canHight", action="store", type=float, default=110,
|
||||
help="hight of the cans to be stored (in mm)")
|
||||
help="height of the cans to be stored (in mm)")
|
||||
self.argparser.add_argument(
|
||||
"--canNum", action="store", type=int, default=12,
|
||||
help="number of cans to be stored")
|
||||
|
|
|
@ -18,7 +18,7 @@ from boxes import *
|
|||
|
||||
|
||||
class Castle(Boxes):
|
||||
"Castle tower with two walls"
|
||||
"""Castle tower with two walls"""
|
||||
|
||||
description = """This was done as a table decoration. May be at some point in the future someone will create a proper castle
|
||||
with towers and gates and walls that can be attached in multiple configurations."""
|
||||
|
|
|
@ -27,7 +27,7 @@ class CoffeeCapsuleHolder(Boxes):
|
|||
ui_group = "Misc"
|
||||
|
||||
description = """
|
||||
You can store your coffee capsule near your expresso machine with this. It works both vertically, or upside down under a shelf.
|
||||
You can store your coffee capsule near your espresso machine with this. It works both vertically, or upside down under a shelf.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -25,7 +25,7 @@ class Console2(Boxes):
|
|||
This box is designed as a housing for electronic projects. It has hatches that can be re-opened with simple tools. It intentionally cannot be opened with bare hands - if build with thin enough material.
|
||||
|
||||
#### Caution
|
||||
There is a chance that the latches of the back wall or the back wall itself interfere with the front panel or it's mounting frame/lips. The generator does not check for this. So depending on the variant choosen you might need to make the box deeper (increase y parameter) or the panel angle steeper (increase angle parameter) until there is enough room.
|
||||
There is a chance that the latches of the back wall or the back wall itself interfere with the front panel or it's mounting frame/lips. The generator does not check for this. So depending on the variant chosen you might need to make the box deeper (increase y parameter) or the panel angle steeper (increase angle parameter) until there is enough room.
|
||||
|
||||
It's also possible that the frame of the panel interferes with the floor if the hi parameter is too small.
|
||||
|
||||
|
@ -40,7 +40,7 @@ If the panel is removable you need to add the springs with the tabs to the side
|
|||
|
||||
![Back wall details](static/samples/Console2-panel-detail.jpg)
|
||||
|
||||
If space is tight you may consider not glueing the cross pieces in place and remove them after the glue-up. This may prevent the latches of the back wall and the panel from interfereing with each other.
|
||||
If space is tight you may consider not gluing the cross pieces in place and remove them after the glue-up. This may prevent the latches of the back wall and the panel from interfering with each other.
|
||||
|
||||
The variant using finger joints only has the two side lips without the cross bars.
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ def offset_radius_in_square(squareside, angle, outset):
|
|||
10.0
|
||||
>>> offset_radius_in_square(20, 0, 5)
|
||||
10.0
|
||||
>>> # Without offset, it's half squre length divided by cos(angle) -- at
|
||||
>>> # Without offset, it's half square length divided by cos(angle) -- at
|
||||
>>> # least before it hits the next wall
|
||||
>>> offset_radius_in_square(20, 15, 0) # doctest:+ELLIPSIS
|
||||
10.35276...
|
||||
|
@ -206,8 +206,8 @@ class DiscRack(Boxes):
|
|||
|
||||
# Can the discs be removed at all?
|
||||
# Does not need explicit checking, for Thales' theorem tells us that at
|
||||
# the point wher there is barely support in the corner, three contact
|
||||
# points on the circle form just a demicircle and the discs can be
|
||||
# the point where there is barely support in the corner, three contact
|
||||
# points on the circle form just a semicircle and the discs can be
|
||||
# inserted/removed. When we keep the other contact points and move the
|
||||
# slits away from the corner, the disc gets smaller and thus will fit
|
||||
# through the opening that is as wide as the diameter of the largest
|
||||
|
|
|
@ -18,7 +18,7 @@ from boxes import *
|
|||
|
||||
|
||||
class Display(Boxes):
|
||||
"""Diplay for flyers or leaflets"""
|
||||
"""Display for flyers or leaflets"""
|
||||
|
||||
ui_group = "Misc"
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ Adding '0:' at the start of the sy parameter adds a slot at the very back. Addin
|
|||
|
||||
There are 4 different sets of dividers rendered:
|
||||
|
||||
* With asymetric tabs so the tabs fit on top of each other
|
||||
* With asymmetric tabs so the tabs fit on top of each other
|
||||
* With tabs of half wall thickness that can go side by side
|
||||
* With tabs of a full wall thickness
|
||||
* One single divider spanning across all columns
|
||||
|
@ -215,7 +215,7 @@ You will likely need to cut each of the dividers you want multiple times.
|
|||
|
||||
# Dividers
|
||||
divider_height = (
|
||||
# h, with angle adjustement
|
||||
# h, with angle adjustment
|
||||
self.h / math.cos(math.radians(self.Slot_angle))
|
||||
# removing what exceeds in the width of the divider
|
||||
- self.thickness * math.tan(math.radians(self.Slot_angle))
|
||||
|
@ -495,14 +495,14 @@ class SlotDescription:
|
|||
|
||||
def corrected_start_depth(self):
|
||||
"""
|
||||
Returns the depth of the straigth part of the slot starting side
|
||||
Returns the depth of the straight part of the slot starting side
|
||||
"""
|
||||
extra_depth = self._depth_angle_correction()
|
||||
return self.depth + max(0, extra_depth) - self.round_edge_start_correction()
|
||||
|
||||
def corrected_end_depth(self):
|
||||
"""
|
||||
Returns the depth of the straigth part of the slot ending side
|
||||
Returns the depth of the straight part of the slot ending side
|
||||
"""
|
||||
extra_depth = self._depth_angle_correction()
|
||||
return self.depth + max(0, -extra_depth) - self.round_edge_end_correction()
|
||||
|
@ -555,7 +555,7 @@ class SlotDescriptionsGenerator:
|
|||
# Add this slot
|
||||
descriptions.add(slot)
|
||||
|
||||
# Add the straigth edge after this slot
|
||||
# Add the straight edge after this slot
|
||||
descriptions.add(
|
||||
StraightEdgeDescription(l, slot.round_edge_end_correction())
|
||||
)
|
||||
|
@ -634,7 +634,7 @@ class DividerSlotsEdge(edges.BaseEdge):
|
|||
elif isinstance(description, StraightEdgeDescription):
|
||||
self.do_straight_edge(description)
|
||||
|
||||
# rounding errors might accumulates :
|
||||
# rounding errors might accumulate :
|
||||
# restore context and redo the move straight
|
||||
self.ctx.restore()
|
||||
self.moveTo(length)
|
||||
|
@ -656,7 +656,7 @@ class DividerSlotsEdge(edges.BaseEdge):
|
|||
(90 + slot.angle, slot.end_radius),
|
||||
)
|
||||
|
||||
# rounding errors might accumulates :
|
||||
# rounding errors might accumulate :
|
||||
# restore context and redo the move straight
|
||||
self.ctx.restore()
|
||||
self.moveTo(slot.tracing_length())
|
||||
|
|
|
@ -21,13 +21,13 @@ from boxes import *
|
|||
class DrillStand(Boxes):
|
||||
"""Box for drills with each compartment of a different height"""
|
||||
|
||||
description = """Note: `sh` gives the hight of the rows front to back. It though should have the same number of entries as `sy`. These heights are the one on the left side and increase throughout the row. To have each compartement a bit higher than the previous one the steps in `sh` should be a bit bigger than `extra_height`.
|
||||
description = """Note: `sh` gives the hight of the rows front to back. It though should have the same number of entries as `sy`. These heights are the one on the left side and increase throughout the row. To have each compartment a bit higher than the previous one the steps in `sh` should be a bit bigger than `extra_height`.
|
||||
|
||||
Assembly:
|
||||
|
||||
![Parts](static/samples/DrillStand-drawing.png)
|
||||
|
||||
Start with putting the slots of the inner walls together. Be especially careful with adding the bottom. It is always assymetrical and flush with the right/lower side while being a little short on the left/higher side to not protrude into the side wall.
|
||||
Start with putting the slots of the inner walls together. Be especially careful with adding the bottom. It is always asymmetrical and flush with the right/lower side while being a little short on the left/higher side to not protrude into the side wall.
|
||||
|
||||
| | |
|
||||
| ---- | ---- |
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
from boxes import *
|
||||
|
||||
class Edges(Boxes):
|
||||
"""Print all registerd Edge types"""
|
||||
"""Print all registered Edge types"""
|
||||
|
||||
webinterface = False
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from boxes import *
|
|||
|
||||
|
||||
class FlexTest(Boxes):
|
||||
"Piece for testing different flex settings"
|
||||
"""Piece for testing different flex settings"""
|
||||
|
||||
ui_group = "Part"
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from boxes import *
|
|||
|
||||
|
||||
class FlexTest2(Boxes):
|
||||
"Piece for testing 2D flex settings"
|
||||
"""Piece for testing 2D flex settings"""
|
||||
|
||||
ui_group = "Part"
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class GearBox(Boxes):
|
|||
help="number of teeth on outgoing shaft")
|
||||
self.argparser.add_argument(
|
||||
"--modulus", action="store", type=float, default=3,
|
||||
help="modulus of the theeth in mm")
|
||||
help="modulus of the teeth in mm")
|
||||
self.argparser.add_argument(
|
||||
"--shaft", action="store", type=float, default=6.,
|
||||
help="diameter of the shaft")
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
from boxes import *
|
||||
|
||||
class HeartBox(Boxes):
|
||||
"""Box in the form of an heart"""
|
||||
"""Box in the form of a heart"""
|
||||
|
||||
ui_group = "FlexBox"
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class HingeBox(Boxes):
|
|||
"""Box with lid attached by cabinet hinges"""
|
||||
|
||||
description = """Needs (metal) pins as hinge axles. Pieces of nails will
|
||||
do fine. They need to be cut to length as they are caputured as soon as the
|
||||
do fine. They need to be cut to length as they are captured as soon as the
|
||||
hinges are assembled.
|
||||
|
||||
Assemble the box and the lid separately. Then insert the axle into the hinges.
|
||||
|
|
|
@ -18,7 +18,7 @@ from boxes import *
|
|||
|
||||
|
||||
class Hook(Boxes):
|
||||
"""A hook wit a rectangular mouth to mount at the wall"""
|
||||
"""A hook with a rectangular mouth to mount at the wall"""
|
||||
|
||||
ui_group = "Misc" # see ./__init__.py for names
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Hook(Boxes):
|
|||
help="width of the hook from the side")
|
||||
self.argparser.add_argument("--angle", action="store",
|
||||
type=float, default=45.,
|
||||
help="angle of the support underneeth")
|
||||
help="angle of the support underneath")
|
||||
|
||||
def render(self):
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from boxes import *
|
|||
|
||||
|
||||
class JigsawPuzzle(Boxes): # change class name here and below
|
||||
"""Fractal jigsaw puzzle. Still aplha"""
|
||||
"""Fractal jigsaw puzzle. Still alpha."""
|
||||
|
||||
webinterface = False # Change to make visible in web interface
|
||||
|
||||
|
|
|
@ -117,7 +117,6 @@ class Keyboard:
|
|||
Spaces are not important.
|
||||
For example '3x2 / 4@11' means we want 3 columns, the two first with
|
||||
3 rows without offset, and the last with 4 rows starting at 11mm high
|
||||
|
||||
"""
|
||||
result = []
|
||||
try:
|
||||
|
@ -245,7 +244,7 @@ class Keyboard:
|
|||
A simple plate cutout, a 14mm rectangle, as specified in this reference sheet
|
||||
https://cdn.sparkfun.com/datasheets/Components/Switches/MX%20Series.pdf
|
||||
|
||||
With_notch shoul be used for a secondary lower plate, strengthening the first one.
|
||||
With_notch should be used for a secondary lower plate, strengthening the first one.
|
||||
A notch is added to let the hooks grasp the main upper plate.
|
||||
|
||||
Current position should be switch center.
|
||||
|
|
|
@ -109,7 +109,7 @@ class Keypad(Boxes, Keyboard):
|
|||
return [callback]
|
||||
|
||||
def hotplug(self):
|
||||
"""Callback for the key stabelizers."""
|
||||
"""Callback for the key stabilizers."""
|
||||
self.pcb_holes(
|
||||
with_pcb_mount=self.pcb_mount_enable,
|
||||
with_diode=self.diode_enable,
|
||||
|
|
|
@ -20,7 +20,7 @@ class LaserClamp(Boxes):
|
|||
"""A clamp to hold down material to a knife table"""
|
||||
|
||||
description = """You need a tension spring of the proper length to make the clamp work.
|
||||
Increace extraheight to get more space for the spring and to make the
|
||||
Increase extraheight to get more space for the spring and to make the
|
||||
sliding mechanism less likely to bind. You may need to add some wax on the
|
||||
parts sliding on each other to reduce friction.
|
||||
"""
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
from boxes import *
|
||||
|
||||
class NemaMount(Boxes):
|
||||
"""Mounting braket for a Nema motor"""
|
||||
"""Mounting bracket for a Nema motor"""
|
||||
|
||||
ui_group = "Part"
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class PaintStorage(Boxes):
|
|||
help="Create a stackable drawer instead")
|
||||
|
||||
def paintholes(self):
|
||||
"Place holes for the paintcans evenly"
|
||||
"""Place holes for the paintcans evenly"""
|
||||
|
||||
if self.hexpattern:
|
||||
self.moveTo(self.minspace/2, self.minspace/2)
|
||||
|
|
|
@ -30,7 +30,7 @@ class PaperBox(Boxes):
|
|||
This box is made of paper.
|
||||
|
||||
There is marks in the "outside leftover paper" to help see where to fold
|
||||
(cutting with tabs helps use them). The cut is very precise, and could be too tight if misaligned when glued. A plywood box (such as a simple TypeTray) of the same size is a great guide during folding and glueing. Just fold the box against it. Accurate quick and easy.
|
||||
(cutting with tabs helps use them). The cut is very precise, and could be too tight if misaligned when glued. A plywood box (such as a simple TypeTray) of the same size is a great guide during folding and gluing. Just fold the box against it. Accurate quick and easy.
|
||||
|
||||
A paper creaser (or bone folder) is also useful.
|
||||
"""
|
||||
|
|
|
@ -18,7 +18,6 @@ from boxes import *
|
|||
|
||||
|
||||
class Planetary(Boxes):
|
||||
|
||||
"""Planetary Gear with possibly multiple identical stages"""
|
||||
|
||||
ui_group = "Part"
|
||||
|
|
|
@ -18,7 +18,6 @@ from boxes import *
|
|||
|
||||
|
||||
class Planetary2(Boxes):
|
||||
|
||||
"""Balanced force Difference Planetary Gear (not yet working properly)"""
|
||||
|
||||
ui_group = "Unstable"
|
||||
|
@ -46,7 +45,7 @@ class Planetary2(Boxes):
|
|||
help="enable secondary ring with given delta to the ring gear")
|
||||
self.argparser.add_argument(
|
||||
"--modulus", action="store", type=float, default=1.0,
|
||||
help="modulus of the theeth in mm")
|
||||
help="modulus of the teeth in mm")
|
||||
self.argparser.add_argument(
|
||||
"--shaft", action="store", type=float, default=6.,
|
||||
help="diameter of the shaft")
|
||||
|
@ -132,7 +131,7 @@ class Planetary2(Boxes):
|
|||
def planets():
|
||||
self.moveTo(size3/2, size3/2)
|
||||
for angle in planetpositions:
|
||||
angle += 180 # compensate for 3 postion in callback
|
||||
angle += 180 # compensate for 3 position in callback
|
||||
self.moveTo(0, 0, angle)
|
||||
self.hole((pitch1+pitch2), 0, size2/2)
|
||||
self.moveTo(0, 0, -angle)
|
||||
|
|
|
@ -24,7 +24,7 @@ class SlotEdge(edges.Edge):
|
|||
r, h = self.settings.radius, self.settings.h
|
||||
sh = self.settings.sh # distance side to center
|
||||
|
||||
li = 2 * sh * math.tan(math.radians(90/n)) # side inner 2x polygone
|
||||
li = 2 * sh * math.tan(math.radians(90/n)) # side inner 2x polygon
|
||||
ls2 = t / math.tan(math.radians(180/n))
|
||||
ls1 = t / math.cos(math.radians(90-(180/n)))
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ class RollerEdge2(edges.BaseEdge):
|
|||
|
||||
|
||||
class Rotary(Boxes):
|
||||
|
||||
"""Rotary Attachment for engraving cylindrical objects in a laser cutter"""
|
||||
|
||||
ui_group = "Unstable"
|
||||
|
@ -101,7 +100,7 @@ class Rotary(Boxes):
|
|||
help="diameter of the axles")
|
||||
self.argparser.add_argument(
|
||||
"--knifethickness", action="store", type=float, default=8.,
|
||||
help="thickness of the knifes in mm. Use 0 for use with honey comb table.")
|
||||
help="thickness of the knives in mm. Use 0 for use with honey comb table.")
|
||||
self.argparser.add_argument(
|
||||
"--beamwidth", action="store", type=float, default=32.,
|
||||
help="width of the (aluminium) profile connecting the parts")
|
||||
|
@ -252,7 +251,7 @@ class Rotary(Boxes):
|
|||
with self.saved_context():
|
||||
self.rectangularWall(hw - 2 * t - 2, 60, edges="efef", move="right")
|
||||
self.rectangularWall(hw - 4 * t - 4, 60, edges="efef", move="right")
|
||||
# Spindel auxiliaries
|
||||
# Spindle auxiliaries
|
||||
self.parts.waivyKnob(50, callback=lambda: self.nutHole("M8"), move="right")
|
||||
self.parts.waivyKnob(50, callback=lambda: self.nutHole("M8"), move="right")
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class TrayLayout2(TrayLayout):
|
|||
|
||||
description = """Edit the layout text graphics to adjust your tray.
|
||||
Put in the sizes for each column and row. You can replace the hyphens and
|
||||
vertial bars representing the walls with a space character to remove the walls.
|
||||
vertical bars representing the walls with a space character to remove the walls.
|
||||
You can replace the space characters representing the floor by a "X" to remove the floor for this compartment.
|
||||
"""
|
||||
|
||||
|
@ -112,7 +112,7 @@ You can replace the space characters representing the floor by a "X" to remove t
|
|||
close = Boxes.close
|
||||
|
||||
def vWalls(self, x, y):
|
||||
"Number of vertical walls at a crossing"
|
||||
"""Number of vertical walls at a crossing"""
|
||||
result = 0
|
||||
if y > 0 and self.vwalls[y - 1][x]:
|
||||
result += 1
|
||||
|
@ -123,7 +123,7 @@ You can replace the space characters representing the floor by a "X" to remove t
|
|||
return result
|
||||
|
||||
def hWalls(self, x, y):
|
||||
"Number of horizontal walls at a crossing"
|
||||
"""Number of horizontal walls at a crossing"""
|
||||
result = 0
|
||||
if x > 0 and self.hwalls[y][x - 1]:
|
||||
result += 1
|
||||
|
@ -132,12 +132,12 @@ You can replace the space characters representing the floor by a "X" to remove t
|
|||
return result
|
||||
|
||||
def vFloor(self, x, y):
|
||||
"Is there floor under vertical wall"
|
||||
"""Is there floor under vertical wall"""
|
||||
return ((x > 0 and self.floors[y][x - 1]) or
|
||||
(x < len(self.x) and self.floors[y][x]))
|
||||
|
||||
def hFloor(self, x, y):
|
||||
"Is there foor under horizontal wall"
|
||||
"""Is there foor under horizontal wall"""
|
||||
return ((y > 0 and self.floors[y - 1][x]) or
|
||||
(y < len(self.y) and self.floors[y][x]))
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class TwoPiece(Boxes):
|
|||
"""
|
||||
|
||||
description = """
|
||||
Set *hi* larger than *h* to leave gap between the inner and outer shell. This can be used to make opening the box easier. Set *hi* smaller to only have a small inner ridge that will allow the content to be momre visible after opening.
|
||||
Set *hi* larger than *h* to leave gap between the inner and outer shell. This can be used to make opening the box easier. Set *hi* smaller to only have a small inner ridge that will allow the content to be more visible after opening.
|
||||
|
||||
![Bottom view](static/samples/TwoPiece2.jpg)
|
||||
"""
|
||||
|
|
|
@ -30,7 +30,7 @@ class TypeTray(_TopEdge):
|
|||
"top_edge")
|
||||
self.argparser.add_argument(
|
||||
"--back_height", action="store", type=float, default=0.0,
|
||||
help="additional height of the back wall - e top egde only")
|
||||
help="additional height of the back wall - e top edge only")
|
||||
self.argparser.add_argument(
|
||||
"--radius", action="store", type=float, default=0.0,
|
||||
help="radius for strengthening side walls with back_height")
|
||||
|
|
|
@ -30,7 +30,7 @@ class WallCaliper(_WallMountedBox):
|
|||
help="width of the long end")
|
||||
self.argparser.add_argument(
|
||||
"--heigth", action="store", type=float, default=6.0,
|
||||
help="heigth of the body")
|
||||
help="height of the body")
|
||||
|
||||
def side(self, move=None):
|
||||
t = self.thickness
|
||||
|
|
|
@ -27,10 +27,10 @@ class WallPlaneHolder(_WallMountedBox):
|
|||
help="width of the plane")
|
||||
self.argparser.add_argument(
|
||||
"--length", action="store", type=float, default=250,
|
||||
help="legth of the plane")
|
||||
help="length of the plane")
|
||||
self.argparser.add_argument(
|
||||
"--hold_length", action="store", type=float, default=30,
|
||||
help="legth of the part hiolding the plane over the front")
|
||||
help="length of the part holding the plane over the front")
|
||||
self.argparser.add_argument(
|
||||
"--height", action="store", type=float, default=80,
|
||||
help="height of the front of plane")
|
||||
|
|
|
@ -33,7 +33,8 @@ class Parts:
|
|||
:param diameter: diameter of the disc
|
||||
:param hole: (Default value = 0)
|
||||
:param callback: (Default value = None) called in the center
|
||||
:param move: (Defaultvalue = None)
|
||||
:param move: (Default value = "")
|
||||
:param label: (Default value = "")
|
||||
"""
|
||||
size = diameter
|
||||
r = diameter / 2.0
|
||||
|
@ -59,7 +60,7 @@ class Parts:
|
|||
:param angle: (Default value = 45) maximum angle of the wave
|
||||
:param hole: (Default value = 0)
|
||||
:param callback: (Default value = None) called in the center
|
||||
:param move: (Defaultvalue = None)
|
||||
:param move: (Default value = "")
|
||||
"""
|
||||
|
||||
if n < 2:
|
||||
|
@ -92,11 +93,11 @@ class Parts:
|
|||
|
||||
:param diameter: diameter of the knob
|
||||
:param n: (Default value = 3) number of dents
|
||||
:param rounded: (Default value = 0.2) proportion of circumferen remaining
|
||||
:param rounded: (Default value = 0.2) proportion of circumference remaining
|
||||
:param angle: (Default value = 70) angle the dents meet the circumference
|
||||
:param hole: (Default value = 0)
|
||||
:param callback: (Default value = None) called in the center
|
||||
:param move: (Defaultvalue = None)
|
||||
:param move: (Default value = "")
|
||||
"""
|
||||
size = diameter
|
||||
|
||||
|
@ -132,9 +133,9 @@ class Parts:
|
|||
|
||||
:param r_outside: outer radius
|
||||
:param r_inside: inner radius
|
||||
:param angle: anlge the segment is spanning
|
||||
:param angle: angle the segment is spanning
|
||||
:param n: (Default value = 1) number of segments
|
||||
:param move: (Defaultvalue = None)
|
||||
:param move: (Default value = "")
|
||||
"""
|
||||
space = 360 * r_inside / self.spacing
|
||||
n = min(n, 360 / (angle+space))
|
||||
|
|
|
@ -16,7 +16,7 @@ import math
|
|||
|
||||
|
||||
def normalize(v):
|
||||
"set lenght of vector to one"
|
||||
"""set length of vector to one"""
|
||||
l = (v[0] ** 2 + v[1] ** 2) ** 0.5
|
||||
if l == 0.0:
|
||||
return (0.0, 0.0)
|
||||
|
@ -35,35 +35,34 @@ def vclip(v, length):
|
|||
|
||||
|
||||
def vdiff(p1, p2):
|
||||
"vector from point1 to point2"
|
||||
"""vector from point1 to point2"""
|
||||
return (p2[0] - p1[0], p2[1] - p1[1])
|
||||
|
||||
|
||||
def vadd(v1, v2):
|
||||
"Sum of two vectors"
|
||||
"""Sum of two vectors"""
|
||||
return (v1[0] + v2[0], v1[1] + v2[1])
|
||||
|
||||
|
||||
def vorthogonal(v):
|
||||
"orthogonal vector"
|
||||
"Orthogonal vector"
|
||||
"""Orthogonal vector"""
|
||||
return (-v[1], v[0])
|
||||
|
||||
|
||||
def vscalmul(v, a):
|
||||
"scale vector by a"
|
||||
"""scale vector by a"""
|
||||
return (a * v[0], a * v[1])
|
||||
|
||||
|
||||
def dotproduct(v1, v2):
|
||||
"Dot product"
|
||||
"""Dot product"""
|
||||
return v1[0] * v2[0] + v1[1] * v2[1]
|
||||
|
||||
def circlepoint(r, a):
|
||||
return (r * math.cos(a), r * math.sin(a))
|
||||
|
||||
def tangent(x, y, r):
|
||||
"angle and length of a tangent to a circle at x,y with raduis r"
|
||||
"""angle and length of a tangent to a circle at x,y with radius r"""
|
||||
l1 = vlength((x, y))
|
||||
a1 = math.atan2(y, x)
|
||||
a2 = math.asin(r / l1)
|
||||
|
@ -72,7 +71,7 @@ def tangent(x, y, r):
|
|||
return (a1+a2, l2)
|
||||
|
||||
def rotm(angle):
|
||||
"Rotation matrix"
|
||||
"""Rotation matrix"""
|
||||
return [[math.cos(angle), -math.sin(angle), 0],
|
||||
[math.sin(angle), math.cos(angle), 0]]
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ class WallHoleEdge(WallHoles):
|
|||
return 0.0
|
||||
|
||||
class WallSettings(Settings):
|
||||
|
||||
"""Settings for plain WallEdges
|
||||
Values:
|
||||
|
||||
|
@ -262,7 +261,6 @@ class SlatWallEdge(WallEdge):
|
|||
return self.settings.hook_depth + self.settings.hook_distance
|
||||
|
||||
class SlatWallSettings(WallSettings):
|
||||
|
||||
"""Settings for SlatWallEdges
|
||||
Values:
|
||||
|
||||
|
@ -338,7 +336,6 @@ class DinRailEdge(WallEdge):
|
|||
return self.settings.depth
|
||||
|
||||
class DinRailSettings(WallSettings):
|
||||
|
||||
"""Settings for DinRailEdges
|
||||
Values:
|
||||
|
||||
|
@ -416,7 +413,6 @@ class FrenchCleatEdge(WallEdge):
|
|||
return self.settings.depth
|
||||
|
||||
class FrenchCleatSettings(WallSettings):
|
||||
|
||||
"""Settings for FrenchCleatEdges
|
||||
Values:
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ A similar approach is necessary when moving to a feature drawn inside
|
|||
the part without the use of callbacks. Here you typically have to
|
||||
correct for the out-set at the outside of the part and again for in-set
|
||||
of the hole one is about to cut. This can be done in **x** or **y**
|
||||
direction depending on whether the cut ist started vertical or
|
||||
direction depending on whether the cut is started vertical or
|
||||
horizontally.
|
||||
|
||||
Replacing the inverted arcs
|
||||
|
|
|
@ -44,7 +44,7 @@ Draw Commands
|
|||
-------------
|
||||
|
||||
These commands do not change the coordinate system but get the
|
||||
coordinates passed as parameters. All of them are either som sort of
|
||||
coordinates passed as parameters. All of them are either some sort of
|
||||
hole or text. These artifacts are placed somewhere independently of
|
||||
some continuous outline of the part their on.
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ Setup.py uses the :code:`setuptools` library (package name may be
|
|||
package.
|
||||
|
||||
pstoedit
|
||||
.......
|
||||
........
|
||||
|
||||
While not a hard requirement Boxes.py uses :code:`pstoedit` (sometimes :code:`ps2edit`) to offer formats
|
||||
that are not supported by Cairo: DXF, gcode, PLT. Currently the location
|
||||
|
|
Loading…
Reference in New Issue