找回密码
 注册
关于网站域名变更的通知
查看: 1096|回复: 11
打印 上一主题 下一主题

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

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2019-8-26 12:49 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

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

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

该用户从未签到

2#
发表于 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

该用户从未签到

3#
 楼主| 发表于 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)

)

该用户从未签到

4#
 楼主| 发表于 2019-8-26 14:20 | 只看该作者

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

点评

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

该用户从未签到

5#
发表于 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

该用户从未签到

6#
 楼主| 发表于 2019-8-26 17:41 | 只看该作者
好的,多谢了啊,我这边其实已经改掉了和你上面检查的东西,就是没有进行判断文件是否存在

该用户从未签到

7#
 楼主| 发表于 2019-8-26 17:42 | 只看该作者
放飞自我 发表于 2019-8-26 17:12
我不是大师
看了一下,有以下几个地方

好的,多谢了啊,我这边其实已经改掉了和你上面检查的东西,就是没有进行判断文件是否存在
现在又发现strcat那边有问题,好像strcat起来的string会多一个./,请帮忙一并看看啊。谢谢大师了

该用户从未签到

8#
 楼主| 发表于 2019-8-26 20:40 | 只看该作者
请问skill大师们,为什么我第二次load 这个skill程序的时候出现function redefined啊。这个是怎么回事啊。请大师指导下,非常感谢

点评

redefined,就是你的procedure重新加载并定义了,也就是更新过了  详情 回复 发表于 2019-8-27 10:19

该用户从未签到

9#
 楼主| 发表于 2019-8-27 07:47 | 只看该作者
本帖最后由 Nick740492 于 2019-8-27 08:23 编辑

找到原因了,大神们的指导与浏览,谢谢

该用户从未签到

10#
 楼主| 发表于 2019-8-27 07:49 | 只看该作者
请问大师们,为什么这个程序只能在板子里面运行一次啊,第二次就不行了,必须重新关闭PCB再次打开才能运行。请各位大神帮忙看看,多谢多谢了


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

1.png

该用户从未签到

11#
 楼主| 发表于 2019-8-27 08:23 | 只看该作者
找到原因了,多谢各位大神的指导
  • TA的每日心情
    开心
    2022-5-6 15:29
  • 签到天数: 34 天

    [LV.5]常住居民I

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

    redefined,就是你的procedure重新加载并定义了,也就是更新过了
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-8-20 21:55 , Processed in 0.156250 second(s), 34 queries , Gzip On.

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

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

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