请选择 进入手机版 | 继续访问电脑版

EDABOSS电子论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1096|回复: 6

[转帖] 如何將Version 16.x 降到Version 15.7的代碼

[复制链接]

47

主题

3

回帖

430

E币

技术员

Rank: 2

积分
97
发表于 2017-12-16 16:09:35 | 显示全部楼层 |阅读模式
要使用以下的代碼,必須安裝多個版本的Allegro才能使用.
V16.5以上的話必須降到V16.3以下,才能再降到V15.7
  1. axlCmdRegister("16to15" 'fnExportV16xToV15xMain ?cmdType "general")

  2. procedure(fnExportV16xToV15xMain()
  3.   prog(()
  4.       fVersion = axlVersion('version)
  5.       tDesignFullName = axlGetDrawingName()
  6.       tDesignType = axlDesignType(t)
  7.       tHomePath = getShellEnvVar("CDSROOT")
  8.       if(fVersion > 16.0 then
  9.           unless(getShellEnvVar("DOWNREV_16_TO_15") setShellEnvVar("DOWNREV_16_TO_15=1"))
  10.           if(fVersion == 16.01 then
  11.                 tDesignFileName = car(reverse(parseString(tDesignFullName "/")))
  12.                 case(tDesignType
  13.                     ("BOARD"
  14.                         t15xFileName = strcat(cadr(reverse(parseString(tDesignFileName "."))) "_157.brd")
  15.                     )
  16.                     ("PACKAGE"
  17.                         t15xFileName = strcat(cadr(reverse(parseString(tDesignFileName "."))) "_157.dra")
  18.                 )
  19.             )
  20.             tDownSoftware = strcat(tHomePath "\\tools\\pcb\\bin\\vc5\\downrev15.exe")
  21.             if(isExecutable(tDownSoftware) then
  22.                 when(isFile(t15xFileName)
  23.                     deleteFile(t15xFileName)
  24.                 )
  25. sprintf(tSvaeFileCmd "%s %s -outfile %s " tDownSoftware tDesignFileName t15xFileName)
  26. bResult = axlRunBatchDBProgram("Downrev15" tSvaeFileCmd ?startMsg "Save design to 15.7 Start..." ?silent t)
  27. printf("Downrev Finish.")
  28. deleteFile(strcat(car(parseString(tDesignFileName ".")) ".log"))
  29. else
  30. printf("Can not find downrev15.exe")
  31. return(nil)
  32. )
  33. else
  34. if(fVersion < 16.5 then case(tDesignType
  35. ("BOARD"
  36. tNewDesignFileName = strcat(cadr(reverse(parseString(tDesignFullName "/."))) "_New1601.brd")
  37. )
  38. ("PACKAGE"
  39. tNewDesignFileName = strcat(cadr(reverse(parseString(tDesignFullName "/."))) "_New1601.dra")
  40. )
  41. )
  42. when(isFile(tNewDesignFileName)
  43. deleteFile(tNewDesignFileName)
  44. )
  45. tScriptFileName=axlTempFile()
  46. pScriptFile=outfile(tScriptFileName "w")
  47. fprintf(pScriptFile "setwindow pcb\n")
  48. fprintf(pScriptFile "downrev \n")
  49. fprintf(pScriptFile "setwindow form.downrev\n")
  50. fprintf(pScriptFile "FORM downrev downrev \n")
  51. fprintf(pScriptFile "fillin "%s"\n" tNewDesignFileName)
  52. fprintf(pScriptFile "FORM downrev close\n")
  53. close(pScriptFile)
  54. sprintf(tRunScriptCommand,"replay %s",tScriptFileName)
  55. axlShell(tRunScriptCommand)
  56. deleteFile(tScriptFileName)
  57. deleteFile("downrev.log")
  58. case(tDesignType
  59. ("BOARD"
  60. t15xFileName = strcat(cadr(reverse(parseString(tNewDesignFileName "."))) "_157.brd")
  61. )
  62. ("PACKAGE"
  63. t15xFileName = strcat(cadr(reverse(parseString(tNewDesignFileName "."))) "_157.dra")
  64. )
  65. )
  66. case(fVersion
  67. (16.2
  68. tDownSoftware = strcat(tHomePath "\\tools\\pcb\\bin\\vc5\\downrev15.exe"
  69. )
  70. (16.3
  71. tDownSoftware = strcat(tHomePath "\\tools\\pcb\\bin\\vc5\\downrev15.exe"
  72. )
  73. (16.5
  74. tDownSoftware = strcat(tHomePath "\\tools\\pcb\\bin\\vc5\\downrev15.exe"
  75. )
  76. (t
  77. tDownSoftware = strcat(tHomePath "\\tools\\pcb\\bin\\vc5\\downrev15.exe"
  78. )
  79. )
  80. if(isExecutable(tDownSoftware) then
  81. when(isFile(t15xFileName)
  82. deleteFile(t15xFileName)
  83. )
  84. sprintf(tSvaeFileCmd "%s %s -outfile %s " tDownSoftware tNewDesignFileName t15xFileName)
  85. bResult = axlRunBatchDBProgram("Downrev15" tSvaeFileCmd ?startMsg "Save design to 15.7 Start..." ?silent t)
  86. printf("Downrev Finish.")
  87. deleteFile(strcat(car(parseString(tNewDesignFileName ".")) ".log"))
  88. else
  89. printf("Can not find downrev15.exe")
  90. return(nil)
  91. )
  92. else
  93. case(tDesignType
  94. ("BOARD"
  95. tNewDesignFileName = strcat(cadr(reverse(parseString(tDesignFullName "/."))) "_New162.brd")
  96. )
  97. ("PACKAGE"
  98. tNewDesignFileName = strcat(cadr(reverse(parseString(tDesignFullName "/."))) "_New162.dra")
  99. )
  100. )

  101. tScriptFileName=axlTempFile()
  102. pScriptFile=outfile(tScriptFileName "w")
  103. fprintf(pScriptFile "setwindow pcb\n")
  104. fprintf(pScriptFile "downrev \n")
  105. fprintf(pScriptFile "setwindow form.downrev\n")
  106. fprintf(pScriptFile "FORM downrev save2 YES \n")
  107. fprintf(pScriptFile "FORM downrev save\n")
  108. fprintf(pScriptFile "fillin "%s"\n" tNewDesignFileName)
  109. fprintf(pScriptFile "FORM downrev close\n")
  110. close(pScriptFile)
  111. sprintf(tRunScriptCommand,"replay %s",tScriptFileName)
  112. axlShell(tRunScriptCommand)
  113. deleteFile(tScriptFileName)
  114. deleteFile("downrev.log")
  115. )
  116. )
  117. else
  118. return(nil)
  119. )
  120. )
  121. )
复制代码


积分规则
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|EDABOSS电子论坛

GMT+8, 2024-3-29 19:57 , Processed in 0.038200 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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