Skip to content

Commit

Permalink
Updated two-pin label positioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
callendorph committed Sep 16, 2024
1 parent f3893b5 commit b8d8e60
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/symbols/ferrite.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defpackage jsl/examples/symbols/ferrite:


pcb-component test-SMT-ferrite:

mpn = "BLM18KG331SN1D"
pin-properties :
[pin:Ref | pads:Ref ... | side:Dir]
[p[1] | p[1] | Up ]
Expand Down
6 changes: 4 additions & 2 deletions src/symbols/TwoPinSymbol.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ public defn two-pin-build-labels (x:TwoPinSymbol, sn:SymbolNode, symb-params:Sym
val overall = glyph-bounds(sn)
val p = get-label-params(symb-params)

val offset = Point(right(overall) + 0.5, 0.0)
val [r-pos, v-pos] = compute-label-positions(symb-params, N)
build-labels(
p,
sn,
LabelPosition([right(overall) + 0.5, 0.5], W)
LabelPosition([right(overall) + 0.5, -0.5], W)
LabelPosition(offset + r-pos, W)
LabelPosition(offset + v-pos, W)
)

public defmethod build-params (x:TwoPinSymbol, sn:SymbolNode):
Expand Down
21 changes: 21 additions & 0 deletions src/symbols/ferrite.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defpackage jsl/symbols/ferrite:

import jsl/ensure
import jsl/symbols/framework
import jsl/geometry/box

val DEF_LINE_WIDTH = 0.05
val DEF_SYMB_BODY = Dims(0.9, 0.4)
Expand Down Expand Up @@ -113,3 +114,23 @@ public defmethod build-artwork (

public defmethod build-orientation (x:FerriteSymbol, sn:SymbolNode):
set-preferred-orientation(sn, PreferRotation([1]))

public defmethod build-params (x:FerriteSymbol, sn:SymbolNode) :
val overall = glyph-bounds(sn)
val p = get-params(x) as FerriteSymbolParams

val offset = Point(left(overall), 0.0)

val r-P = loc(offset, 90.0)

val lp = get-label-params(p)
val r-H = ref-label-size(lp)
val v-P = loc(offset + Point((- r-H), 0.0), 90.0)

build-labels(
get-label-params(p),
sn,
LabelPosition(r-P, SE)
LabelPosition(v-P, SE)
)

0 comments on commit b8d8e60

Please sign in to comment.