This is very much doable and you can actually reuse our script from the Object Library. Particularly the Hexagonal lattice PC L-Cavity where we use L number to define the number of missing holes in the center row. In addition, this script also allows you to shrink and offset the holes adjacent to the cavity. This can be useful when optimizing the Q factor.
I have attached this structure group here:
PC with L_cavity Example.lms (386.1 KB)
But you can always access it directly from the online library as shown here:
You are particularly interested in this portion of the code that defines the center row(line 35 to 51):
# draw center row
If you do not want any shift or size adjustments of the adjacent holes, simply keep dx shift and dr shring equal to zero.