HiGreg
June 9, 2020, 12:27am
1
I have been able to create a solid polygon on any layer using a DRAWSEGMENT and ds.SetShape(pcbnew.S_POLYGON) then calling ds.SetPolyPoints(wxpointlist).
This works very well. I then tried adding holes to the SHAPE_POLY_SET:
ds.GetPolyShape( ).AddHole( pcbnew.SHAPE_LINE_CHAIN( wxPointList) )
And I get the error “Wrong number or type of arguments”.
Anyone know how to create a DRAWSEGMENT S_POLYGON with holes in python?
qu1ck
June 9, 2020, 12:52am
2
SHAPE_LINE_CHAIN doesn’t have a constructor that takes wxPoint list. You can create it using default constructor and then Append() points.
1 Like
HiGreg
June 9, 2020, 12:56am
3
Awesome. I think that’s working for me. Creating DRAWSEGMENT S_POLYGONs from SVG (something’s wrong with the right side of this “PHI” symbol):
Edit: using this code (where geom[1:] is my list of wxPoints and ds is the previously-defined S_POLYGON)
lc=pcbnew.SHAPE_LINE_CHAIN()
map(lc.Append,itertools.starmap(pcbnew.VECTOR2I,geom[1:]))
ds.GetPolyShape().AddHole(lc)
system
Closed
September 7, 2020, 12:56am
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.