找回密码
 注册
查看: 106848|回复: 1313
打印 上一主题 下一主题

[原创SKILL]将CLINE或者LINE转变为SHAPE

    [复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-1-14 10:46 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

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

x
本帖最后由 deargds 于 2010-1-14 12:54 编辑



功能:将CLINE或者LINE转变为相应层面的SHAPE,之前如果有NET属性,也会同时保留。

1. 下载附件后,解压放入PCBENV目录下,在allegro.ilinit文件中添加一句
load("x_cline2shape.il" "www.eda365.com")     ;请注意是否为英文引号及空格。

2.重开ALLEGRO,执行Command>c2s命令调用。


3.直接选择要进行转换的CLINE或者LINE,支持使用TempGroup进行选择。


如果有其它问题及疑问可以回帖反馈。


游客,如果您要查看本帖隐藏内容请回复

点评

:)  发表于 2013-7-21 06:49

评分

参与人数 1贡献 +10 收起 理由
GND + 10 原创内容

查看全部评分

  • TA的每日心情
    慵懒
    2024-11-14 15:27
  • 签到天数: 72 天

    [LV.6]常住居民II

    推荐
    发表于 2022-2-9 12:16
    感谢楼主~ 顺便说下,如果你用的17.2以上版本,官方自带了一个cline2shape的源码。

    在x:\Cadence_SPB_17.2-2016\share\pcb\examples\skill\cmds下,叫cline2shape.il

    但貌似16.6没有。

    如果想用在16.6下,需要把?undo t删掉,16.6不支持撤销。
    1. ;###############################################################################
    2. ;                                                                              #
    3. ;                      Command: cline2shape                                    #
    4. ;                   Skill File: cline2shape.il                                 #
    5. ;               How To Execute: Command> cline2shape                           #
    6. ;                                                                              #
    7. ;  DISCLAIMER:                                                                 #
    8. ;       The user of this command assumes all responsibility and does not       #
    9. ;       hold Cadence Design Systems nor the author of this code for any        #
    10. ;       unwarranted results or problems due to the use of this code.           #
    11. ;                                                                              #
    12. ;       This is non-supported code and the user may modify it as needed.       #
    13. ;                                                                              #
    14. ;###############################################################################

    15. ; demostrates
    16. ;        1) style for an interactive command
    17. ;        2) use of the database tranasction APIs
    18. ;        3) two styles of undo/redo support
    19. ; Added undo support

    20. ;  Know Bug: Sometimes the program will not convert all cline segments but it
    21. ;            will DELETE all segments.  Use at your OWN discretion!
    22. ;            Select Cancel or Undo before exiting the command to restore  
    23. ;            to original Clines.




    24. axlCmdRegister("cline2shape" 'LCB_cline_to_shape ?cmdType "interactive"
    25. ?doneCmd 'LCB_Done ?cancelCmd 'LCB_Cancel ?undo t)
    26. axlCmdRegister("cline2shape2" 'LCB_cline_to_shape2 ?cmdType "interactive"
    27. ?doneCmd 'LCB_Done ?cancelCmd 'LCB_Cancel ?undo t)

    28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    29. ; This shows undo where all of the conversions that this user does while
    30. ; in the command a undone as a single operation.
    31. ;        To convert an existing command to support undo this method is
    32. ;        typically easier.

    33. procedure(LCB_cline_to_shape()
    34. let( (lclines layer polydbid )

    35.   LCB_Setup()

    36.   ; cannot have a global transaction if we want undo to roll back each operation
    37.   LCB_mark = axlDBTransactionStart()

    38.   LCBnotDone = t
    39.   while( LCBnotDone
    40.       lclines = axlGetSelSet(axlSelect(?prompt "Select Clines to convert to a shape."))

    41.       foreach( clinedbid lclines
    42.             layer = clinedbid->layer
    43.             polydbid = axlPolyFromDB(clinedbid ?endCapType "ROUND")

    44.             axlDeleteObject(clinedbid)

    45.             unless( axlDBCreateShape(car(polydbid) t layer)  
    46.                 axlUIWPrint(nil "ERROR: Failed to create Shape from Cline.")
    47.             )
    48.             when( cadr(polydbid)
    49.                 axlDBCreateShape(cadr(polydbid) t layer)
    50.             )
    51.      )

    52.      ; marks are only required if undo is using rolling back all database changes
    53.      ; when command is active. When undoing each conversion this is not needed
    54.      ; nor is Oops functional.
    55.      when(LCB_mark axlDBTransactionMark(LCB_mark))
    56.   )
    57.   LCB_Done() ; just in case
    58. ))

    59. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    60. ; This shows undo where each conversion is supported as seperate undo operation
    61. ; in the command a undone as a single operation.
    62. ;        To convert an existing command to support undo this method is
    63. ;        typically easier.

    64. procedure(LCB_cline_to_shape2()
    65. let( (lclines layer polydbid doMark )

    66.   LCB_Setup()

    67.   ; cannot have a global transaction if we want undo to roll back each operation

    68.   LCBnotDone = t
    69.   doMark = 'undoMark

    70.   while(LCBnotDone
    71.       lclines = axlGetSelSet(axlSelect(?prompt "Select Clines to convert to a shape."))

    72.       ; need to do a start/commit for each operation if we want undo to
    73.       ; rollback each change. This mostly disables Oops
    74.       ;          don't want to start a transaction unless we have work to do or it will
    75.       ;   do a unneeded undoMark.
    76.       when(lclines
    77.           LCB_mark = axlDBTransactionStart(doMark)
    78.       )

    79.       foreach( clinedbid lclines
    80.             layer = clinedbid->layer
    81.             polydbid = axlPolyFromDB(clinedbid ?endCapType "ROUND")

    82.             axlDeleteObject(clinedbid)

    83.             unless( axlDBCreateShape(car(polydbid) t layer)
    84.                 axlUIWPrint(nil "ERROR: Failed to create Shape from Cline.")
    85.             )
    86.             when( cadr(polydbid)
    87.                 axlDBCreateShape(cadr(polydbid) t layer)
    88.             )
    89.      )

    90.      ; marks are only required if undo is using rolling back all database changes
    91.      ; when command is active. When undoing each conversion this is not needed
    92.      ; nor is Oops functional.
    93.      when(LCB_mark axlDBTransactionCommit(LCB_mark))
    94.      LCB_mark = nil
    95.   )
    96.   LCB_Done() ; just in case
    97. ))


    98. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    99. ;; support APIs

    100. procedure(LCB_Setup()
    101. let( (popup)
    102.   axlSetFindFilter(?enabled list("noall" "clines")
    103.                   ?onButtons list("noall" "clines"))

    104.   popup = axlUIPopupDefine( nil (list
    105.     (list "Done" 'LCB_Done)
    106.     (list "Oop" 'LCB_Oops)
    107.     (list "Cancel" 'LCB_Cancel)
    108.      ))

    109.   ; Snapping is not required by this command but this shows the ability
    110.   ; to add the snap sub-menu to the Right Mouse Popup menu
    111.   axlSnapEnableAtRMB()

    112.   axlUIPopupSet(popup)
    113.   LCB_mark = nil
    114. ))

    115. procedure(LCB_Oops()
    116.   when(LCB_mark
    117.     if(! axlDBTransactionOops(LCB_mark) then
    118.       axlUIWPrint(nil "-- Nothing Left To oops. --")
    119.     else
    120.       axlUIWPrint(nil "-- Replacing Clines. --")
    121.     )
    122.   )
    123.   axlClearSelSet()
    124. )

    125. procedure(LCB_Cancel()
    126.   axlUIWPrint(nil "** Cancelled Program. **")
    127.   when( LCB_mark axlDBTransactionRollback(LCB_mark))
    128.   LCB_mark = nil
    129.   LCBnotDone = nil
    130.   axlClearSelSet()
    131.   axlCancelEnterFun()
    132. )


    133. procedure(LCB_Done()
    134.   when( LCB_mark axlDBTransactionCommit(LCB_mark))
    135.   LCB_mark = nil
    136.   LCBnotDone = nil
    137.   axlCancelEnterFun()
    138. )
    复制代码

    点评

    您好,请教一下16.6怎么实现这个功能呢?您这串代码应该放在那儿?需要怎么修改啊?  详情 回复 发表于 2022-7-30 09:18
    请教 官方自带了一个cline2shape的源码。在17.2里要如何使用这个SKILL呢?谢谢~  详情 回复 发表于 2022-6-8 17:50
  • TA的每日心情
    开心
    2020-1-6 15:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    推荐
    发表于 2020-2-22 19:10 | 只看该作者
    本帖最后由 jason_hsu 于 2020-2-24 14:31 编辑

    So simple!

    axlClearSelSet()
    axlSetFindFilter( ?enabled '(noall clines) ?onButtons '(noall clines) )
    axlSingleSelectPoint()
    cline = axlGetSelSet()
    poly = axlPolyFromDB( car(cline) )
    axlDBCreateShape(car(poly) t car(cline)->layer car(cline)->net->name)
    axlDeleteObject(cline)

    点评

    谢谢分享!: 0.0
    谢谢分享!: 0
    很好的学习例子  发表于 2025-1-26 20:35
    是17.2的吗  详情 回复 发表于 2020-8-27 08:46
    这个怎么用  详情 回复 发表于 2020-8-25 10:13

    该用户从未签到

    推荐
    发表于 2010-7-20 11:37 | 只看该作者
    我的不好用啊

    该用户从未签到

    6#
    发表于 2010-1-14 10:50 | 只看该作者

    该用户从未签到

    7#
    发表于 2010-1-14 12:40 | 只看该作者
    LZ好人一个啊

    该用户从未签到

    8#
    发表于 2010-1-14 13:35 | 只看该作者
    发现新东西,赞一个

    该用户从未签到

    9#
    发表于 2010-1-14 18:19 | 只看该作者
    好东西哦!可以画异性孔的FLASH

    该用户从未签到

    10#
    发表于 2010-1-14 19:15 | 只看该作者
    谢谢

    该用户从未签到

    11#
    发表于 2010-1-15 08:56 | 只看该作者
    这个很好。我用的着

    该用户从未签到

    12#
    发表于 2010-1-17 14:43 | 只看该作者
    感谢了,很实用

    该用户从未签到

    13#
    发表于 2010-1-18 14:29 | 只看该作者
    非常感谢LZ

    该用户从未签到

    14#
    发表于 2010-1-18 16:17 | 只看该作者
    多谢分享好资料,

    该用户从未签到

    15#
    发表于 2010-1-18 21:16 | 只看该作者
    感谢
  • TA的每日心情
    开心
    2020-9-15 15:34
  • 签到天数: 10 天

    [LV.3]偶尔看看II

    16#
    发表于 2010-1-19 10:46 | 只看该作者
    thank ~LZ

    该用户从未签到

    17#
    发表于 2010-1-19 13:55 | 只看该作者
    谢谢

    该用户从未签到

    18#
    发表于 2010-1-20 09:00 | 只看该作者
    感谢

    点评

    能分享吗,兄弟  详情 回复 发表于 2024-5-15 17:22

    该用户从未签到

    19#
    发表于 2010-1-20 10:49 | 只看该作者
    看看
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    EDA365公众号

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

    GMT+8, 2025-2-5 09:05 , Processed in 0.093750 second(s), 28 queries , Gzip On.

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

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

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