Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KiCad 7 feature collection #31

Closed
mvnmgrx opened this issue Sep 20, 2022 · 3 comments
Closed

KiCad 7 feature collection #31

mvnmgrx opened this issue Sep 20, 2022 · 3 comments

Comments

@mvnmgrx
Copy link
Owner

mvnmgrx commented Sep 20, 2022

A collection of new stuff KiCad 7 seems to implement that may be important in the future.

April developer update:

  • Symbol: New pin types, such as Unit, Orientation, etc
  • Board: Inverse text objects

February developer update:

  • DRC: Mechanical clearance rules: Two new constraints (mechanical_clearance and mechanical_hole_clearance)
  • DRC: Custom rule severities (new severity token added!)
  • DRC: Pad to zone rules (thermal_relief_gap, thermal_spoke_width and zone_connection)
  • Dimension: Radial dimension tool
  • Schematic: Rectangle and circle primitives added
  • Schematic: Custom fonts in development
  • Schematic: Text boxes added

December developer update

  • Do not populate field
  • Simulation model editor

New things in the KiCad developer reference:

@hlprasu
Copy link
Contributor

hlprasu commented Feb 19, 2023

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

@hlprasu
Copy link
Contributor

hlprasu commented Feb 21, 2023

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?

@mvnmgrx
Copy link
Owner Author

mvnmgrx commented Mar 27, 2023

Closed in preparation of next release.

@mvnmgrx mvnmgrx closed this as completed Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants