在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
楼主: damonzhao

[求助] 如何获取一个layer shape的所有corner点坐标并计算该shape面积?求skill脚本

[复制链接]
发表于 2013-4-30 20:37:40 | 显示全部楼层
回复 10# damonzhao

实在是看不下去了,贴上一个大神多年前写的脚本。

    /*
Synopsis    :   JW_Area()
Version     :   1.0
Create Date :   2006-03-28
Author      :   Justin Wang
E-Mail      :   justin727@gmail.com
*/
;hiSetBindKey("Layout" "<Key>3" "JW_Area()")
procedure(JW_Area()
   prog((cvId selObj area number shape Box points point1 point2 length width )
cvId = getEditRep(hiGetCurrentWindow())
selObj = geGetSelSet(cvId)
number = length(selObj)
if(zerop(number) then
  JWMessage("Error!!" 'Close "Please select a layer." )
  return()
)
geDeselectAll(hiGetCurrentWindow())
foreach(shape selObj
  area = 0
  case( shape~>objType
   ("rect"
    Box = shape~>bBox
    area = (car(cadr(Box)) - car(car(Box))) * (cadr(cadr(Box)) - cadr(car(Box)))
   )
   ("polygon"
    number = length(shape~>points)
    points = shape~>points
    points = append(points list(car(points)))
    while(!zerop(number)
     point1 = car(points)
     points = cdr(points)
     point2  = car(points)
     area = area + ( car(point1) * cadr(point2) )
     area = area - ( car(point2) * cadr(point1) )
     number--
    );while
    area = abs(area/2)
   )
   ("path"
    number = shape~>nPoints
    points = shape~>path
    width = shape~>width
    while(!zerop(number-1)
     point1 = car(points)
     points = cdr(points)
     point2 = car(points)
     if(equal(car(point1) car(point2))
      length = abs(cadr(point1) - cadr(point2))
      length = abs( car(point1) -  car(point2))
     );if
     area = area + length * width
     number--
    );while
    case(shape~>pathStyle
       ("extendExtend" area = area + width*width )
       ("varExtendExtend" area = area + (shape~>beginExt+shape~>endExt)*width )
       ("roundRound" area = area +  4/9.0 * width * width ) ;(w/3^2) * 4
       (t    );truncateExtend
    );case
   )
   (t
    area = 0.0
   )
  );case
  
  geSelectObject(shape)
  if(zerop(area) then
   JWMessage("Error!!" 'Close "This is not a layer.")
   sprintf(area "Area = unknown")
  else
   sprintf(area "Area = %f" area)
  )
  JWMessage("Layer Area" 'Close area)
  geDeselectFig(shape)
);foreach
   );prog
);procedure
;-------------------------------------------------------
procedure(JWMessage(title button message)
    prog( ()
hiDisplayAppDBox(
  ?name  'JWDBox
  ?dboxBanner title
  ?buttonLayout button
  ?dboxText message
)
    );prog
);procedure
 楼主| 发表于 2013-5-2 11:42:12 | 显示全部楼层
回复 11# xuhongwei_li


   多谢啦!
发表于 2013-11-27 09:08:37 | 显示全部楼层
贴上看看,希望有用
发表于 2015-8-20 16:29:25 | 显示全部楼层
回复 11# xuhongwei_li


   感谢无私的分享
发表于 2016-5-5 14:11:03 | 显示全部楼层
回复 10# damonzhao


    请问你是已经成功获得计算多边形面积的SKILL脚本了吗?可以分享一下吗?
 楼主| 发表于 2016-5-5 15:19:59 | 显示全部楼层
回复 15# YEZI_1996

IC616里自带这个功能,放心用吧
发表于 2016-5-5 17:28:09 | 显示全部楼层
回复 16# damonzhao

你好,可以具体一点在自带的功能在哪里吗?表示找不到,或者有IC616的使用文档也可以分享一下的,谢谢
发表于 2016-5-20 15:20:21 | 显示全部楼层
谢谢分享!
发表于 2019-12-11 14:33:09 | 显示全部楼层


YEZI_1996 发表于 2016-5-5 17:28
回复 16# damonzhao

你好,可以具体一点在自带的功能在哪里吗?表示找不到,或者有IC616的使用文档也可以 ...


tools->Area and Density ...
发表于 2019-12-13 10:44:48 | 显示全部楼层
我挺好奇  知道Corner点那怎么算面积呢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-22 23:39 , Processed in 0.026458 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表