首页 > 其他分享 >提取PAD LOCATION 坐标

提取PAD LOCATION 坐标

时间:2024-06-06 17:44:14浏览次数:23  
标签:name 坐标 cv2 value pad LOCATION file PAD bBox

hiSetBindKey("Layout" "F9" "smpGUIPadExtract()")


procedure(smpGUIPadExtract()

let( ()

	padlayerName=hiCreateStringField(

        	?name   `padlayerName

		?prompt "Layer Name"

	)

	padlayerPpos=hiCreateStringField(

       	 	?name   `padlayerPpos

        	?prompt "Layer Purpose"

	)

	padangleOff=hiCreateFloatField(

		?name `padangleOff

		?prompt "Angle Offset (-90 to 90 degree)"

		?defValue 15.0

	)

	padorder   =hiCreateCyclicField(

                 ?name   `padorder

                 ?prompt "Order"

                 ?choices list("clockwise" "anticlockwise")

                 ?defValue "clockwise"

       )

       padsizeFilter=hiCreateFloatField(

		?name `padsizeFilter

		?prompt "Pad size must larger than"

		?defValue 0.0

	)

       padInstDepth=hiCreateIntField(

		?name `padInstDepth

		?prompt "Pad instances flatten depth (1~32)"

		?defValue 32

	)

       refPointCoorX=hiCreateFloatField(

		?name `refPointCoorX

		?prompt "Reference point coordinate X"

		?defValue 0.0

	)
       refPointCoorY=hiCreateFloatField(

		?name `refPointCoorY

		?prompt "Reference point coordinate Y"

		?defValue 0.0

	)


PEForm=hiCreateAppForm(

?name `padExtractForm

?formTitle "Extract PAD Location"

?callback `dosmpPadExtract(hiGetCurrentForm())

?fields list(

padlayerName

padlayerPpos

padorder

padsizeFilter

padangleOff

padInstDepth

refPointCoorX

refPointCoorY

)

)

layerDefValue=nth(0 leGetEntryLayer())

pposDefValue=nth(1 leGetEntryLayer())

padExtractForm->padlayerName->value=layerDefValue

padExtractForm->padlayerPpos->value=pposDefValue

hiDisplayForm(`padExtractForm)

   )

 )




procedure( dosmpPadExtract(myForm)

let( ()

layerName=myForm->padlayerName->value

layerPpos=myForm->padlayerPpos->value

order =myForm->padorder->value

padsizeFilter=myForm->padsizeFilter->value

angOffset0=myForm->padangleOff->value

padInstDepth=myForm->padInstDepth->value

refPointCoorX=myForm->refPointCoorX->value
refPointCoorY=myForm->refPointCoorY->value

padLayer=list(layerName layerPpos)

smpPadExtract( padLayer order angOffset0 padsizeFilter padInstDepth refPointCoorX refPointCoorY)




 )

)




procedure(smpPadExtract(padLayer order angOffset0 filtersize padInstDepth refPointCoorX refPointCoorY)

    let( ( anticlockwise myPinName )

cv=geGetWindowCellView();

cellName  = cv~>cellName;

libName  = cv~>libName;

viewName  = cv~>viewName;

viewName2 = strcat("padExtract"  viewName);

;cv2id=ddGetObj(libName cellName viewName2);

while( ddGetObj(libName cellName viewName2)

;printf("Trying delete unused temp vellview , LIB : %s CELL %s VIEW: %s \n " libName cellName viewName2);

viewName2 = strcat(viewName "New" )

  )

cv2=dbCopyCellView(cv libName cellName viewName2);

;cv2=dbOpenCellViewByType(libName cellName viewName2 "maskLayout" "w" )




; Select the center of cell to compute the angle then to sort clockwise

cv2CenterX=0.5*(leftEdge(cv2~>bBox)+rightEdge(cv2~>bBox));

cv2CenterY=0.5*(topEdge(cv2~>bBox)+bottomEdge(cv2~>bBox));

;angOffset0=15

angOffset=atan2((0-cv2CenterY) (0-cv2CenterX))+angOffset0*3.1415926/360;



; Select All toplevel Text

pins=setof(x cv2~>shapes x~>theLabel)




foreach(inst cv2~>instances

  dbFlattenInst(inst padInstDepth t);

       )

dbSave(cv2)

padsAll=setof(x cv2~>shapes x~>lpp==padLayer)

padsFiltered='nil

foreach(a padsAll

wa=rightEdge(a~>bBox) - leftEdge(a~>bBox)

ha=topEdge(a~>bBox) - bottomEdge(a~>bBox)

if( wa >= filtersize && ha >= filtersize then

padsFiltered=append(padsFiltered list(a))

  )

       )

pads=sort( padsFiltered 

   'lambda( ( a b )

xac=0.5*(leftEdge(a~>bBox)+rightEdge(a~>bBox));

yac=0.5*(topEdge(a~>bBox)+bottomEdge(a~>bBox));

xbc=0.5*(leftEdge(b~>bBox)+rightEdge(b~>bBox));

ybc=0.5*(topEdge(b~>bBox)+bottomEdge(b~>bBox));

angA=atan2((yac-cv2CenterY) (xac-cv2CenterX));

angB=atan2((ybc-cv2CenterY) (xbc-cv2CenterX));

when(angA<angOffset

angA =angA+2*3.14159;

);

when(angB<angOffset 

angB =angB+2*3.14159;

);

if(order=="anticlockwise" then

angA<angB;

else

angA>angB;

)

  )

)
 ;      liujin   create a file to store the pad location, the file name is cellname + _padLoacation
    file=strcat(cv~>cellName "_padLoacation")

    ; open the file to write to
    outf=outfile(file)

    ; fprintf is used to write to a file in specific format
    fprintf(outf "create time: %s\n" getCurrentTime())
    fprintf(outf "%-20s %10s %10s %10s %10s\n" "Name" "centerX" "centerY" "width" "length")

    

printf("Pad Name \t Pad X \t Pad Y \t Pad Openings W x H \n");

foreach( pad pads

xc=0.5*(leftEdge(pad~>bBox)+rightEdge(pad~>bBox)) - refPointCoorX;

yc=0.5*(topEdge(pad~>bBox)+bottomEdge(pad~>bBox)) - refPointCoorY;

wa=rightEdge(pad~>bBox) - leftEdge(pad~>bBox);
ha=topEdge(pad~>bBox) - bottomEdge(pad~>bBox);

;printf("PAD X: %L \t Y : %L \n" xc yc);

angA=atan2((yc-cv2CenterY) (xc-cv2CenterX))

when(angA<angOffset

angA =angA+2*3.14159;

    )

myPinName='nil

foreach(a pins 

coor=a~>xy

coorx=nth(0 coor)

coory=nth(1 coor)

;printf("TextX : %10L TextY : %10L \n" coorx coory)

if( leftEdge(pad~>bBox)<=coorx && coorx<=rightEdge(pad~>bBox) && bottomEdge(pad~>bBox)<=coory && coory<=topEdge(pad~>bBox) then

myPinName=append(myPinName list(a))

)

       )

pinText=myPinName~>theLabel

printf("%L \t %L \t %L \t %L x %L\n" pinText xc yc wa ha);



;liujin change

fprintf(outf "%L \t %L \t %L \t %L x %L\n" pinText xc yc wa ha);

       )

dbClose(cv2);

cv2id=ddGetObj(libName cellName viewName2);

ddDeleteObj(cv2id);

    )


    
    ; close the file
    close(outf)


    ; view the location file
    view(file)

    printf("Please find result: %s\n" file)
  ;;;;;;;;;;;;;;liujin


)

标签:name,坐标,cv2,value,pad,LOCATION,file,PAD,bBox
From: https://www.cnblogs.com/jinzbr/p/18235707

相关文章

  • pads选项设置模板
    目录(1)、常规页1、光标样式2、栅格3、文本译码4、自动备份(2)、设计页(3)、文本&线宽(4)、显示颜色​总所周知,PADS的选项设置多而复杂,每次使用都要重新设置一遍,这就太麻烦了,由此我打算自己给自己设置一个模板,方便以后使用,本文是PADSlogic的选项设置。(1)、常规......
  • WPF datagrid scrolldown and change the marked the location in canvas
    <Windowx:Class="WpfApp134.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft......
  • C++ Builder 2010 绘制坐标
     一、步骤:1.先确定Image的位置,大小(可以不写)          2.设置初始面板,绘制初始的x,y坐标轴          3.画x,y向的刻度线,标刻x,y轴刻度          4.获取数据(可以不写)          5.将数......
  • Nginx的Location匹配与Rewrite重写
    目录一.Nginx中location与rewrite1.Nginx中常用正则表达式2.location与rewrite的联系和区别二.location概述1.分类2.匹配规则3.优先级4.示例三.rewrite概述1.rewrite功能2.rewrite执行顺序3.跳转实现4.语法格式5.示例5.1.基于域名的跳转5.2.基于旧域名跳转到新......
  • Notepad++文件内容对比插件
    遇到一个比较有意思的测试任务,上报日志功能接口路由需要更换V2版本,需要测试对比V1和V2版本上报的数据有没有异常点思路很简单,使用相同的数据遍历调用V1和V2版本的接口路由,取出最后的日志接口对比即可Notepad++插件compare安装插件--插件管理--搜素compare安装即可(安装插件后程......
  • 高德坐标打点(点为正常的WGS84地球坐标系,常见于 GPS 设备,Google 地图等国际标准的坐标
    创建一个js文件工具//WGS84toGCJ-02converter//高德转地球坐标//coordinateUtils.jsconstPI=3.1415926535897932384626;consta=6378245.0;//a:WGS84大地坐标系的长半轴constee=0.00669342162296594323;//ee:WGS84椭球的偏心率平方//WGS84toGC......
  • C# PaddleOCR 单字识别效果
    C#PaddleOCR 单字识别效果效果说明        根据《百度办公文档识别C++离线SDKV1.2用户接入文档.pdf》,使用C++封装DLL,C#调用。背景        为使客户、第三方开发者等能够更快速、方便的接入使用百度办公文档识别SDK、促进百度OCR产品赋能更多客户,......
  • SwiftUI中SafeArea的管理与使用(ignoresSafeArea, safeAreaPadding, safeAreaInset)
    SafeArea是指不与视图控制器提供的导航栏、选项卡栏、工具栏或其他视图重叠的内容空间。在UIKit中,开发人员需要使用safeAreaInsets或safeAreaLayoutGuide来确保视图被放置在界面的可见部分。SwiftUI彻底简化了上述过程,除非开发者明确要求视图突破安全区域的限制,否则SwiftU......
  • PADS VX2.7软件安装教程
    PADSVX2.7软件安装教程首先,下载好馒头破解大师下载到D:\MentorCrackMaster-last\MentorCrackMasterV2_0_1\MentorCrackMasterV2里面然后,把D:\PADSVX2.7\PADSVX.2.7_ESDM\PADSVX.2.7patch里面的文件复制到一个新建的文件夹D:\MentorGraphics里面然后,双击getLicense.ba......
  • 百度地图坐标拾取器
     001、打开地图 002、地图开放平台 003、选开发者频道 004、开发者工具→坐标拾取器 。 ......