Comments (3)
The stroke definition seems to have made the color property to be optional in the KiCad 7.0.0. Unfortunately this is undocumented but visible in generated .kicad_sym files.
Specifically, in https://dev-docs.kicad.org/en/file-formats/sexpr-intro/index.html#_symbols, the stroke definition given is
(stroke
(width WIDTH)
(type TYPE)
(color R G B A)
)
This is valid for KiCad 6.0. But, in KiCad 7.0 it seems to be
(stroke
(width WIDTH)
(type TYPE)
[(color R G B A)]
)
where color property is made optional for a stroke. This needs to be revalidated with KiCad team. I've raised an issue in KiCad dev docs gitlab repo - https://gitlab.com/kicad/services/kicad-dev-docs/-/issues/23
from kiutils.
diff --git a/src/kiutils/items/common.py b/src/kiutils/items/common.py
index bca15f8..5384ed9 100644
--- a/src/kiutils/items/common.py
+++ b/src/kiutils/items/common.py
@@ -233,7 +233,7 @@ class Stroke():
Returns:
- Stroke: Object of the class initialized with the given S-Expression
"""
- if not isinstance(exp, list) or len(exp) != 4:
+ if not isinstance(exp, list) or len(exp) < 3:
raise Exception("Expression does not have the correct type")
if exp[0] != 'stroke':
@@ -246,6 +246,9 @@ class Stroke():
if item[0] == 'width': object.width = item[1]
if item[0] == 'type': object.type = item[1]
if item[0] == 'color': object.color = ColorRGBA.from_sexpr(item)
+
+ if len(exp) == 3:
+ object.color = ColorRGBA() # 0, 0, 0, 0 -- default
return object
def to_sexpr(self, indent=2, newline=True) -> str:
I did the above change in code which fixed it. Does this seem ok?
from kiutils.
Closed in preparation of next release.
from kiutils.
Related Issues (20)
- Footprint: private_layer token is not parsed
- Footprint: Pad.layers token are quoted, but missing after parsing
- Footprints don't support net_tie_pad_groups
- Error: Dimensions are not yet handled! Please report this bug along with the file being parsed.
- PCB: Knockout text token not parsed
- Broken as of KiCAD 8? HOT 3
- Creating a design rule only for inner/outer layers is not possible HOT 1
- KiCad 7: Circle, Rectangle and Arcs in schematics
- KiCad 7: Mark symbols as DNP
- KiCad 7: DRC severity token
- KiCad 7: Instances token in symbols and hierarchical sheets HOT 1
- KiCad 7: Layer token for Images
- KiCad 7: Property IDs are no longer needed
- KiCad 7: Plot params have new tokens
- Legacy: Host token in schematics HOT 1
- KiCad v7: Check where render_cache is used HOT 1
- Support for bus_alias
- [Example Request] Adding Schematic Symbol HOT 2
- Bug: 3D model with `hide` property won't parse correctly
- Footprint Attribute "Exempt from courtyard requirement" is not parsed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kiutils.