Hi,
I had been trying to create a script for the Footprint Wizard and i had found helpful information on comments of the scripts uploaded on this thread.
Also found some information on the “default” scripts, but i have not been able to find how to draw a line, circle, etc. on a specific layer, in my case i would like to draw the “Center of Gravity Origin” circle and cross lines on the F.FAB layer.
Searching on the FootprintWizardDrawingAids class code i had seen this function:
def SetLayer(self, layer):
“”"
Set the current drawing layer, used for subsequent drawing
operations
“”"
self.dc[‘layer’] = layer
But i do not know how to specify the layer name, maybe a “F.FAB” string?
I’m pretty bad explaining, hope it’s clear.
Thanks in advance
I have been reading more the FootprintWizardDrawingAids class code and found this function:
def Value(self, x, y, size, orientation_degree = 0):
“”"
As for references, draw the module’s value
“”"
text_size = pcbnew.wxSize(size, size)
self.module.Value().SetPos0(self.TransformPoint(x, y))
self.module.Value().SetTextPosition(self.module.Value().GetPos0())
self.module.Value().SetSize(text_size)
self.module.Value().SetLayer(self.DefaultTextValueLayer())
self.module.Value().SetOrientation(orientation_degree*10) # internal angles are in 0.1 deg
On the self.module.Value().SetLayer(self.DefaultTextValueLayer()) function it gets another function return value:
def DefaultTextValueLayer(self):
return pcbnew.F_Fab
So i think there’s the answer to draw in the F_Fab layer i must use pcbnew.F_Fab as parameter in the SetLayer function.
EDIT
self.draw.SetLayer(pcbnew.F_Fab)
That will do the trick to set F_Fab layer, to draw on the F_CrtYd layer we must use pcbnew.F_CrtYd, then we can use:
self.draw.Line(-lim_x, -inner, -inner, -lim_y)
To draw a line on the selected layer, etc.
1 Like