找回密码
 注册
关于网站域名变更的通知
查看: 1216|回复: 4
打印 上一主题 下一主题

[求助]请问怎么通过axlShell("Create Detail")将text转换成poly

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2016-2-16 09:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
本帖最后由 361553894 于 2016-2-17 13:19 编辑

这里是16.6的代码
  1. procedure( wlTextToPoly16_6(text)
  2.   prog( (lines text flattened tPolys polys)
  3.     lines = axlText2Lines(text)
  4.     flattened = foreach( mapcan x lines x)
  5.     tPolys = nil
  6.     foreach(path flattened
  7.       polys = axlPolyFromDB(path ?endCapType 'ROUND ?line2poly t)
  8.       foreach(poly polys
  9.         if(tPolys then
  10.           tPolys = axlPolyOperation(poly tPolys 'OR)
  11.         else
  12.           tPolys = poly
  13.         )
  14.       )
  15.     )
  16.     return(tPolys)
  17.   )
  18. )

复制代码




这里是低于16.6版本的部分代码
  1. polyList = nil
  2. axlSetFindFilter(?enabled '("all") ?onButtons '("noall" "Text"))
  3. texts = axlGetSelSet(axlAddSelectAll())
  4. axlClearSelSet()
  5. foreach(text texts
  6.   when(member(text->layer textlayer)
  7.     axlShell("Create Detail")
  8.     axlSetFindFilter(?enabled '("all") ?onButtons '("noall" "Text"))
  9.     axlShell(sprintf(nil "Pick %L" car(text->bBox)))
  10.     axlShell(sprintf(nil "Pick %L" cadr(text->bBox)))
  11.     axlShell(sprintf(nil "Pick %L" car(text->bBox)))
  12.     axlSetFindFilter(?enabled '("all") ?onButtons '("noall" "linesegs"))
  13.     lines = axlGetSelSet(axlSingleSelectBox(text->bBox))
  14.     axlClearSelSet()
  15.     print(text->text)
  16.     tPolys = nil
  17.     foreach(line lines
  18.       when(line->layer = "MANUFACTURING/DETAILS"
  19.         poly = axlPolyFromDB(line ?endCapType 'ROUND)
  20.         if(tPolys then
  21.           tPolys = axlPolyOperation(poly tPolys 'OR)
  22.         else
  23.           tPolys = poly
  24.         )
  25.       )
  26.     )
  27.     polyList = append1(polyList tPolys)
  28.   )
  29. )
复制代码
执行的时候发现使用axlShell("Create Detail")指令后,texts储存的textdbid都被removed,各位有什么好方法能解决这个问题么
而且指令的顺序好像有点问题
对上一个文字进行转换后,之前的Create Detail并没有结束
试过axlShell("Done"),会removed dbid
axlShell("Next")和axlFinishEnteRFun(),都没有结束的效果
还有一个放大倍数设置的问题不知道怎么解决




该用户从未签到

2#
发表于 2016-2-16 17:42 | 只看该作者
分享一个绘制TEXT的函数,来源于网络。
  1. defun( _drawText (text, loc, layer, chHgt, chWid, chSpc, lineWid [url=home.php?mod=space&uid=31179]@key[/url] (angle 0), (just "L"), mir, (fontFile "ansifont"), parent)
  2. prog((p, ln, data, widFact, hgtFact, ch, x, y, pts, chPts, minY, maxY, allChPts, textLen, x0, y0, x1, rpath, objs)
  3.   p = axlGetParam(sprintf(nil, "paramTextBlock:%d", axlDBControl('activeTextBlock)))
  4.   when(mir, chWid = chWid * -1, chSpc = chSpc * -1)
  5.   allChPts = list(list(" ", nil))
  6.   p = axlDMOpenFile("VECTORFONT", fontFile, "r"); Looks for the font file in share\pcb\text
  7.   if(p then
  8.     while(gets(ln, p)
  9.       data = linereadstring(ln)
  10.       cond(
  11.         (zerop(car(data)), t)
  12.         (car(data) == 'Width,  widFact = chWid / cadr(data))
  13.         (car(data) == 'Height, hgtFact = chHgt / cadr(data))
  14.         (and(index(ln, "***"), ch = caddr(parseString(ln)), index(text, ch))
  15.           for(i, 1, car(data)
  16.             ln = linereadstring(gets(ln, p)), x = cadr(ln) * widFact, y = caddr(ln) * hgtFact
  17.             if(onep(car(ln)) then when(pts, chPts = append1(chPts, pts)), pts = list(x:y) else pts = append1(pts, x:y))
  18.             minY = if(minY, min(y, minY), y), maxY = if(maxY, max(y, maxY), y)
  19.           )
  20.           allChPts = cons(list(ch, append1(chPts, pts)), allChPts), pts = chPts = nil
  21.         )
  22.       ); cond
  23.     ); while
  24.    else
  25.     return("Font file not found")
  26.   )
  27.   axlDMClose(p)
  28.   textLen = strlen(text) * (chWid + chSpc) - chSpc
  29.   x0 = car(loc), y0 = cadr(loc)
  30.   x1 = case(upperCase(substring(just, 1, 1)), ("L", x0), ("C", x0 - textLen / 2.0), ("R", x0 - textLen))
  31.   foreach(char, parseString(text, "")
  32.     foreach(charPts, cdr(assoc(char, allChPts))
  33.       foreach(pathPts, charPts
  34.         pathPts = mapcar(lambda((pt), axlGeoRotatePt(float(angle), x1 + car(pt):y0 + cadr(pt), loc)), pathPts)
  35.         rpath = axlPathStart(pathPts, lineWid)
  36.         objs = append(objs, car(axlDBCreatePath(rpath, layer, 'line, parent)))
  37.       ); foreach pathPts
  38.     ); foreach charPts
  39.     x1 = x1 + chWid + chSpc
  40.   ); foreach char
  41.   return(objs)
  42. ))
  43. ; The following will draw the text "test" at -30:-30 on ETCH/TOP with a character height 4.0, width 3.0, spacing and line width 0.5 (in the default units)
  44. ;_drawText("test", '(-30 -30), "ETCH/TOP", 4.0, 3.0, 1.0, 0.5)
复制代码



点评

问下,怎么将有线宽的line转换成poly? rpath = axlPathStart(path, linewitdh) axlPolyFromDB(rpath, ?line2poly t)是可以实现,但是只有16.6版本可以使用 其他版本的不支持line2poly这个功能  详情 回复 发表于 2016-2-17 10:41

该用户从未签到

3#
 楼主| 发表于 2016-2-17 10:41 | 只看该作者
deargds 发表于 2016-2-16 17:42
分享一个绘制TEXT的函数,来源于网络。

问下,怎么将有线宽的line转换成poly?
rpath = axlPathStart(path, linewitdh)
axlPolyFromDB(rpath, ?line2poly t)是可以实现,但是只有16.6版本可以使用
其他版本的不支持line2poly这个功能

点评

這裡有源代碼,可以將Clines或Lines轉換為shape https://www.eda365.com/forum.php?mod=viewthread&tid=77989&extra=page%3D4&page=1&&_dsign=59d03e8c  详情 回复 发表于 2016-2-17 11:43

该用户从未签到

4#
发表于 2016-2-17 11:43 | 只看该作者
361553894 发表于 2016-2-17 10:41
问下,怎么将有线宽的line转换成poly?
rpath = axlPathStart(path, linewitdh)
axlPolyFromDB(rpath,  ...

這裡有源代碼,可以將Clines或Lines轉換為shape

https://www.eda365.com/forum.php? ... amp;_dsign=59d03e8c


点评

line转shape是可以,我需要的是path转poly 实际上我的目的是检测文字和其他丝印有没有重叠 不能创建出实体的line或者shape 所以需要将text转成poly,一种方式是用最小方框框住,另一种就是把text转成path,再转成  详情 回复 发表于 2016-2-17 13:18

该用户从未签到

5#
 楼主| 发表于 2016-2-17 13:18 | 只看该作者
XYX365 发表于 2016-2-17 11:43
這裡有源代碼,可以將Clines或Lines轉換為shape

https://www.eda365.com/forum.php?mod=viewthread&tid= ...

line转shape是可以,我需要的是path转poly
实际上我的目的是检测文字和其他丝印有没有重叠
不能创建出实体的line或者shape
所以需要将text转成poly,一种方式是用最小方框框住,另一种就是把text转成path,再转成poly
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-6-24 04:02 , Processed in 0.093750 second(s), 24 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

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