File tree 1 file changed +11
-3
lines changed 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,14 @@ def diode(
181
181
+ polylinegon (triangle , True , ** kwargs ))
182
182
183
183
184
+ SIDE_TO_ANGLE_MAP = {
185
+ Side .RIGHT : pi ,
186
+ Side .TOP : pi / 2 ,
187
+ Side .LEFT : 0 ,
188
+ Side .RIGHT : 3 * pi / 2 ,
189
+ }
190
+
191
+
184
192
@component ("U" , "IC" )
185
193
@no_ambiguous
186
194
def integrated_circuit (
@@ -190,10 +198,10 @@ def integrated_circuit(
190
198
** kwargs ):
191
199
"Draw an IC"
192
200
scale = kwargs .get ("scale" , 1 )
193
- sz = (box .p2 - box .p1 + 2 ) * scale
201
+ sz = (box .p2 - box .p1 ) * scale
194
202
mid = (box .p2 + box .p1 ) * scale / 2
195
203
out = XML .rect (
196
- x = box .p1 .real * scale - scale ,
204
+ x = box .p1 .real * scale ,
197
205
y = box .p1 .imag * scale ,
198
206
width = sz .real ,
199
207
height = sz .imag ,
@@ -202,7 +210,7 @@ def integrated_circuit(
202
210
for term in terminals :
203
211
out += bunch_o_lines ([(
204
212
term .pt ,
205
- term .pt + rect (1 , term .side * pi / 2 )
213
+ term .pt + rect (1 , SIDE_TO_ANGLE_MAP [ term .side ] )
206
214
)], ** kwargs )
207
215
out += XML .text (
208
216
XML .tspan (f"{ box .type } { box .id } " , class_ = "cmp-id" ),
You can’t perform that action at this time.
0 commit comments