Cadence Skill 论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 104|回复: 6

[求助] 谁有90度检查的源码

[复制链接]
发表于 2025-4-29 09:51:06 | 显示全部楼层 |阅读模式
谁有90度检查的源码
发表于 2025-5-6 14:56:17 | 显示全部楼层

回帖奖励 +10 SKILL币

我也很关心
发表于 7 天前 | 显示全部楼层
  1. ;余弦函数求角度,再反余弦求度数
  2. degree = axlRadToDeg(acos((LenA*LenA+LenB*LenB-LenC*LenC)/(2*LenA*LenB)))
复制代码

评分

参与人数 1SKILL币 +10 收起 理由
xieeyawen + 10

查看全部评分

 楼主| 发表于 4 天前 | 显示全部楼层

原来如此,感谢大佬解惑
 楼主| 发表于 昨天 16:40 | 显示全部楼层
本帖最后由 xieeyawen 于 2025-5-15 17:16 编辑
  1. axlCmdRegister("cedg9" 'check_etch_degree90 ?cmdType "interactive")
  2. procedure(check_etch_degree90()
  3. let((
  4.     l_clines
  5.     log_file
  6.     fileport
  7.     clines
  8.     a
  9.     x1 x2 y1 y2
  10.     lista
  11.     slop
  12.     s0 e0
  13.     temp_b
  14.     temp_e
  15.                 )
  16.                 axlSetFindFilter(?enabled '(noall clinesegs) ?onButtons        '(noall clinesegs))
  17.                 l_clines=axlGetSelSet(axlAddSelectAll())
  18.                 ;l_clines=axlGetSelSet(axlSingleSelectBox())
  19.                 axlClearSelSet()
  20.                 log_file = "./check_etch_degree.log"
  21.                 fileport = outfile(log_file)   ;打开端口,新建log_file文件
  22.                 temp_e=nil
  23.                
  24.                 temp_b=0
  25.                 foreach(clines l_clines
  26.                        a=clines->startEnd
  27.                        x1=caar(a)
  28.                        y1=cadar(a)
  29.                        x2=caadr(a)
  30.                        y2=cadadr(a) ;x1,y1,x2,y2为线的起点和终点坐标
  31.                        s0=car(a) ;线的起点坐标
  32.                        e0=cadr(a);线的终点坐标
  33.                        slop=axlLineSlope(clines->startEnd)        ;斜率          
  34.                        if(slop
  35.                                then
  36.              a = axlRadToDeg(atan(axlLineSlope(clines->startEnd))) ;获得每根线的角度值,以竖线为90度,倾斜到左边的线角度为-90到0度之间,倾斜到右边的线角度为0到90度之间,没有-90度这个值
  37.                                else
  38.                                 a = 90.00 ;斜率为nil就是90度
  39.                                        );endif
  40.                        lista=nil
  41.                        lista=append1(lista ((x1+x2)/2))
  42.                        lista=append1(lista ((y1+y2)/2)) ;线的中间左边
  43.                        if(s0 == temp_e ;线的起点和前一段线的终点一致,则进行角度比较
  44.                                then
  45.                                cond(

  46.                                ((a>0 && temp_b>=0) && ((a-temp_b)<=90.00) && ((a-temp_b)>0.00)
  47.                                        fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" a-temp_b lista clines~>net~>name) ;输出当前线和前一段线的夹角值,输出当前线的网络名及坐标
  48.                                        axlHighlightObject(clines))        ;高亮当前线
  49.                                ((a>=0 && temp_b>0) && ((temp_b-a)<=90.00) && ((temp_b-a)>0.00)
  50.                                        fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" temp_b-a lista clines~>net~>name)
  51.                                        axlHighlightObject(clines))                                      
  52.                                ((a>=0 && temp_b<=0) && ((180.00-a+temp_b)<=90.00) && ((180.00-a+temp_b)>0.00)
  53.                                        fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" 180.00-a+temp_b lista clines~>net~>name)
  54.                                        axlHighlightObject(clines))                                              
  55.                                ((a>0 && temp_b<=0) && ((a-temp_b)<=90.00) && ((a-temp_b)>0.00)
  56.                                        fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" a-temp_b lista clines~>net~>name)
  57.                                        axlHighlightObject(clines))
  58.                                ((a<0 && temp_b<=0) && ((temp_b-a)<=90.00) && ((temp_b-a)>0.00)
  59.                                        fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" temp_b-a lista clines~>net~>name)
  60.                                        axlHighlightObject(clines))                                                                                     
  61.                                ((a<=0 && temp_b<0) && ((a-temp_b)<=90.00) && ((a-temp_b)>0.00)
  62.                                        fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" a-temp_b lista clines~>net~>name)
  63.                                        axlHighlightObject(clines))                                              
  64.                                       

  65.                                                                                                                                        
  66.                                        );endcond
  67.                                        );endif
  68.                               
  69.                                temp_b=a ;保存当前线的角度,用于下次的比较
  70.                                temp_e=e0 ;保存当前线的终点坐标,用于下次的比较
  71.                                );endforeach                     
  72.                   close(fileport)
  73.                         axlUIViewFileCreate(log_file "check_etch_degree.log" nil)
  74.                         deleteFile(fileport)
  75.         );endlet
  76.         );procedure


复制代码


 楼主| 发表于 昨天 17:17 | 显示全部楼层

看楼下我贴了代码,但是可能功能不是特别好,代码水平有限。
 楼主| 发表于 昨天 17:18 | 显示全部楼层

还是不会的,不过我自己在楼下写了一个,你看下有没有好办法优化,有些找不出来,另外有些45度的报出来,但是其实是没问题的
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|手机版|网站地图|Cadence Skill 论坛 ( 蜀ICP备13024417号 )

GMT+8, 2025-5-16 09:19 , Processed in 0.127971 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表