Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mousebites like OshPark, with holes touching sides. #730

Open
1 task done
bootchk opened this issue Sep 8, 2024 · 1 comment
Open
1 task done

mousebites like OshPark, with holes touching sides. #730

bootchk opened this issue Sep 8, 2024 · 1 comment

Comments

@bootchk
Copy link

bootchk commented Sep 8, 2024

Prerequisites

  • I have read the documentation and the proposed feature is not implemented.

Description

The request is to generate a number of drills in a mousebite that will fit in a tab.

This might put a drill very near the side of a tab.
But when you consider the round corners for milling on an inside corner,
this still produces a good tab:
with a high proportion of material drilled out of the mousebite.

Here is the Oshpark drawing of a mousebite.

OshparkMousebite

Note the tab is 2.5mm wide and holes are 0.5mm diameter, with 1mm spacing.
So three holes fit in 2.5mm, if the holes touch the edge.
(From their website, width actually given as 0.1 inch, 0.02 inch drill, 0.04 inch spacing.)

Here is one fascimile I could generate with KiKit.
Here is KiKit tab width: 2.5mm, mousebite hole spacing: 1mm, mousebite prolong:0.5 .
I assume the KiKit algorithm generates two drills because that is all that would fit

KiKitmousebite

Here is KiKit tab width: 2.5mm, mousebite hole spacing: 1mm, mousebite prolong:0.

KiKitMousebite2_5-1-0

It seems like the hole spacing is actually 1.25.

Note my boards are very small, say 5 mm wide.

This issue is low priority.
Note that OshPark will generate mousebites for a panel made by KiKit.
So one actually doesn't need to generate mousebites in KiKit to order from OshPark.
But you optionally can, to ensure that the mousebites are where you want them.

I could be wrong.
I tried other combinations, such as hole spacing 0.99 and 0.8, with no luck.
I haven't looked at the KiKit Python code.
Possibly its a floating point comparison issue.

Thanks, KiKit is great. I am a FOSS contributor to GIMP, especially plugin infrastructure.
The KiKit and KiCad plugin architecture is very nice.

@yaqwsx
Copy link
Owner

yaqwsx commented Sep 15, 2024

The code for generating mouse bites is relatively short and, I hope, self-explanatory:

KiKit/kikit/panelize.py

Lines 1531 to 1557 in a8d1c05

def makeMouseBites(self, cuts, diameter, spacing, offset=fromMm(0.25),
prolongation=fromMm(0.5)):
"""
Take a list of cuts and perform mouse bites. The cuts can be prolonged
to
"""
bloatedSubstrate = prep(self.boardSubstrate.substrates.buffer(SHP_EPSILON))
offsetCuts = []
for cut in cuts:
cut = cut.simplify(SHP_EPSILON) # Remove self-intersecting geometry
cut = prolongCut(cut, prolongation)
offsetCut = cut.parallel_offset(offset, "left")
offsetCuts.append(offsetCut)
for cut in listGeometries(shapely.ops.unary_union(offsetCuts).simplify(SHP_EPSILON)):
self.renderedMousebiteCounter += 1
length = cut.length
count = int(length / spacing) + 1
for i in range(count):
if count == 1:
hole = cut.interpolate(0.5, normalized=True)
else:
hole = cut.interpolate( i * length / (count - 1) )
if bloatedSubstrate.intersects(hole):
self.addNPTHole(toKiCADPoint((hole.x, hole.y)), diameter,
ref=f"KiKit_MB_{self.renderedMousebiteCounter}_{i+1}",
excludedFromPos=True)
.

The idea is:

  • the cut line formed by the tab is simplified and prolonged by the specified amount,
  • we place the holes evenly along the cut line (hence, the actual pitch might slightly deviate),
  • a hole is created only when its center is placed on the board substrate. ←This is where I think the behavior your report comes from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants