代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 20:31:31 2021
@author: xiaoyu
"""
import gdspy as gs
import numpy as np
lib = gs.GdsLibrary()
cell = lib.new_cell('y')
# Start a path at (0, 0) with width 1
path1 = gs.Path(1, (0, 0))
# Add a segment to the path goin in the '+y' direction
path1.segment(4, "+y")
# Further segments or turns will folow the current path direction
# to ensure continuity
path1.turn(2, "r")
path1.segment(1)
path1.turn(3, "rr")
# Start 3 parallel paths with center-to-center distance of 1.5
path3 = gs.Path(0.1, (-5.5, 3), number_of_paths=3, distance=1.5)
# Add a segment tapering the widths up to 0.5
path3.segment(2, "-y", final_width=0.5)
# Add a bezier curve decreasing the distance between paths to 0.75
path3.bezier([(0, -2), (1, -3), (3, -3)], final_distance=0.75)
# Add a parametric section to modulate the width with a sinusoidal
# shape. Note that the algorithm that determines the number of
# evaluations of the parametric curve does not take the width into
# consideration, so we have to manually increase this parameter.
path3.parametric(
lambda u: (5 * u, 0),
lambda u: (1, 0),
final_width=lambda u: 0.4 + 0.1 * np.cos(10 * np.pi * u),
number_of_evaluations=256,
)
# Add a circular turn and a final tapering segment.
path3.turn(3, "l")
path3.segment(2, final_width=1, final_distance=1.5)
cell.add(path1)
cell.add(path3)
lib.write_gds('E:/python/xiaoyu_GDSTest/Polygonal-Only Paths.gds')
gs.LayoutViewer(lib)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。