def printedStencilSubstrate(outlineDxf, thickness, frameHeight, frameWidth, frameClearance): bodyOffset = solid.utils.up(0) if frameWidth + frameClearance == 0 else solid.offset(r=frameWidth + frameClearance) body = solid.linear_extrude(height=thickness + frameHeight)( bodyOffset(solid.import_dxf(outlineDxf))) boardOffset = solid.utils.up(0) if frameClearance == 0 else solid.offset(r=frameClearance) board = solid.utils.up(thickness)( solid.linear_extrude(height=thickness + frameHeight)( boardOffset(solid.import_dxf(outlineDxf)))) return body - board
def printedStencil(outlineDxf, holesDxf, thickness, frameHeight, frameWidth, frameClearance, enlargeHoles, front): zScale = -1 if front else 1 xRotate = 180 if front else 0 substrate = solid.scale([1, 1, zScale])(printedStencilSubstrate(outlineDxf, thickness, frameHeight, frameWidth, frameClearance)) holesOffset = solid.utils.up(0) if enlargeHoles == 0 else solid.offset(delta=enlargeHoles) holes = solid.linear_extrude(height=4*thickness, center=True)( holesOffset(solid.import_dxf(holesDxf))) return solid.rotate(a=xRotate, v=[1, 0, 0])(substrate - holes)