KiKit icon indicating copy to clipboard operation
KiKit copied to clipboard

addText layer setting not working

Open Zuikkis opened this issue 1 year ago • 1 comments

Prerequisites

  • [x] I have read FAQ
  • [x] I have searched existing issues (including closed ones)
  • [x] I use KiKit at least version 1.7.1 (older version are not supported)

KiKit version

1.7.1

KiCAD version (only KiCAD 8 and 9 are supported)

9.0.0

Operating system

Windows 10

Description

I'm writing a post process script. I need to add some text to different layers.

The layer= parameter in addText() is not working. I always get error " 'int' object has no attribute 'name' " no matter what I put as argument.

Steps to Reproduce

Example code:

from pcbnew import F_Cu
    
def kikitPostprocess(panel, arg):

    #panel.addText("test", (( 0,0 )), layer=F_Cu )
    #panel.addText("test", (( 0,0 )), layer=0 )
    panel.addText("test", (( 0,0 )) )

The last line is the only one that works.

layer= parameter works fine in addLine(). So this is something specific to addText().

I'm running kikit from the GUI.

Zuikkis avatar Mar 14 '25 08:03 Zuikkis

Ok, I managed to get it working. This works:

from kikit.defs import Layer

def kikitPostprocess(panel, arg):

    panel.addText("test", (( 0,0 )), layer=Layer.F_Cu )

Layer.F_Cu seems to work equally in every place. It's interesting that many functions accept pcbnew.F_Cu too..

Zuikkis avatar Mar 14 '25 11:03 Zuikkis