Calling round corners from a script

Hello,

I’m currently diving into scripting to aid in building a workflow.
What’s the appropriate way to call functions like round corners, make corner, make first, etc… from a script?

For a make first I’ve hacked this together, it seems to do the job. Yet I’m not sure it’s the right way.

node = Layer.selection
node[0].makeNodeFirst()

Any ideas on round corners, make corner?

Thank you all for your help and input.
Andreas

Technically, corner components are hints. So you create a GSHint() and then set its type to the constant for corner components. See the API documentation for details: docu.glyphsapp.com

Thank you Rainer,

I’m not after corner components per se. Although your reply might come in handy.
Much more I’m interested in calling methods in the API as well as registered plugins and scripts.

Any insight is much appreciated.

If you know that a plugin has a certain functionality, you need to dig a lot. First get hold of a reference to that plugin. Then figure out how/what to call. dir() can help a lot with that.

Thank you @GeorgSeifert

So overall it looks to me it is best to build my own lib of functions and call into those. Be sure to hear from me again :smile:

I just started digging around and found this used in bubblekern:

roundFilter = NSClassFromString("GlyphsFilterRoundCorner")
offsetCurveFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_error_shadow_()

Can you speak to this @GeorgSeifert? Is this officially supported, are there more of these?

Almost:

GlyphsFilterRoundCorner = NSClassFromString("GlyphsFilterRoundCorner") 
GlyphsFilterRoundCorner.roundLayer_radius_checkSelection_visualCorrect_grid_()

Thank you again @GeorgSeifert I got it to work and I slowly get the hang of it.

  1. Is there a list of NSClassFromString for Filters I can explore, or do I have to dig with Hopper?
  2. How would I call e.g. make corner for a selected node. I’m unable to find a method in the docu
print(Glyphs.delegate().filterInstances())

Thanks :+1: , that leaves me with:
How would I call e.g. make corner for a selected node. I’m unable to find a method in the docu

This is a very old method. In the beginning I was coding in German:

GlyphsFilterRoundCorner.macheEckeAtNode_andRadius_selected_visualCorrect_grid_()

de: Der Name ist Knaller :smiley:

Thanks for that.