Cadence Skill 论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 15659|回复: 19

将铜皮边框变为line源码分享

[复制链接]
发表于 2013-4-14 21:36:48 | 显示全部楼层 |阅读模式
  1. /****************************************************************/
  2. /*                 Command: ch_shape_to_line                    */
  3. /*                  Author: VivienLuo                           */
  4. /*                   Email: admin@allegro-skill.com             */
  5. /*           Creation Date: 2013-02-21                          */
  6. /*             Description: This Skill Function used to change  */
  7. /*                          the shape to line.                  */
  8. /****************************************************************/

  9. axlCmdRegister("ch_shape_to_line" 'ch_shape_to_line ?cmdType "interactive"
  10.                                  ?doneCmd 'shape2linedone ?cancelCmd 'shape2linecancel) ;registe command

  11. procedure(ch_shape_to_line()
  12. prog((selShape linePath lineLayer temp notdone )
  13.         shape2linepopup = axlUIPopupDefine(nil (list
  14.                                                 (list "Done" 'shape2linedone )
  15.                                                 (list "Cancel" 'shape2linecancel ))
  16.                                                 )
  17.         axlUIPopupSet(shape2linepopup)
  18.         notdone = t
  19.         axlUIWPrint(nil "------ Change Shape to Line V1.0 ---- Written By VivienLuo  ------")
  20.         axlUIWPrint(nil "------ E-mail : admin@allegro-skill.com ------ February 21, 2013 ------")
  21.         axlSetFindFilter(?enabled list("noall" "shapes") ?onButtons list("noall" "shapes"))
  22.         shape2lineMark = axlDBTransactionStart()

  23.         while(notdone
  24.                 axlClearSelSet()
  25.                 selShape = nil
  26.                 axlSingleSelectPoint()
  27.                 when(axlGetSelSet() != nil
  28.                 selShape = car(axlGetSelSet())
  29.                 linePath = axlPathStart(list(car(car(selShape->segments)->startEnd)))
  30.                 lineLayer = selShape->layer ;Gets Shape's Layer
  31.                 foreach(temp selShape->segments
  32.                                 case(temp->objType
  33.                                         ("line"
  34.                                                 axlPathLine(linePath nil cadr(temp->startEnd))
  35.                                                 )
  36.                                         ("arc"
  37.                                                 axlPathArcCenter(linePath nil cadr(temp->startEnd) temp->isClockwise temp->xy)
  38.                                                 )
  39.                                         (t
  40.                                                 printf("Path Type is Unknown!\n")
  41.                                                 )
  42.                                 );end case                        
  43.                 )        
  44.                 axlHighlightObject(car(axlDBCreatePath(linePath lineLayer 'line)))
  45.                 axlDeleteObject(selShape)
  46.                 axlUIWPrint(nil "- Change Shape To Line Success! -")
  47.                 );end when
  48.         );end while
  49. )
  50. );end procedure

  51. procedure(shape2linedone()
  52.                 notdone = nil
  53.                 axlDBTransactionCommit(shape2lineMark)
  54.                 axlFinishEnterFun()
  55.                 axlUIWPrint(nil "- Done -")
  56. )
  57. procedure(shape2linecancel()
  58.                 notdone = nil
  59.                 axlDBTransactionRollback(shape2lineMark)
  60.                 axlCancelEnterFun()
  61.                 axlUIWPrint(nil "- Cancel -")
  62. )
复制代码
发表于 2013-5-15 23:28:42 | 显示全部楼层
我认为铜皮边框可以用z-copy的方式将其生成outline的边框,然后删除铜皮,最后打散outline到需要的line层,也可达到效果。
 楼主| 发表于 2013-5-15 23:35:59 | 显示全部楼层
chuankay 发表于 2013-5-15 23:28
我认为铜皮边框可以用z-copy的方式将其生成outline的边框,然后删除铜皮,最后打散outline到需要的line层, ...

呵呵,这样只是寻求一个快捷方式。
发表于 2013-5-15 23:37:56 | 显示全部楼层
代码收藏了  谢谢
 楼主| 发表于 2013-5-15 23:40:05 | 显示全部楼层
chuankay 发表于 2013-5-15 23:37
代码收藏了  谢谢

这个还有更简便的方式。可使用axlPolyFromDB函数直接获取shape边框。。。
发表于 2013-5-16 12:25:09 | 显示全部楼层
vivienluo 发表于 2013-5-15 23:40
这个还有更简便的方式。可使用axlPolyFromDB函数直接获取shape边框。。。

看来您对database cteate那一篇很熟悉,我也要补习了
发表于 2013-7-5 08:17:54 | 显示全部楼层
将铜皮变为line的功能,请问有哪些应用场景?outline一般都由结构给出的外形线来的,与铜皮有关系吗?
发表于 2014-7-5 00:16:37 | 显示全部楼层
不知楼主有没有可以让铜皮与线之间互相转换的SKILL供大家学习,谢谢
发表于 2014-7-31 15:08:22 | 显示全部楼层
Shape菜单里的Decompose Shape命令就可以实现这个功能啊
 楼主| 发表于 2014-7-31 17:08:31 | 显示全部楼层
chuchiwolong 发表于 2014-7-31 15:08
Shape菜单里的Decompose Shape命令就可以实现这个功能啊

Decompose Shape边的line在另外一层,二且是有一小段组成的。操作不方便。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-5-2 05:18 , Processed in 0.147842 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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