This repository has been archived by the owner on Oct 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Ring pad support inspired by wuerth electronics smd mounting hardware #351
Merged
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
1829761
copper only ring pad prototype
poeschlr 08f04bf
Workaround for mask margin bugs
poeschlr 43d3007
Workaround for single paste zone (kicad bug)
poeschlr e7a2549
add interface to rotate a vector2d around a given origin
poeschlr 64d2f17
handle solder paste parameters
poeschlr 98603c8
use rotate function instead of calculating coordinates
poeschlr 684e006
added polar coordinate handling to Vector2D
poeschlr b1c455b
extended arc interface
poeschlr a64340f
ensure -0 is not created by float formater
poeschlr 19f3de8
More arc testcases
poeschlr 03bd06c
ode style
poeschlr 7a50885
python 2 compatibility
poeschlr 12bc2f6
add rotation interface for basic nodes
poeschlr 53b59eb
Add translation and intersection
poeschlr e008043
Add docstrings
poeschlr 01a5f19
intersection supports arcs
poeschlr 2957b34
cut line implemented
poeschlr 244847b
Introduced geometric base clases for lines, circles and arcs
poeschlr 6719d3f
Add cut functionallity to arcs
poeschlr f942451
arc pad primitive used for paste parts of ring pad
poeschlr 4ddd2c3
Finish paste pad handling for ring pads
poeschlr 3dca632
cleanups and docu
poeschlr 3bda5f9
Correct overlap, paste radius and arc width calculation
poeschlr de61209
correct handling of paste to paste clearance
poeschlr c159b56
Add commandline interface script for generating ring pads
poeschlr f2a46bb
Add wuerth smt mouniting hardware with inner through hole
poeschlr ac37b7f
klc fixes
poeschlr 191f472
fix ring pad paste for 2 zones
poeschlr 3c2728b
Add M1.6 (including blind hole) and new naming convention
poeschlr 9e7cb69
add reverse type
poeschlr f127438
add snap rivet version
poeschlr 961ca20
script renamed to reflect the fact that it is generic
poeschlr 23be404
add external thread version
poeschlr 9f6bfe5
add maximum round radius to ring pad
poeschlr cb79753
handle 0 inner diameter
poeschlr 6385473
add non npth version
poeschlr e12a59c
rename script folder to reflect the generic content
poeschlr a0706d7
Improved naming and description
poeschlr 3244af2
typo in description
poeschlr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add translation and intersection
- Loading branch information
commit 53b59eb97f7192be6387c6180640c9a98149f698
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# KicadModTree 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 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# KicadModTree 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 kicad-footprint-generator. If not, see < http://www.gnu.org/licenses/ >. | ||
# | ||
# (C) 2016-2018 by Thomas Pointhuber, <thomas.pointhuber@gmx.at> | ||
|
||
import math | ||
from KicadModTree.nodes.base import * | ||
from KicadModTree.Vector import * | ||
|
||
|
||
class BaseNodeIntersection(): | ||
|
||
@staticmethod | ||
def intersectTwoLines(line1, line2): | ||
# we use homogeneous coordinates here. | ||
l1 = line1.to_homogeneous() | ||
l2 = line2.to_homogeneous() | ||
|
||
ip = l1.cross_product(l2) | ||
if ip.z == 0: | ||
return None | ||
|
||
return Vector2D.from_homogeneous(ip) | ||
|
||
@staticmethod | ||
def intersectLineWithCircle(line, circle): | ||
# from http://mathworld.wolfram.com/Circle-LineIntersection.html | ||
# Equations are for circle center on (0, 0) so we translate everything | ||
# to the orign (well the line anyways as we do only need the radius of the circle) | ||
lt = Line(start=line.start_pos, end=line.end_pos).translate(-circle.center_pos) | ||
|
||
d = lt.end_pos - lt.start_pos | ||
dr = math.hypot(d.x, d.y) | ||
D = lt.start_pos.x*lt.end_pos.y - lt.end_pos.x*lt.start_pos.y | ||
|
||
discriminant = circle.radius**2 * dr**2 - D**2 | ||
intersection = [] | ||
if discriminant < 0: | ||
return intersection | ||
|
||
intersection.append( | ||
Vector2D({ | ||
'x': (D*d.y + math.copysign(1, d.y)*d.x*math.sqrt(discriminant))/dr**2, | ||
'y': (-D*d.x + abs(d.y)*math.sqrt(discriminant))/dr**2 | ||
}) + circle.center_pos) | ||
if discriminant == 0: | ||
return intersection | ||
|
||
intersection.append( | ||
Vector2D({ | ||
'x': (D*d.y - math.copysign(1, d.y)*d.x*math.sqrt(discriminant))/dr**2, | ||
'y': (-D*d.x - abs(d.y)*math.sqrt(discriminant))/dr**2 | ||
}) + circle.center_pos) | ||
return intersection |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: this seems to be unused.
Can you give an example use-case for those functions?