|
发表于 2025-3-19 16:42:21
|
显示全部楼层
/*-----------------------------------------------------------*
* 脚本功能:导出当前CellView中所有Instance的四个角点坐标 *
* 使用说明:在Virtuoso CIW中加载并执行此脚本 *
*-----------------------------------------------------------*/
procedure(GetAllInstanceCoordinates()
let((cv instances outfile)
; 获取当前打开的CellView
cv = geGetEditCellView()
unless(cv
error("Error: No CellView is opened!")
return()
)
; 创建输出文件
outfile = outfile("./instance_coordinates.txt" "w")
unless(outfile
error("Error: Failed to create output file!")
return()
)
; 遍历所有Instance
instances = cv~>instances
foreach(instance instances
; 获取Instance的边界框(已考虑旋转/镜像后的坐标)
bBox = instance~>bBox
x1 = bBox~>x1
y1 = bBox~>y1
x2 = bBox~>x2
y2 = bBox~>y2
; 计算四个角点坐标
lowerLeft = list(x1 y1) ; 左下角
lowerRight = list(x2 y1) ; 右下角
upperRight = list(x2 y2) ; 右上角
upperLeft = list(x1 y2) ; 左上角
; 写入文件(可选:单位转换)
fprintf(outfile "Instance Name: %s\n" instance~>name)
fprintf(outfile "Master Cell: %s\n" instance~>cellName)
fprintf(outfile "Lower Left : %7.4f, %7.4f\n" x1 y1)
fprintf(outfile "Lower Right : %7.4f, %7.4f\n" x2 y1)
fprintf(outfile "Upper Right : %7.4f, %7.4f\n" x2 y2)
fprintf(outfile "Upper Left : %7.4f, %7.4f\n\n" x1 y2)
)
; 关闭文件
close(outfile)
printf("坐标已导出至:./instance_coordinates.txt\n")
)
)
; 执行函数
GetAllInstanceCoordinates()
|
|