IPC-Plugins: Visiblity-Flag for text

I’m currently trying to rewrite our CoilGen to use the IPC API. It is making slow progress, right now I struggle to set the text to visible.

fpi = FootprintInstance()
fpi.layer = BoardLayer.BL_F_Cu
fpi.reference_field.text.value = "coil name"
fpi.reference_field.text.attributes = defaults.text
fpi.reference_field.text.attributes.visible = True
fpi.value_field.text.value = "abc def"
fpi.value_field.text.attributes = defaults.text
fpi.value_field.text.attributes.visible = False
fpi.attributes.not_in_schematic = True
fpi.attributes.exclude_from_bill_of_materials = True
fpi.attributes.exclude_from_position_files = True

fp = fpi.definition

copper_arc = BoardArc()
copper_arc.start = Vector2.from_xy_mm(20, 20)
copper_arc.mid = Vector2.from_xy_mm(25, 25) # mid point ON arc, NOT center point
copper_arc.end = Vector2.from_xy_mm(30, 20)
copper_arc.layer = BoardLayer.BL_F_Cu
copper_arc.attributes.stroke.width = 1500000 # nm

fp.add_item(copper_arc)


# TODO: Why do we have to do it like this?
# places everything at 0,0
created = [cast(FootprintInstance, i) for i in self.board.create_items(fpi)]

# attaches footprint to mouse
if len(created) == 1:
	self.board.interactive_move(created[0].id)

The line fpi.reference_field.text.attributes.visible = True should set it to visible, but the checkbox is still disabled in KiCad.

Judging by these two files, it looks like I did the right thing:

But it looks like this in KiCad:

Are you trying with the v9.0.2-RC ? or what version are you using?

I’m using version 9.0.1

  • It’s possible that the .visible property doesn’t actually push through until it’s linked with the board or re-rendered.
    The creation step:
created = [cast(FootprintInstance, i) for i in self.board.create_items(fpi)]
might not be honouring the visibility due to internal ordering or default merging.


1 Like

Any idea how to resolve this then? Because this is how it is done in the example