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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 4828|回复: 9

[求助] skill错误问题

[复制链接]
发表于 2020-6-10 15:52:52 | 显示全部楼层 |阅读模式
300资产
运行下面skill脚本时 提示错误ERROR PLUS : can't handle (nil + 0.001)
脚本作用:解决版图不在格点问题
procedure( putOnGrid()
   let((gridField putOnGridForm)
hiCreateForm('putOnGridForm "Put On Grid Form"
        "putOnGridCB(putOnGridForm->gridField->value)"
        list(hiCreateStringField( ?name 'gridField
      ?prompt "Enter Grid value"
      ?value "0.1"
             )
        )
        ""
)
hiDisplayForm(putOnGridForm)
   )
)

procedure(putOnGridCB(grid)
    prog( (compFactor cv saveLayer theta p obj path loc error_cmd units rep)
if(!(rep = geGetEditRep()) then
     hiDisplayModelessDBox('formHandle "Put On Grid"
      "A cellView must be opened."
      "" "")
     return()
)
if( geGetSelSet() == nil then
     hiDisplayModelessDBox('formHandle "Put On Grid"
      "Nothing has been selected \n
       Program works on only selected objects"
      "" "")
     return()
)
compFactor = 1 / rep~>DBUPerUU
units = rep~>userUnits
if(!compFactor  then
     hiDisplayModelessDBox('formHandle "Put On Grid"
                                  "The CellView does not have the DBUPerUU property defined"
                                   
                                  "" "")
     return()
)

grids = parseString(grid)
xgrid = evalstring(nth(0 grids))
if(! numberp(xgrid) then
     printf("Grid must be a number.\n")
     return()
)
if(! (ygrid = nth(1 grids)) then
     ygrid = xgrid
else
     ygrid = evalstring(ygrid)
     if(! numberp(ygrid) then
         printf("Grid must be a number.\n")
         ygrid = xgrid
     )
)
printf("Snapping x-coordinates to nearest %f %s.\n" float(xgrid) units)
printf("Snapping y-coordinates to nearest %f %s.\n" float(ygrid) units)

cv = geGetEditRep()

foreach( obj geGetSelSet()
     case( obj~>shape
  (("rectangle" "dot")
      path = obj~>bBox
      path = list( lowerLeft(path)
   list(xCoord(upperRight(path)) yCoord(lowerLeft(path)))
   upperRight(path)
   list(xCoord(lowerLeft(path)) yCoord(upperRight(path))))
  )
  (("polygon" "path" "line")
      path = obj~>path
  )
  ("label"
      path = list(roundCoord(obj~>xy xgrid ygrid))
  )
  (t
      sprintf(error_cmd "Cannot handle \"%s\" object types."
       obj~>objType)
                 hiDisplayModelessDBox('formHandle "Put On Grid"
                                  error_cmd
                                  "" "")
                 return()
  )
     )

     newpath=nil
     foreach( pt path
  newpath=cons(roundCoord(pt xgrid ygrid) newpath)
     )
     path=newpath
     case( obj~>shape
  (("rectangle" "polygon" "dot")
     geSelectObject(dbCreatePolygon(cv obj~>lpp path))
     dbDeleteObject(obj)
  )
  ("line"
    geSelectObject(dbCreateLine(cv obj~>lpp path))
    dbDeleteObject(obj)
  )
  ("path"
    geSelectObject(dbCreatePath(cv obj~>lpp path obj~>width))
    dbDeleteObject(obj)
  )
  ("label"
    geSelectObject(dbCreateLabel(cv obj~>lpp obj~>xy
     obj~>theLabel obj~>justify obj~>orient
     obj~>font obj~>height
     )
    )
    dbDeleteObject(obj)
  )
  (t
    error("Put On Grid: Encountered unknown shape")
    return()
  )
     )
)
    )
)

procedure( roundCoord( point xgrid ygrid )
    prog( (x y)
x=round((xCoord(point) + compFactor) / xgrid) * xgrid
y=round((yCoord(point) + compFactor) / ygrid) * ygrid
return(list( x y ))
    )
)
hiSetBindKey("layout" "<Key>BackSpace" "putOnGrid()")

发表于 2020-6-10 20:55:25 | 显示全部楼层
这个脚本我跑了一下,除了热键定义的不工作之外,其他的功能没问题啊。

还有一个小问题是pathSeg这种图形类型不支持。
发表于 2020-6-10 20:59:19 | 显示全部楼层
附件显示, 没啥问题

菜单

菜单
Capture2.PNG
 楼主| 发表于 2020-6-11 19:01:38 | 显示全部楼层


amodaman 发表于 2020-6-10 20:59
附件显示, 没啥问题


脑壳痛,我这就报错,很烦。
发表于 2020-6-11 19:17:40 | 显示全部楼层
你是怎么运行的?

1)确保当前窗口是一个layout view的窗口吗?
2)是否有写权限?
3)硬盘空间是否还有剩余?
4)版图上是不是有图形?
5)有没有选择一个图形(Selection Set是否为空)?
6)techFile 属性是不是正确附加在库上面了?
发表于 2020-6-28 20:11:58 | 显示全部楼层
会不会你的版图格点设置最小不是0.001,比如是0.005。
发表于 2020-7-1 16:21:45 | 显示全部楼层
快捷键那里“layout"应该是大写”Layout"吧?
发表于 2020-7-8 10:09:24 | 显示全部楼层
在你的环境里 roundCoord( point  这个函数调用时有个point为nil。你自己看看哪个调用roundCoord时point没有弄对
发表于 2023-8-25 11:06:04 | 显示全部楼层
代码升级一下,是不是可以检查全图呢,现在好像只能检查线在不在格点上
发表于 2023-9-15 11:38:53 | 显示全部楼层
这应该试工艺不一样的原因
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-5-22 06:43 , Processed in 0.031024 second(s), 7 queries , Gzip On, Redis On.

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