Automation can call an Export CCZ window.
But, Automation or Automation Pro can't output the CCZ file directly.
Normally, We can use app.Gui.ProcessCommand("File->Export->CCZ...", True) to export CCZ file, but We don't know how to entry the name of outfile. However, By a modfied the .upf file, We can avoid this and sucessfully ouput CCZ file.
Thanks Yanfeng, that was the direction that I was heading in, but like you I didn't know how to name the output file. I will take a look at the .upf file.
I did this for our company. Our company don't allow expose our codes to public, even it's very simle.
In fact, There are workaround here. You may use replay file or use following dumb menthod:
1) open a sample .pcb file in expeditionpcb,output the ccz file named it.
2) use this. upf file as a template file
3) in your automation script, do as following:
When doing automation action to the design, script first rename the .upf file as backup.upf, and copy the template .upf into \config
4) now the gui.processcommand will automatically .ccz file and you rename it based on the .pcb name
5) finnaly, delete the template upf file under \config and rename backup.upf to original name
change .upf file don't have any negative effects at all, so this trick works well.
Here is an example to do it automatically, the run replay is not a supported command so if it stops working hopefully there will be a better wat to do it.
I added to AATK and it will be in the next update under manuafacturing.
RunReplayCCZ.txt 2.3 KB
I don't know if you have noticed this or not, but the first time I run this script, it runs with the zip option (Like it is set). However, if I run the script again, it switches to the non zip verion and if I run it again, it is back to the zip version. Any ideas?
DOOOHHHH. You hit the dreaded toggle swith, I had the same thing in another replay file, just change the script to run it twicw and then have the script blow away the one you don't want! Not pretty but it works!
I really do not have a solution for the checkbox GUI's.
I was just searching on the MUG forums and I just found that you had this issue before Thanks for the update!
I just posted a request for automation hooks for this feature on the Ideas site (https://na5.brightidea.com/ct/ct_a_view_idea.bix?i=189DA9C6). If this is something you would like to see added, please go add your vote to this.
This code works with 2007.7 (and probably 2007.6)
' add any type librarys to be used.
' Get the application object
Set pcbApp = GetObject(,"MGCPCB.ExpeditionPCBApplication")
'Set pcbApp = CreateObject("MGCPCB.ExpeditionPCBApplication")
' Get the active document
Set pcbDoc = pcbApp.ActiveDocument
name = pcbDoc.Name
name = Left(name, (InStrRev(name, ".", -1, 1) -1))
' License the document
' change the filename to either .ccz or .cc here
fileName = pcbDoc.Path + name + ".ccz"
Dim addin, addins
Set addins = Application.Addins
For Each addin In addins
If addin.Name = "CCZ Export Addin" Then
msgbox "Done - exported file: " & vbcrlf & filename
' Helper fucntion for including files.
Function FindInWDIR(sFilename, oFSO)
sSeparator = ";"
If Scripting.IsUnix Then
sSeparator = ":"
arrWdirs = Split(Scripting.GetEnvVariable("WDIR"), sSeparator)
For I = 0 To UBound(arrWdirs)
sPath = arrWdirs(I) & "/" & sFilename
If FSO.FileExists(sPath) Then
FindInWDIR = sPath
FindInWDIR = sFilename
' Helper function for including files.
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Dim f: Set f = fso.OpenTextFile(FindInWDIR(fileName, fso),1)
Dim s: s = f.ReadAll
' Server validation function
Private Function ValidateServer(doc)
dim key, licenseServer, licenseToken
' Ask Expedition’s document for the key
key = doc.Validate(0)
' Get license server
Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
' Ask the license server for the license token
licenseToken = licenseServer.GetToken(key)
' Release license server
Set licenseServer = nothing
' Turn off error messages. Validate may fail if the token is incorrect
On Error Resume Next
' Ask the document to validate the license token
If Err Then
ValidateServer = 0
ValidateServer = 1
ExportCCZ.zip 1.1 KB
Thank you for the tip using Addins. It really works and support any version of 2007.X after that Seting addins = Application.Addins be changed to addins=pcbApp.Addins.
Have you tried this code with 7.9 yet? It seems to work OK, but the new progress bar only gets to 99%, even though the file is done generating. Any ideas what needs to be done to fix this or is there a better way in 7.9?
My question is how to export the CCZ from the older design without open by expedition.
the solution to open by expedition is no good because is necessary ro maintain older software version, risk to migrated some data or change.
best way is to have a script to convert pcb data or hkp, or ... to ccz