Try this code. It will create a polygon instead of strips of metal.
procedure(meshSelected(@key (meshWidth 1.0) (cv geGetEditCellView()))
let((shape box innerBox rects mesh)
shape = car(selectedSet())
box = shape~>bBox
innerBox = list(xCoord(lowerLeft(box))+meshWidth:yCoord(lowerLeft(box))+meshWidth
xCoord(upperRight(box))-meshWidth:yCoord(upperRight(box))-meshWidth)
rects = rodFillBBoxWithRects(
?cvId geGetEditCellView()
?layer "y0"
?fillBBox innerBox
?width meshWidth
?length meshWidth
?spaceX meshWidth
?spaceY meshWidth
?gap 'minimum ;optionally 'distribute
)
mesh = dbLayerAndNot(cv shape~>lpp list(shape) rects 1000) ;last # is max # of vertices
dbDeleteObject(shape)
mapcar('dbDeleteObject rects)
mesh
) ;let
) ;proc
Select your piece of metal and run this command, filling in the appropriate number for the width of your holes. I coded a default of 1.0. Also, the program above keeps the holes at a minimum space (meshWidth). If your rectangle is not a perfect multiple of the meshWidth, you'll end up with wide strips at the top and right. You can change the ?gap argument to be 'distribute and the mesh will be more even.
meshSelected(?meshWidth 2.0)
Derek