luceda ipkiss教程 74:布尔运算去掉部分图层
案例分享:通过布尔运算,将版图部分图层挖空
所有代码如下:
from si_fab import all as pdk
from ipkiss3 import all as i3
import numpy as npclass grating_coupler(i3.PCell):_name_prefix = "grating_coupler"r = i3.PositiveNumberProperty(doc="the radius of the first grating tooth")sector_angle = i3.AngleProperty(doc="the sector angle")grating_period = i3.PositiveNumberProperty(doc="the period of grating")duty_cycle = i3.PositiveNumberProperty(doc="the duty cycle of grating")period_number = i3.IntProperty(doc="number of grating periods")def _default_r(self):return 50.0def _default_sector_angle(self):return 20.0def _default_grating_period(self):return 4.0def _default_duty_cycle(self):return 0.5def _default_period_number(self):return 15class Layout(i3.LayoutView):def _generate_elements(self, elems):elem2 = []length_triangle = self.r + self.grating_period * self.period_number + 10elem2 += i3.Wedge(layer=i3.TECH.PPLAYER.SI,begin_coord=(0.0, 0.0),end_coord=(length_triangle, 0.0),begin_width=0.0,end_width=length_triangle * np.tan(np.radians(self.sector_angle / 2)) * 2,)for period in range(self.period_number):elem2 += i3.ArcPath(layer=i3.TECH.PPLAYER.SI_TRENCH,center=(0.0, 0.0),radius=self.r + period * self.grating_period,start_angle=-self.sector_angle / 2 - 0.001,end_angle=self.sector_angle / 2 + 0.001,line_width=self.grating_period * self.duty_cycle,)layer1 = i3.TECH.PPLAYER.SIlayer2 = i3.TECH.PPLAYER.SI_TRENCHgenerated1 = layer1 - layer2mapping = {generated1: layer1}elems +=elem2# elems += i3.get_elements_for_generated_layers(elem2, mapping)return elemsif __name__ == '__main__':grating_coupler().Layout().visualize()
运行结果:
将代码55和56行改为:
# elems +=elem2elems += i3.get_elements_for_generated_layers(elem2, mapping)
运行结果如下: