找回密码
 注册
关于网站域名变更的通知

请问各位Skill大神,为什么我写的skill程序在一个打开的板子里面只能运行一次。

查看数: 1133 | 评论数: 11 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2019-8-26 12:49

正文摘要:

各位大神,我自己写了一个skill,用procedure来定义的函数,但是我发现,如果我在当前板子里面运行一次过后,就不能运行第二次,必须重新关闭allegro后,然后再次打开这个板子才能运行,请问各位大神,这个是怎么回 ...

回复

leilei4908 发表于 2019-8-27 10:19
Nick740492 发表于 2019-8-26 20:40
请问skill大师们,为什么我第二次load 这个skill程序的时候出现function redefined啊。这个是怎么回事啊。 ...

redefined,就是你的procedure重新加载并定义了,也就是更新过了
Nick740492 发表于 2019-8-27 08:23
找到原因了,多谢各位大神的指导
Nick740492 发表于 2019-8-27 07:47
本帖最后由 Nick740492 于 2019-8-27 08:23 编辑

找到原因了,大神们的指导与浏览,谢谢
Nick740492 发表于 2019-8-26 20:40
请问skill大师们,为什么我第二次load 这个skill程序的时候出现function redefined啊。这个是怎么回事啊。请大师指导下,非常感谢

点评

redefined,就是你的procedure重新加载并定义了,也就是更新过了  详情 回复 发表于 2019-8-27 10:19
Nick740492 发表于 2019-8-26 17:42
放飞自我 发表于 2019-8-26 17:12
我不是大师
看了一下,有以下几个地方

好的,多谢了啊,我这边其实已经改掉了和你上面检查的东西,就是没有进行判断文件是否存在
现在又发现strcat那边有问题,好像strcat起来的string会多一个./,请帮忙一并看看啊。谢谢大师了
Nick740492 发表于 2019-8-26 17:41
好的,多谢了啊,我这边其实已经改掉了和你上面检查的东西,就是没有进行判断文件是否存在
放飞自我 发表于 2019-8-26 17:12
Nick740492 发表于 2019-8-26 14:20
请大师帮忙看看啊。也请指导一下,多谢了

我不是大师
看了一下,有以下几个地方

axlCmdRegister("releasefile" 'releasefile ?cmdType "General")

procedure( releasefile()

designnameandpath=axlDMFileParts(axlGetDrawingName())

designpath=nth(0 designnameandpath)

designname=nth(1 designnameandpath)

rexComplie("_PCB_")  ; 函数改为rexCompile

gerbername=rexReplace(designname "_GERBER_" 0)

stencilname=rexReplace(designname "_STENCIL_" 0)

releasefile=createDir("Releasefile")

gerberfilename=strcat("./Releasefile" "/" gerbername)

stencilfilename=strcat("./Releasefile" "/" stencilname)

gerberfile=createDir(gerberfilename)

stencilfile=createDir(stencilfilename)

drcerror=axlDBGetDesign()->drcs

if((drcerror!=nil) then

        yesnocancel=axlUIYesNo("DRC exist in this design, Wouldyou like to clear them all?")

        if((yesnocancel!=1) then ; YesNo只返回t和nil。改为if(!yesnocancel)不理会DRC继续导出光绘

                axlShell("replay artwork.scr")

                axlShell("replay componentreport.scr")

        else
                print("lease Check the DRCs.")
  ))

if((drcerror==nil) then

        axlShell("replay artwork.scr")

        axlShell("replay componentreport.scr")
  ) ;这一部分可以和上面合并

filename=getDirFiles("./GBR") ;没看懂这个GBR文件夹哪里来的,还是原来就存在的?

filename1=remove("." filename)

filename2=remove(".." filename1)

filenamelength=length(filename2)-1

for(
        i 0 filenamelength

        name=nth(i filename2)

        fileorigpath=strcat("." "/" "GBR" "/" name)

        filedestpath=strcat("." "/" gerberfilename "/" name)

        axlOSFileCopy(fileorigpath filedestpath t)

   )

currentpath=getWorkingDir()

stencilpath1=strcat(currentpath "/" stencilfilename "/" "silk_top.art")

axlOSFileCopy("./GBR/silk_top.art" stencilpath1 t)

stencilpath2=strcat(currentpath "/" stencilfilename "/" "silk_bottom.art")

axlOSFileCopy("./GBR/silk_bottom.art" stencilpath2 t)

stencilpath3=strcat(currentpath "/" stencilfilename "/" "pmask_top.art")

axlOSFileCopy("./GBR/pmask_top.art" stencilpath3 t)

stencilpath4=strcat(currentpath "/" stencilfilename "/" "pmask_bottom.art")

axlOSFileCopy("./GBR/pmask_bottom.art" stencilpath1 t)

redmefilepath=strcat(currentpath "/" stencilfilename "/" "README.txt")

axlOSFileCopy("D:/README.txt readmefilepath t) ;缺少双引号

brdpath=strcat("./" designname ".brd")

brdtoreleasefile=strcat("./Releasefile" "/" designname ".brd")

axlOSFileCopy(brdpath brdtoreleasefile t)

)


另外,如果要运行第二次,最好在创建文件夹和文件之前做一下文件夹和文件是否存在的判断。程序第二次运行,建议把第一次产生的gerber删除掉。

点评

好的,多谢了啊,我这边其实已经改掉了和你上面检查的东西,就是没有进行判断文件是否存在 现在又发现strcat那边有问题,好像strcat起来的string会多一个./,请帮忙一并看看啊。谢谢大师了  详情 回复 发表于 2019-8-26 17:42
Nick740492 发表于 2019-8-26 14:20

请大师帮忙看看啊。也请指导一下,多谢了

点评

我不是大师 看了一下,有以下几个地方 axlCmdRegister("releasefile" 'releasefile ?cmdType "General") procedure( releasefile() designnameandpath=axlDMFileParts(axlGetDrawingName()) des  详情 回复 发表于 2019-8-26 17:12
Nick740492 发表于 2019-8-26 14:19

axlCmdRegister("releasefile" 'releasefile ?cmdType "General")

procedure( releasefile()

designnameandpath=axlDMFileParts(axlGetDrawingName())

designpath=nth(0 designnameandpath)

designname=nth(1 designnameandpath)

rexComplie("_PCB_")

gerbername=rexReplace(designname "_GERBER_" 0)

stencilname=rexReplace(designname "_STENCIL_" 0)

releasefile=createDir("Releasefile")

gerberfilename=strcat("./Releasefile" "/" gerbername)

stencilfilename=strcat("./Releasefile" "/" stencilname)

gerberfile=createDir(gerberfilename)

stencilfile=createDir(stencilfilename)

drcerror=axlDBGetDesign()->drcs

if((drcerror!=nil) then

        yesnocancel=axlUIYesNo("DRC exist in this design, Wouldyou like to clear them all?")

        if((yesnocancel!=1) then

                axlShell("replay artwork.scr")

                axlShell("replay componentreport.scr")

        else
                print("Please Check the DRCs.")
  ))

if((drcerror==nil) then

        axlShell("replay artwork.scr")

        axlShell("replay componentreport.scr")
  )

filename=getDirFiles("./GBR")

filename1=remove("." filename)

filename2=remove(".." filename1)

filenamelength=length(filename2)-1

for(
        i 0 filenamelength

        name=nth(i filename2)

        fileorigpath=strcat("." "/" "GBR" "/" name)

        filedestpath=strcat("." "/" gerberfilename "/" name)

        axlOSFileCopy(fileorigpath filedestpath t)

   )

currentpath=getWorkingDir()

stencilpath1=strcat(currentpath "/" stencilfilename "/" "silk_top.art")

axlOSFileCopy("./GBR/silk_top.art" stencilpath1 t)

stencilpath2=strcat(currentpath "/" stencilfilename "/" "silk_bottom.art")

axlOSFileCopy("./GBR/silk_bottom.art" stencilpath2 t)

stencilpath3=strcat(currentpath "/" stencilfilename "/" "pmask_top.art")

axlOSFileCopy("./GBR/pmask_top.art" stencilpath3 t)

stencilpath4=strcat(currentpath "/" stencilfilename "/" "pmask_bottom.art")

axlOSFileCopy("./GBR/pmask_bottom.art" stencilpath1 t)

redmefilepath=strcat(currentpath "/" stencilfilename "/" "README.txt")

axlOSFileCopy("D:/README.txt readmefilepath t)

brdpath=strcat("./" designname ".brd")

brdtoreleasefile=strcat("./Releasefile" "/" designname ".brd")

axlOSFileCopy(brdpath brdtoreleasefile t)

)

放飞自我 发表于 2019-8-26 14:02
有源码么,看看

点评

请大师帮忙看看啊。也请指导一下,多谢了  详情 回复 发表于 2019-8-26 14:20
axlCmdRegister("releasefile" 'releasefile ?cmdType "General") procedure( releasefile() designnameandpath=axlDMFileParts(axlGetDrawingName()) designpath=nth(0 designnameandpath) designname=  详情 回复 发表于 2019-8-26 14:19
关闭

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

EDA365公众号

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

GMT+8, 2025-11-22 10:28 , Processed in 0.171875 second(s), 30 queries , Gzip On.

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

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

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