Git Product home page Git Product logo

Comments (3)

hlprasu avatar hlprasu commented on September 14, 2024

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.

hlprasu avatar hlprasu commented on September 14, 2024
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.

mvnmgrx avatar mvnmgrx commented on September 14, 2024

Closed in preparation of next release.

from kiutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.