7 Replies Latest reply on Sep 2, 2016 6:32 AM by jeff@viavi

    Generating Component Placement List (CPL) file (using scripts?)


      Hi everyone!


      Most of our PCB-s are assembled by automated pick and place machines. Because of this we need to generate a CPL file very often. For this we use a very obsolete and inconvenient method where you have to modify a lot of thing by hand to get the final result. We didn't have problems with is yet, but I'd prefer a more productive way to generate such a file (txt, csv, excel.... ). My problem is I can't find a way to do this in expedition. If there is a way to generate these files please tell me how could I manage this.


      However I found one way to do this, and it is scripting. Well I'm not much of a programmer but I've tried to use the help's: Exercise 6 (Generating a component CSV file). I copy-pasted it to a text editor and wanted to use it (first I made the via counting script which worked fine), but the component CSV script had problems with the licensing phase, I've found out that the function is not defined in the script and I had to copy it from the via counter script. But now it complains about the WriteHeaders subroutine which is also not defined so the complain is correct, but I couldn't find this function anywhere, so I cant put it in the script. I guess the same would happen with WriteComponents... etc... functions, because none of the is defined in the script. Although help says the following: ''Use the scripting editor of your choice to enter the script described (including the license server function) and save the script as ComponentCVS.vbs.'' etc... This happened, and every other thing help wrote. But according to my programming knowledge if a function is not defined it wont work. Even if there's another way to generate the CPL file, I'd like to get this script working to, because it would be grate for unique export options.

      Here's a picture about the issue:


      XPCB script error.JPG


      I've attached the script too.


      Thanks for the help!

      Best regards!

      Laszlo Galantai

        • 1. Re: Generating Component Placement List (CPL) file (using scripts?)



          I managed to work out the CSV, I missed a few lines from the help.... (especially the two subroutines I needed) I have no idea how could I do that. Although if there is any other way to generate a placement file please tell me how to do it.



          Laszlo Galantai

          • 2. Re: Generating Component Placement List (CPL) file (using scripts?)

            I'm not using Expedition yet (stil on BoardStation/RE) but there HAS to be a way to generate that data automatically.

            Every board assembly process in the world needs to know the component X-Y locations and rotations,

            and whether the component is placed on the top side or the bottom side.

            (sometimes referred to as a component "pick and place" file)


            I hope I am misunderstanding your question!



            • 3. Re: Generating Component Placement List (CPL) file (using scripts?)



              I'm not sure, let me explain the whole thing: So expedition knows the coordinates, and it can export it too, but (in our knowledge) just thru the report writer. Report writer generates a bunch of files which are useless if you don't have report writer installed (you need EEVX1.0 for this, because it doesn't come with 1.1 anymore) of course we use EEVX1.1 so on one of my college's computer there is still the 1.0 version so we could use the report writer named software, to generate a CSV from the bunch of useless files we got from expedition. But report writer doesn't export custom propertys (there are 2 options is you click on report writer in expedition, without any settings, I guess there is a config file for this too, but I couldn't find anything about it) so we need to use part lister in DX designer to get out a few parameters we need to put in the CPL, than merge the two files in excel, and than you're done(and you hope you didn't mass it up...). I did this for the first time today and I thought there must be another way, my colleges said this is the way it gets done. I was so pissed of, I started to look after it, and I couldn't find any way beside scripting. It's quite unbelievable for me that such a software like Expedition doesn't have a button for this, which you set to your specific parameters, then click and its done. At least that what I was expecting. The script works fine by the way, I can generate a CPL with it by a drag and drop now, what is way way better then the procedure I described... I've made some changes in it (to configure it for our needs), I'm starting to understand the basics by now, but I'm sure there is an integrated export option for this somewhere.


              Laszlo Galantai

              • 4. Re: Generating Component Placement List (CPL) file (using scripts?)



                I've made a few modifications to the script (componentCvs.vsb) but there's one thing which doesn't want to work. So I'd like to write a custom made property to the CSV file whats generated. For this I've found that there is a "findproperty"  function. So I'm using this function to load the "IFS" named property to a variable, this will become an object which contains the name and the value of the property (according to mentor help). It works until this part, it finds the property and assigns it to the propObj variable (as object). but when I try to assign the value to a variable it fails saying error message: 'Object required'. But if I add pharentesis after the .value statement it writes 'object not a collection'. So is it an object? I don't get it. I've attached pictures for better understanding.


                This is the part of the script where this happens:


                The 'Giving IFS value to ifStr variable' line fails, it says the following:



                But if I write 'set' to the beginning of the row (this is not required according to vbs scripting language because it only works for objects), looks like this:



                It writes this:



                There's the value "3502-1003" what I'm looking for.... I'd like to get that string written in the CSV file but something is wrong, and I can't figure it out what... I've tried several things like + or &. But it fails all the time at the assignment part.


                Although if I write this (copied from help):



                It writes out the property.value without any errors.....



                Clicking ok goes to the next component and the next component and so on.... working just fine...


                I guess something is wrong with the assignment part but I don't know what, please someone help me solve this I'm so close!



                Laszlo Galantai

                • 5. Re: Generating Component Placement List (CPL) file (using scripts?)



                  I've managed to work it out, now it works! The problem was caused by components which doesn't have the IFS parameter (mechanical holes, etc...), because in that case the propObj variable didn't become an object (if the searched parameter could not be found the findparameter function returns nothing, if it finds the property it gives the object type parameter to the required variable in my case to propObj, so if it doesn't find it the variable can't become an object --> object required error message).


                  Best regards!

                  Laszlo Galantai

                  • 6. Re: Generating Component Placement List (CPL) file (using scripts?)

                    Have a look at the output from the command File-->Export-->General Interfaces-->Generic AIS.


                    This generates a file called vb_ais.txt in the output directory.

                    • 7. Re: Generating Component Placement List (CPL) file (using scripts?)

                      If you don't like the output from the command File-->Export-->General Interfaces-->Generic AIS that Charles pointed out, there is a sample script in \MentorGraphics\EEVX.1.2\SDD_HOME\standard\examples\pcb\Automation\Scripts called AIS.vbs.  You could modify this to meet your needs.  I'm attaching one that I have used in the past