anyone familiar with scripting in altium ? - Page 1
Forum section: electronics / general

author: free_electron
author_rank: Super Contributor
timestamp: October 14, 2014, 08:56:36 pm
content: its like pulling teeth.here is what i need to do:- find out if a specific project parameter is present- create a project parameter- modify a project parameter- read a project parameter- alter target directories in the outjob definitions.- fire off jobs in the outjob definition.- fire off shell commands ( i want to call winzip and other programs from the script )

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 15, 2014, 03:41:06 am
content: Beats me, but that sounds like a handy bit I wouldn't mind looking at, if you don't mind sharing.Tim

author: free_electron
author_rank: Super Contributor
timestamp: October 15, 2014, 10:10:29 am
content: The script is simple but very long. Here is what it needs to do- save all open files- commit to svn- destroy the output directory so no old files remain- open the outjob file and alter the target folders for certain elements ( i can do this by calling an execuatable. The outjob file is human readable ascii and i have figured out how to alter it already. I call an .exe with command line arguments that patches the outjob file and then fire it off within altium. For example if a project is called project1-a-02 then the output folders for assembly need to be called assembly-02 and production-02. If the project is revised to a 03 the output folders roll as well. So the script reads the project filename figures out the 'stepping' and creates folders.- export the pcb file and netlists in a few different formats and throw these in the production folders.- zip the assy and production folders into project1-a-02-assembly.zip and so on.- mark produced outputs for inclusion in svn- commit to svn- call an external program that creates entries in the PLM database for the new rev and uploads the different zip files- send an email to procurement, the responsable engineer and production that a project relase has ahppened and the files are in the PLM tool.This is a lengthy error prone process now. Mislabel or forget one folder and you get to redo it.The process is simp,e enough , its just very annoying for a human. It takes an hour to do all that crap.And the problem is : change a part value on the schematic and you get to roll the entire thing again.Altering a small thing requires the entire output process to run so fab gets updated.I already eliminated a lot of overhead by using project parameters and i jecting those in master templates.The goal is to create a set of scripts where you go : i need a 4 layer flex board. Here is project number , this is the engineer , root step. Click one bjtton. Folders are created, pcb and schematic root files created, project created, svn folder created, plm database entry created, initia commit done.Now i can focus drawing schematics and board.When done. Call another script : output created. Done.Need a revision ? Call a script that clones existing project, rolls stepping or revisin , patches the project properties and strings so the templates and output files / folders are all alteredI'm pretty far already. I got large parts automated but am missing some functions. The documentation is very, very bad for the available api commands. The autocomp,ete in altium doesn't even know half of the commands. You type iproject. And get a list of 4 methods. Well, there's over 50 ... Good ffing luck finding what it could be....

author: mengfei
author_rank: Regular Contributor
timestamp: October 16, 2014, 01:24:05 am
content: check out some of the scripts herehttps://drive.google.com/folderview?id=0B9wYgjewDMDFYzBTU1pMR0xaSHM&usp=sharing#list& tut herehttp://www.mbedded.ninja/electronics/general/altium/altium-scripting-and-using-the-api#where-to-download-scripts-from