|
本帖最后由 xieeyawen 于 2025-5-15 17:16 编辑
- axlCmdRegister("cedg9" 'check_etch_degree90 ?cmdType "interactive")
- procedure(check_etch_degree90()
- let((
- l_clines
- log_file
- fileport
- clines
- a
- x1 x2 y1 y2
- lista
- slop
- s0 e0
- temp_b
- temp_e
- )
- axlSetFindFilter(?enabled '(noall clinesegs) ?onButtons '(noall clinesegs))
- l_clines=axlGetSelSet(axlAddSelectAll())
- ;l_clines=axlGetSelSet(axlSingleSelectBox())
- axlClearSelSet()
- log_file = "./check_etch_degree.log"
- fileport = outfile(log_file) ;打开端口,新建log_file文件
- temp_e=nil
-
- temp_b=0
- foreach(clines l_clines
- a=clines->startEnd
- x1=caar(a)
- y1=cadar(a)
- x2=caadr(a)
- y2=cadadr(a) ;x1,y1,x2,y2为线的起点和终点坐标
- s0=car(a) ;线的起点坐标
- e0=cadr(a);线的终点坐标
- slop=axlLineSlope(clines->startEnd) ;斜率
- if(slop
- then
- a = axlRadToDeg(atan(axlLineSlope(clines->startEnd))) ;获得每根线的角度值,以竖线为90度,倾斜到左边的线角度为-90到0度之间,倾斜到右边的线角度为0到90度之间,没有-90度这个值
- else
- a = 90.00 ;斜率为nil就是90度
- );endif
- lista=nil
- lista=append1(lista ((x1+x2)/2))
- lista=append1(lista ((y1+y2)/2)) ;线的中间左边
- if(s0 == temp_e ;线的起点和前一段线的终点一致,则进行角度比较
- then
- cond(
- ((a>0 && temp_b>=0) && ((a-temp_b)<=90.00) && ((a-temp_b)>0.00)
- fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" a-temp_b lista clines~>net~>name) ;输出当前线和前一段线的夹角值,输出当前线的网络名及坐标
- axlHighlightObject(clines)) ;高亮当前线
- ((a>=0 && temp_b>0) && ((temp_b-a)<=90.00) && ((temp_b-a)>0.00)
- fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" temp_b-a lista clines~>net~>name)
- axlHighlightObject(clines))
- ((a>=0 && temp_b<=0) && ((180.00-a+temp_b)<=90.00) && ((180.00-a+temp_b)>0.00)
- fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" 180.00-a+temp_b lista clines~>net~>name)
- axlHighlightObject(clines))
- ((a>0 && temp_b<=0) && ((a-temp_b)<=90.00) && ((a-temp_b)>0.00)
- fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" a-temp_b lista clines~>net~>name)
- axlHighlightObject(clines))
- ((a<0 && temp_b<=0) && ((temp_b-a)<=90.00) && ((temp_b-a)>0.00)
- fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" temp_b-a lista clines~>net~>name)
- axlHighlightObject(clines))
- ((a<=0 && temp_b<0) && ((a-temp_b)<=90.00) && ((a-temp_b)>0.00)
- fprintf(fileport "Degree : %.2f\t\t%L\t\t%s\n" a-temp_b lista clines~>net~>name)
- axlHighlightObject(clines))
-
-
- );endcond
- );endif
-
- temp_b=a ;保存当前线的角度,用于下次的比较
- temp_e=e0 ;保存当前线的终点坐标,用于下次的比较
- );endforeach
- close(fileport)
- axlUIViewFileCreate(log_file "check_etch_degree.log" nil)
- deleteFile(fileport)
- );endlet
- );procedure
复制代码
|
|