有人能帮我合并一下在PCB上直接增加REF 的代码吗?附件为原代码
本帖最后由 85654202 于 2020-3-23 09:04 编辑大家好
有人能帮我合并一下在PCB上直接增加REF 的代码吗?附件为原代码, 我对SKILL 不是很专业,合并了很多次,都是不成功,求大神帮改一下。
功能目的;在PCB上直接增加REF(因为PCB 从别的软件上转过来,定义的层不一样,所以没有REF)
运行SKILL 先亮亮没有REF 的器件,然后对没有REF 的器件直接在PCB上增加ERF
在PCB 上高亮无REF 的器件代码:
axlCmdRegister( "Check_No_Refdes" 'Check_No_Refdes)
defun( Check_No_Refdes ()
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("no_refdes.log")
fprintf(logfile "#Check the component without refdes . \n\n")
fprintf(logfile "REF_DESCOORDIRATION\n")
setq(allsym axlDBGetDesign()->symbols)
axlDehighlightObject(allsym)
noref = nil
norefcnt = 0
foreach(symbol 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)
fprintf(logfile "%-8s %L\n" symbol->refdes symbol->xy)
;noref = cons(symbol->refdes noref)
++norefcnt
)
);foreach-end
fprintf(logfile "\nTotal of no refdes: %d\n" norefcnt)
axlDMClose(logfile)
axlMsgPut("Total component without refdes: %d\n" norefcnt)
axlMsgPut("Components without refdes , please view logfile.")
);defun_end
在PCB 上增加REF 的代码:
if(car(n0->violations)->isMirrored then
layer = "BOTTOM"
else
layer = "TOP"
)
textstru = make_axlTextOrientation(?textBlock 1 ?mirrored car(n0->violations)->isMirrored ?justify "center")
tt = setof(x0 axlDBGetAttachedText(car(n0->violations)) rexMatchp("REF DES/SILKSCREEN_+" x0->layer))
unless(tt
axlDBCreateText(car(n0->violations)->refdes car(n0->violations)->xy textstru strcat("REF DES/SILKSCREEN_" layer) car(n0->violations))
)
tt = setof(x0 axlDBGetAttachedText(car(n0->violations)) rexMatchp("REF DES/ASSEMBLY_+" x0->layer))
unless(tt
axlDBCreateText(car(n0->violations)->refdes car(n0->violations)->xy textstru strcat("REF DES/ASSEMBLY_" layer) car(n0->violations))
)
谢谢 大家帮我合并一下。
;############################################################
;Description
;Project name:AddRef
;Version: 1.0
;Release date:2020.03.25
;Designer: Ken Wang
;Mail: 6771877@qq.com
;
;----------------------------------------
;Version record:
;
;V1.0
;Original version
;----------------------------------------
;EndDes
;############################################################
;############################################################
;Command
axlCmdRegister( "spm add ref" 'SPM_AddRef)
;EndCom
;############################################################
;############################################################
(defun SPM_AddRef ()
"Add ref"
;**************************************************
;Declare and initialize local variables
let((norefcnt noref txt)
;**************************************************
;==================================================
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("no_refdes.log")
fprintf(logfile "#Check the component without refdes . \n\n")
fprintf(logfile "REF_DESCOORDIRATION\n")
setq(allsym axlDBGetDesign()->symbols)
axlDehighlightObject(allsym)
noref = nil
norefcnt = 0
foreach(symbol allsym
textstru = make_axlTextOrientation(?textBlock 1 ?mirrored symbol->isMirrored ?justify "center")
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(symbol->isMirrored then
layer = "BOTTOM"
else
layer = "TOP"
)
if(txt == nil && symbol->refdes != nil then
axlHighlightObject(symbol)
axlDBCreateText(symbol->refdes symbol->xy textstru strcat("REF DES/SILKSCREEN_" layer) symbol)
fprintf(logfile "%-8s %L\n" symbol->refdes symbol->xy)
;noref = cons(symbol->refdes noref)
++norefcnt
)
);foreach-end
fprintf(logfile "\nTotal of no refdes: %d\n" norefcnt)
axlDMClose(logfile)
axlMsgPut("Total component without refdes: %d\n" norefcnt)
axlMsgPut("Components without refdes , please view logfile.")
;==================================================
);end let
);EndDef SPM_AddRef
;############################################################
你这个第二个程序一看就错了嘛,n0是哪来的? 邓阿斌 发表于 2020-3-23 21:25
你这个第二个程序一看就错了嘛,n0是哪来的?
你可以帮改吗? :):) 为什么我早上回复的会被删掉? 是我搞错了,你在EDA365上也发了:L 6771877@qq.com 发表于 2020-3-25 11:41
为什么我早上回复的会被删掉?
没有删吧,可能是没通过 :lol:lol:lol:lol:lol:lol