Fix handling of space in LidSideRight/Left
Previously, the extra space was added above the first pin and below the (optional) second pin. This would cause the lid to misalign with the holes in the back wall, making it harder to close the lid. With this commit, the extra space is divided evenly above and below the nominal position of the pin. For this to work, the startwidth (or endwidth, depending on the side) is slightly adjusted (since the start of the first pin slot is actually generated by the adjacent edge). This moves the starting point, so the location of the spring hole is adjusted to compensate for that.
This commit is contained in:
parent
3bd4dc9907
commit
8ecf04cbe8
|
@ -1542,17 +1542,17 @@ class LidSideRight(BaseEdge):
|
|||
spring = self.settings.spring in ("left", "both")
|
||||
|
||||
if spring:
|
||||
p = [s, -90, t+s, -90, t+s, 90, edge_width-s, 90, length+t]
|
||||
p = [s, -90, t+s, -90, t+s, 90, edge_width-s/2, 90, length+t]
|
||||
else:
|
||||
p = [t+s, -90, t+s, -90, 2*t+s, 90, edge_width-s, 90, length+t]
|
||||
p = [t+s, -90, t+s, -90, 2*t+s, 90, edge_width-s/2, 90, length+t]
|
||||
|
||||
if pin:
|
||||
pinl = 2*t
|
||||
p[-1:] = [p[-1]-t-2*pinl, 90, edge_width+t+s, -90, 2*pinl+s, -90, t+s, -90,
|
||||
pinl, 90, edge_width, 90, pinl+t-s]
|
||||
p[-1:] = [p[-1]-t-2*pinl, 90, edge_width+t+s/2, -90, 2*pinl+s, -90, t+s, -90,
|
||||
pinl, 90, edge_width-s/2, 90, pinl+t-s]
|
||||
|
||||
holex = 0.6 * t
|
||||
holey = -0.5*t + self.burn
|
||||
holey = -0.5*t + self.burn - s / 2
|
||||
if self.rightside:
|
||||
p = list(reversed(p))
|
||||
holex = length - holex
|
||||
|
@ -1563,13 +1563,13 @@ class LidSideRight(BaseEdge):
|
|||
self.polyline(*p)
|
||||
|
||||
def startwidth(self):
|
||||
return self.boxes.thickness + self.settings.edge_width if self.rightside else 0.0
|
||||
return self.boxes.thickness + self.settings.edge_width if self.rightside else -self.settings.play / 2
|
||||
|
||||
def endwidth(self):
|
||||
return self.boxes.thickness + self.settings.edge_width if not self.rightside else 0.0
|
||||
return self.boxes.thickness + self.settings.edge_width if not self.rightside else -self.settings.play / 2
|
||||
|
||||
def margin(self):
|
||||
return self.boxes.thickness + self.settings.edge_width if not self.rightside else 0.0
|
||||
return self.boxes.thickness + self.settings.edge_width + self.settings.play / 2 if not self.rightside else 0.0
|
||||
|
||||
class LidSideLeft(LidSideRight):
|
||||
char = "M"
|
||||
|
|
Loading…
Reference in New Issue