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

更改REF 框选一次只能改一个,有办法框选全改吗?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
 楼主| 发表于 2024-3-13 15:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

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

x
本帖最后由 85654202 于 2024-3-14 08:39 编辑

代码是给辉总写的,后面自己修改了些,目前BUG 是,更改REF 前辍,比如开头为R,改成AR ,框选一次只能改一个,有没有办法选中的全部一次性改?自己能力有限搞不定,求助大神门。
axlCmdRegister( "Auto_Rename-JH" 'JH_Auto_Rename_UI_abc)
procedure(JH_Auto_Rename_UI_abc()
        prog( (Diffform CAPVoidPOP)
                unless(axlOKToProceed() axlShell("done"))        
                Diffform = axlTempFile()
        Difffe = outfile(Diffform "w")
        fprintf(Difffe "FILE_TYPE=FORM_DEFN VERSION=2\n")
               
        fprintf(Difffe "FORM\n")
        fprintf(Difffe "FIXED\n")
        fprintf(Difffe "PORT 34 18\n")
        fprintf(Difffe "HEADER \"Rename Refdes\"\n")
        fprintf(Difffe "TILE\n")   ;tile begin
                fprintf(Difffe "\n")
                fprintf(Difffe "TEXT \"\327\242:\326\273\314\356A\277\362\324\362\311\276\307\260\352\241\243\254\326\273\314\356B\277\362\324\362\274\323\307\260\352\241\241\243 \"\n")        
                fprintf(Difffe "TLOC 1 0\n")
                fprintf(Difffe "ENDTEXT\n\n\n")               
                fprintf(Difffe "\n")
                fprintf(Difffe "TEXT \"Ref\307\260\352\241-\313\242\307\260A: \"\n")        
                fprintf(Difffe "TLOC 5 2\n")
                fprintf(Difffe "ENDTEXT\n\n\n")               

                fprintf(Difffe "\n")
                fprintf(Difffe "TEXT \"Ref\307\260\352\241-\313\242\263\311B: \"\n")        
                fprintf(Difffe "TLOC 5 5\n")
                fprintf(Difffe "ENDTEXT\n\n\n")
               
                fprintf(Difffe "FIELD ref_in\n\n")
        fprintf(Difffe "FLOC 17 2\n")     
        fprintf(Difffe "STRFILLIN 6 5\n");可以输入字母               
        fprintf(Difffe "ENDFIELD\n\n")

                fprintf(Difffe "FIELD ref_out\n\n")
        fprintf(Difffe "FLOC 17 5\n")     
        fprintf(Difffe "STRFILLIN 6 6\n")               
        fprintf(Difffe "ENDFIELD\n\n")
               
                fprintf(Difffe "FIELD \"fix_number\"\n")
                fprintf(Difffe "FLOC %L %L\n" 5 8)    ;   (iTabHeight + 4))
                fprintf(Difffe "CHECKLIST \"  \313\370\266\250\272\363\352\241\"\n")
                fprintf(Difffe "ENDFIELD\n")
                                
                fprintf(Difffe "FIELD modify_refdes\n")
        fprintf(Difffe "FLOC 5 11\n")
        fprintf(Difffe "MENUBUTTON \"\314\364\321\241\313\242\320\264\" 25 4 \n") ;框选增加REF前辍
        fprintf(Difffe "ENDFIELD\n")
               
            fprintf(Difffe "FIELD modify_refdes1\n")
        fprintf(Difffe "FLOC 5 15\n")
        fprintf(Difffe "MENUBUTTON \"\310\253\276\326\313\242\320\264\" 25 4 \n") ;REF增加/删减前辍
        fprintf(Difffe "ENDFIELD\n")
               
        fprintf(Difffe "FIELD exit1\n")
        fprintf(Difffe "FLOC 5 19\n")
        fprintf(Difffe "MENUBUTTON \"\315\313  \263\366\" 25 4\n")
        fprintf(Difffe "ENDFIELD\n")               
         
        fprintf(Difffe "ENDTILE\n")
        fprintf(Difffe "ENDFORM\n")
        close( Difffe)
                LpDiffForm = axlFormCreate((gensym) Diffform '("E" "OUTER") 'JH_DoShapeUI_ABC nil nil)
                when(isFile(Diffform) deleteFile(Diffform))
                LpDiffForm->deleteundoMark = axlDBTransactionStart() ;用于 对操作的 Oops进行标记操作
                axlDBTransactionMark(LpDiffForm->deleteundoMark) ; 标记初始状态
                axlFormSetField(LpDiffForm "ref_in" "R")
                axlFormSetField(LpDiffForm "ref_out" "R")
                axlFormSetField(LpDiffForm "fix_number" t)
                ;JH_compDelete_popmenu_a(LpDiffForm)
                CAPVoidPOP = axlUIPopupDefine( nil (list
                                (list "Done" "axlDBTransactionCommit(LpDiffForm->deleteundoMark), axlDBRefreshId(nil), axlFinishEnterFun(), axlFormClose(LpDiffForm)" )  
                                (list "Undo" "axlDBTransactionOops(LpDiffForm->deleteundoMark), axlDBRefreshId(nil)")
                                (list "Cancel" "axlDBTransactionRollback(LpDiffForm->deleteundoMark), axlDBRefreshId(nil), axlFinishEnterFun(), axlFormClose(LpDiffForm)")
                                ;(list "NextNet" 'netaddr_next)  
                        )
                )
                axlUIPopupSet(CAPVoidPOP)
                a = LpDiffForm ;;debug
                axlFormDisplay(LpDiffForm)
                ;axlFormClose(LpDiffForm)
                ;axlMsgPut("is down")
                axlDBTransactionCommit(LpDiffForm->deleteundoMark)
                axlDBRefreshId(nil)
                axlDBRefreshId(nil)
        )
  )        
procedure( JH_DoShapeUI_ABC(LpDiffForm1)
        prog((isfixnu all_dbid CAPVoidPOP refdes_in refdes_out all_dbid
                )        
                ;axlMsgPut("%L" LpDiffForm->curField)
                isfixnu = axlFormGetField(LpDiffForm "fix_number")
                refdes_in = axlFormGetField(LpDiffForm "ref_in")
                refdes_out = axlFormGetField(LpDiffForm "ref_out")
                axlUIWPrint(LpDiffForm1 "\327\367\325\337: Jhui Xie")        
                unless(axlOKToProceed() axlShell("done"))               
                case(LpDiffForm1->curField
                   ("ref_in"
                                axlFormSetField(LpDiffForm1 "ref_in" upperCase(refdes_in))
                   )
                  
                   ("ref_out"
                                axlFormSetField(LpDiffForm1 "ref_out" upperCase(refdes_out))
                   )
                  
                        ("modify_refdes"
                                CAPVoidPOP = axlUIPopupDefine( nil (list
                                                (list "Done" "axlFinishEnterFun(), axlDBRefreshId(nil)" )  
                                                ;(list "NextNet" 'netaddr_next)  
                                        )
                                )
                                axlUIPopupSet(CAPVoidPOP)
                                axlUIWShow(LpDiffForm1 'hide);显示窗口
                                axlClearSelSet() ;清除板上被选择的对象
                                axlSetFindFilter(?enabled `("Symbols" ) ?onButtons `( "Symbols")) ;设置Find筛选,仅选择 器件
                                while(axlSelect(?prompt "Select Symbols To Change !...")
                                        all_dbid = axlGetSelSet();执行选择操作,并把获取到的器件的 DBID 赋值给变量 symBolsID
                                        ;axlMsgPut("%L" all_dbid) ;;debug
                                        when(JH_refDesChange_del(all_dbid refdes_in refdes_out isfixnu)
                                                axlDBTransactionMark(LpDiffForm1->deleteundoMark)
                                        )
                                )
                                axlUIWShow(LpDiffForm1 'show)
                                ;JH_compDelete_popmenu_a(LpDiffForm)
                        )                        
                        ("modify_refdes1"
                                axlUIWShow(LpDiffForm1 'hide)
                                all_dbid = axlDBGetDesign()~>components~>symbol
                                JH_refDesChange_del(all_dbid refdes_in refdes_out isfixnu)
                                axlDBTransactionMark(LpDiffForm1->deleteundoMark)
                                axlUIWShow(LpDiffForm1 'show)
                                ;JH_compDelete_popmenu_a(LpDiffForm)
                        )
                        ("exit1" || ""
                                ;axlDBTransactionCommit(zsrefChangeForm->deleteundoMark)
                                axlFormClose(LpDiffForm1)
                        )        
                )
                CAPVoidPOP = axlUIPopupDefine( nil (list
                                (list "Done" "axlDBTransactionCommit(LpDiffForm->deleteundoMark), axlDBRefreshId(nil), axlFinishEnterFun(), axlFormClose(LpDiffForm) " )  
                                (list "Undo" "axlDBTransactionOops(LpDiffForm->deleteundoMark), axlDBRefreshId(nil)")
                                (list "Cancel" "axlDBTransactionRollback(LpDiffForm->deleteundoMark), axlDBRefreshId(nil), axlFinishEnterFun(), axlFormClose(LpDiffForm)")
                                ;(list "NextNet" 'netaddr_next)  
                        )
                )
                axlUIPopupSet(CAPVoidPOP)
        )
)
procedure( JH_refDesChange_del(symid_list refo refn @optional (fixnum nil))
        prog((AllsymBolsID symBolsID refChar refCharo symid refdes temp_chr isf refdes_chr
                        new_ref temp_dbid
                        )
                        AllsymBolsID = axlDBGetDesign()~>components~>symbol ;执行选择操作,并把获取到的器件的 DBID 赋值给变量 symBolsID
                        symBolsID = symid_list
                        refChar = upperCase(sprintf(nil "%s" refn))
                        refCharo = upperCase(sprintf(nil "%s" refo))
                        foreach(symid symBolsID
                                refdes = symid~>refdes
                                when(refdes && rexMatchp(strcat("^" refCharo) refdes)
                                       
                                        if(fixnum then
                                                refdes = symid~>refdes
                                                rexCompile("[0-9]+$")
                                                temp_chr = rexReplace(refdes "" 0)
                                                isf = atoi(substring(symid~>refdes (strlen(temp_chr) + 1) (strlen(symid~>refdes) - strlen(temp_chr))))
                                        else
                                                isf = 1
                                        )
                                        refdes = symid~>refdes
                                        rexCompile("[0-9]+$")
                                        refdes_chr = rexReplace(refdes "" 0)
                                        rexCompile(strcat("^" refCharo))
                                        temp_chr = rexReplace(refdes_chr refChar 0)
                                        sprintf(new_ref "%s%d" temp_chr isf)
                                        prog((xx)
                                                while(isf
                                                        new_ref = sprintf(nil "%s%d" temp_chr isf)
                                                        temp_dbid = car(setof(xx AllsymBolsID (xx~>refdes == new_ref)))
                                                        if(temp_dbid then
                                                                        if(temp_dbid != symid then
                                                                        isf = isf + 1
                                                                else
                                                                        new_ref = nil
                                                                        isf = nil
                                                                        return()
                                                                )
                                                        else
                                                                isf = nil
                                                                return()
                                                        )
                                                )
                                        )
                                        if(new_ref        then
                                                axlRenameRefdes(symid~>refdes new_ref)
                                                axlDBRefreshId(symid)
                                                axlHighlightObject(symid)
                                                return(t)
                                        else
                                                return(nil)
                                        )
                                )
                        )
        )
)

9999.png (61.59 KB, 下载次数: 1)

9999.png
  • TA的每日心情
    奋斗
    2025-4-27 15:26
  • 签到天数: 81 天

    [LV.6]常住居民II

    2#
    发表于 2024-3-13 17:16 | 只看该作者
    此帖仅作者可见
  • TA的每日心情
    郁闷
    2023-12-8 15:08
  • 签到天数: 1 天

    [LV.1]初来乍到

    3#
    发表于 2024-3-13 17:25 | 只看该作者
    此帖仅作者可见
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-5-25 16:34 , Processed in 0.093750 second(s), 27 queries , Gzip On.

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

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

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