-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Keepout Generators for SMT Components #177
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1899b57
Added ensure function for checking an empty collection
callendorph 6c6a43b
Moved the `pad-interior-bounds` function to VirtualLP
callendorph d4dab05
Added a new interface for Keepout Generators
callendorph 7621e5c
Added the Keepout Creator as an option on SMT components
callendorph 173c06e
Cleanup after refactors
callendorph aa1819c
Added keepout configuration for the molded body 2-pin
callendorph a844f6f
[Bugfix] Fixed tests and examples for API change
callendorph 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#use-added-syntax(jitx) | ||
defpackage jsl/landpatterns/keep-outs: | ||
import core | ||
import jitx | ||
import jitx/commands | ||
|
||
import jsl/ensure | ||
import jsl/geometry/box | ||
import jsl/landpatterns/VirtualLP | ||
import jsl/landpatterns/silkscreen | ||
|
||
doc: \<DOC> | ||
Interface Type for Keepout Creation | ||
|
||
Custom keepout generators can be built by inheriting | ||
from this type and then implementing the interface | ||
<DOC> | ||
public deftype KeepoutCreator | ||
|
||
doc: \<DOC> | ||
Build the keep-out layer geometry in the Virtual LP Scene Graph | ||
|
||
This function will generate the necessary keep-out artwork | ||
in the virtual LP scene graph. | ||
<DOC> | ||
public defmulti build-keep-out (kc:KeepoutCreator, vp:VirtualLP -- side:Side = Top) -> False | ||
|
||
doc: \<DOC> | ||
Keepout Creator for Intra-pad Keepouts | ||
|
||
For SMT chip components like resistors and capacitors, | ||
we often want to restrict copper underneath the component. | ||
This can be for SI reasons, manufacturing reasons, etc. | ||
|
||
Sometimes we want to restrict the ground plane on an internal | ||
layer underneath these components. | ||
|
||
This type is used to contruct these keepouts on any layer | ||
of the board design. | ||
<DOC> | ||
public defstruct IntraPadKeepOut <: KeepoutCreator : | ||
doc: \<DOC> | ||
Set of copper layers where the keepout will be placed. | ||
The most obvious layer would be the top layer underneath | ||
the component. But for some applications, we might want | ||
to add keepouts in the reference plane underneath the | ||
component as well. | ||
|
||
The default value is the top layer `LayerIndex(0)` | ||
<DOC> | ||
layer-set:Tuple<LayerIndex> with: | ||
ensure => ensure-not-empty! | ||
default => [LayerIndex(0)] | ||
|
||
doc: \<DOC> | ||
Shrink the created keepout | ||
By default, this type will create a keepout that is | ||
the same size as the interstitual region between the | ||
pads of the SMT component. | ||
This parameter can be used to make this keepout region | ||
smaller (or larger if negative). | ||
By default this value is 0.0. | ||
<DOC> | ||
shrink-by:Double|Percentage|Dims with: | ||
default => 0.0 | ||
with: | ||
printer => true | ||
keyword-constructor => true | ||
|
||
|
||
public defmethod build-keep-out (k:IntraPadKeepOut, vp:VirtualLP -- side:Side = Top) : | ||
|
||
val b = pad-interior-bounds(vp, side) | ||
val sh-by = match(shrink-by(k)): | ||
(s:Double): Point(s, s) | ||
(s:Dims): Point(x(s), y(s)) | ||
(p:Percentage): | ||
val s = dims(b) | ||
Point(x(s) * p, y(s) * p) | ||
|
||
val b* = shrink(sh-by, b) | ||
val sh = to-Rectangle(b*) | ||
|
||
val cls = ["keepout"] | ||
for ly in layer-set(k) do: | ||
val fb = ForbidCopper(ly) | ||
add-artwork(vp, fb, sh, class = cls) | ||
|
||
|
||
|
||
|
||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
What does the argument
field:String
do here?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.
This is the interface for the
ensure => FUNC
members of adefstruct
field. I believe it gets used by thedefstruct
macro to tell the user which field of the defstruct had this fault case.