smartComponentValues Issue

I’m trying to write a plugin to use with Glyphs3, but I’m having a problem with smartComponentValues.

for layer in Glyphs.font.selectedLayers:
        	for compo in layer.shapes:
        		if == "_part.test":

When the smart component property value is set to the maximum value with the smart component setting (cmd+opt+i), the value is not output.

	<GSSmartComponentAxis "Height">,
	<GSSmartComponentAxis "Thickness">
<GSNotifyingDictionary 0x600013277140> {
    Thickness = 5;

Meanwhile, when the smart component property value is set to the maximum value with the smart setting on the right palette, all values are output.
스크린샷 2021-08-09 오후 2.14.10

	<GSSmartComponentAxis "Height">,
	<GSSmartComponentAxis "Thickness">
<GSNotifyingDictionary 0x600013277140> {
    Height = 500;
    Thickness = 5;
[5.0, 500.0]

Currently, the value is output differently depending on how the property value of the smart component is specified. I hope all values will be printed even when it is the maximum value.

The settings omits default values. This is to save file size and avoid noice.

Here is some sample code to determine this default value:

component = Layer.selection[0]
componentGlyph = component.component
componentLayer = component.componentLayer

defaultValues = componentLayer.smartComponentPoleMapping
smartComponentAxes = componentGlyph.smartComponentAxes
for axis in smartComponentAxes:
	pieceValue = component.smartComponentValues[]
	if pieceValue is None:
		if defaultValues[]:
			if int(defaultValues[]) == 1:
				pieceValue = axis.bottomValue
				pieceValue = axis.topValue
			print("nothing set for axis:",
	print(, pieceValue)

Thanks. But I get a TypeError at the line.

pieceValue = component.smartComponentValues[]

File "GlyphsApp/GlyphsApp/", line 2390, in __getitem__
TypeError: 'GSNotifyingDictionary' object is not subscriptable

Right m. I had fixed that while writing the sample. I’ll send a low level code that circumvents this until the update is out.

1 Like

When do you send out the low level code?

Sorry that I didn’t send it, yet. The issue is fixed in the latest cutting edge version.

Something like this should work.

pieceSettings = component.pieceSettings()
if pieceSettings is not None:
    pieceValue = pieceSettings.objectForKey_(


pieceValue = component.pieceValueForKey_(
if pieceValue > 100000: # NSNotFound if there is no value
    # get default value