parent
cfe61c9b7e
commit
e22e1db49a
|
|
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Basic KiCost support (experimental).
|
||||
- Basic internal BoM and KiCost integration (experimental)
|
||||
- Experimental mechanism to change 3D models according to the variant.
|
||||
- Support for width, style and color in "wire notes" (#70)
|
||||
|
||||
### Changed
|
||||
- Errors and warnings from KiAuto now are printed as errors and warnings.
|
||||
|
|
|
|||
|
|
@ -1166,15 +1166,34 @@ class SchematicWire(object):
|
|||
ENTRIES = {'Wire': ENTRY_WIRE, 'Bus': ENTRY_BUS}
|
||||
NAMES = ['Wire Wire Line', 'Wire Bus Line', 'Wire Notes Line', 'Entry Wire Line', 'Entry Bus Bus']
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, width=None, style=None, rgb=None):
|
||||
super().__init__()
|
||||
self.width = width
|
||||
self.rgb = rgb
|
||||
self.style = style
|
||||
|
||||
@staticmethod
|
||||
def load(f, line):
|
||||
res = _split_space(line)
|
||||
if len(res) != 3:
|
||||
res_l = len(res)
|
||||
width = style = rgb = None
|
||||
if res_l > 3 and res[0] == 'Wire' and res[1] == 'Notes' and res[2] == 'Line':
|
||||
offset = 3
|
||||
while offset < res_l:
|
||||
if res[offset] == 'width' and res_l > offset+1:
|
||||
width = res[offset+1]
|
||||
offset += 2
|
||||
elif res[offset] == 'style' and res_l > offset+1:
|
||||
style = res[offset+1]
|
||||
offset += 2
|
||||
elif res[offset].startswith('rgb(') and res_l > offset+2:
|
||||
rgb = res[offset]+' '+res[offset+1]+' '+res[offset+2]
|
||||
offset += 3
|
||||
else:
|
||||
raise SchFileError('Malformed wire note', line, f)
|
||||
elif res_l != 3:
|
||||
raise SchFileError('Malformed wire', line, f)
|
||||
wire = SchematicWire()
|
||||
wire = SchematicWire(width, style, rgb)
|
||||
if res[0] == 'Wire':
|
||||
# Wire Wire Line
|
||||
# Wire Bus Line
|
||||
|
|
@ -1201,7 +1220,14 @@ class SchematicWire(object):
|
|||
return wire
|
||||
|
||||
def write(self, f):
|
||||
f.write(SchematicWire.NAMES[self.type])
|
||||
extra = ''
|
||||
if self.width is not None:
|
||||
extra += ' width '+self.width
|
||||
if self.style is not None:
|
||||
extra += ' style '+self.style
|
||||
if self.rgb is not None:
|
||||
extra += ' '+self.rgb
|
||||
f.write(SchematicWire.NAMES[self.type]+extra)
|
||||
f.write('\n\t{} {} {} {}\n'.format(self.x, self.y, self.ex, self.ey))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1999,4 +1999,36 @@ F 3 "" H 2750 3450 50 0001 C CNN
|
|||
1 2750 3450
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
Wire Notes Line width 20
|
||||
990 5000 1490 5000
|
||||
Wire Notes Line width 20
|
||||
1490 5000 1490 5500
|
||||
Wire Notes Line width 20
|
||||
1490 5500 990 5500
|
||||
Wire Notes Line width 20
|
||||
990 5500 990 5000
|
||||
Wire Notes Line rgb(255, 0, 0)
|
||||
2000 5000 2500 5000
|
||||
Wire Notes Line rgb(255, 0, 0)
|
||||
2500 5000 2500 5500
|
||||
Wire Notes Line rgb(255, 0, 0)
|
||||
2500 5500 2000 5500
|
||||
Wire Notes Line rgb(255, 0, 0)
|
||||
2000 5500 2000 5000
|
||||
Wire Notes Line style solid
|
||||
3000 5000 3500 5000
|
||||
Wire Notes Line style solid
|
||||
3500 5000 3500 5500
|
||||
Wire Notes Line style solid
|
||||
3500 5500 3000 5500
|
||||
Wire Notes Line style solid
|
||||
3000 5500 3000 5000
|
||||
Wire Notes Line width 30 style dash_dot rgb(0, 255, 0)
|
||||
2010 5700 2510 5700
|
||||
Wire Notes Line width 20 style dotted
|
||||
2510 5700 2510 6200
|
||||
Wire Notes Line style solid rgb(255, 0, 255)
|
||||
2510 6200 2010 6200
|
||||
Wire Notes Line width 20
|
||||
2010 6200 2010 5700
|
||||
$EndSCHEMATC
|
||||
|
|
|
|||
Loading…
Reference in New Issue