wnhai 发表于 2016-8-29 11:34:41

检查器件名称方向的skill源码



axlCmdRegister( "Check_Dir" 'Check_Refdes_Direction)

defun( Check_Refdes_Direction ()

      axlVisibleDesign(nil)
        axlVisibleLayer( "BOARD GEOMETRY/OUTLINE" t )
        axlVisibleLayer( "PIN/TOP" t )
        axlVisibleLayer( "PIN/BOTTOM" t )
        axlVisibleLayer( "REF DES/SILKSCREEN_TOP" t )
        axlVisibleLayer( "REF DES/SILKSCREEN_BOTTOM" t )
        axlVisibleLayer( "PACKAGE GEOMETRY/SILKSCREEN_TOP" t )
        axlVisibleLayer( "PACKAGE GEOMETRY/SILKSCREEN_BOTTOM" t )

        logfile = axlDMOpenLog("dir_error.log")
        fprintf(logfile "#Check the direction errores of refdes . \n\n")
        fprintf(logfile "REF_DESCOORDIRATION\n")
       
        setq(allsym axlDBGetDesign()->symbols)
        axlDehighlightObject(allsym)
        dir = nil       
        dircnt = 0
;        noref = nil
;        norefcnt = 0
        foreach(symbol allsym         ;n=0 ++n symbol=nthelem(n allsym)
                text= axlDBGetAttachedText(symbol)
                txt = nil
                foreach(find text
                        if(find->layer == "REF DES/SILKSCREEN_TOP" ||
                        find->layer == "REF DES/SILKSCREEN_BOTTOM" then                                                                        
                                txt = find                       
                        )                                                               
                )
/*                if(txt == nil && symbol->refdes != nil then
                        axlHighlightObject(symbol)
                        noref = cons(symbol->refdes noref)
                        ++norefcnt
                )
*/                if(txt != nil && txt->text != nil then
                        axlMsgPut("Processing package : %s " txt->text)      
                        if(txt->layer == "REF DES/SILKSCREEN_TOP" then
                                if(abs(txt->rotation - 0.0) < 5.0 || abs(txt->rotation - 90.0) < 5.0 ||
                                abs(txt->rotation - 360.0) < 5.0 then
                                x = 0
                                else
                                        axlHighlightObject(symbol)
                                        ;dir = cons(symbol->refdes dir)
                                        fprintf(logfile "%-8s %L\n" txt->text symbol->xy)
                                        ++dircnt
                                )
                        else if(txt->layer == "REF DES/SILKSCREEN_BOTTOM" then
                                if(abs(txt->rotation - 0.0) < 5.0 || abs(txt->rotation - 90.0) < 5.0 ||
                                abs(txt->rotation - 360.0) < 5.0 then
                                x = 0
                                else
                                        axlHighlightObject(symbol)
                                        ;dir = cons(symbol->refdes dir)
                                        fprintf(logfile "%-8s %L\n" txt->text symbol->xy)
                                        ++dircnt
                                )
                                )                       
                        )
                        if(txt->isMirrored == t then
                                if(txt->parent->isMirrored != t then                               
                                        axlHighlightObject(symbol)
                                        ;dir = cons(symbol->refdes dir)
                                        fprintf(logfile "%-8s %L\n" txt->text symbol->xy)
                                        ++dircnt
                                )
                        else
                                if(txt->parent->isMirrored == t then
                                        axlHighlightObject(symbol)
                                        ;dir = cons(symbol->refdes dir)
                                        fprintf(logfile "%-8s %L\n" txt->text symbol->xy)
                                        ++dircnt                       
                                )                               
                        )
                );if_end
               
        );foreach-end

        fprintf(logfile "\nTotal direction error of refdes: %d\n" dircnt)
        axlDMClose(logfile)
       
        axlMsgPut("Total direction error of refdes: %d\n" dircnt)      
        axlMsgPut("Refdes direction error , please view logfile.")
;        axlMsgPut("Total of components without refdes is : %d %L .\nDone" norefcnt noref)      
);defun_end

2209915744 发表于 2016-8-31 14:29:54

我有这个skill 哈哈

2209915744 发表于 2016-8-31 14:29:59

我有这个skill 哈哈

2209915744 发表于 2016-8-31 14:30:01

我有这个skill 哈哈

seven 发表于 2016-9-1 13:29:01

怎么检查啊?

seven 发表于 2016-9-1 13:29:57

大师学习了

yes 发表于 2016-9-5 17:03:57

我有这个skill 哈哈

hurry 发表于 2016-9-8 15:07:14

谢谢

ssmagic 发表于 2016-10-28 15:15:46

感谢分享,学习了:lol

王开鑫55 发表于 2016-11-8 15:15:42

看不太明白,有解释语句就好了
页: [1] 2
查看完整版本: 检查器件名称方向的skill源码