9 Replies Latest reply on Jun 8, 2010 11:24 AM by Head1

    How to extract coordinates + side for fiducial ?


      Hello everybody,


        I am looking for a small script which extracts xy + side for Fiducials.

        I tried through cell collection, but did not succeed till now.


        Can anybody help me in this problem ?


           Thanks in advance,




        • 1. Re: How to extract coordinates + side for fiducial ?

                  Dim fid 'As Fiducial
                  Dim fids 'As Fiducials
                  Set fids = pcbDoc.Fiducials(epcbSelectAll)
                  Dim side, x, y

                  For Each fid In fids
                      side = fid.side
                      If side = 1 Then side = "Top"
                      If side = 512 Then side = "Bottom"
                      x = fid.PositionX
                      y = fid.PositionY


          1 of 1 people found this helpful
          • 2. Re: How to extract coordinates + side for fiducial ?

            Thanks kendall,


              So simple...

              This means I am really a beginner.






            • 3. Re: How to extract coordinates + side for fiducial ?

              Hello Kendall,


                 I have checked you code from June 4th.  In my office I does not work...

                 although everything looks ok:


                      Dim Fid

                       Dim Fids


                       Set Fids=PcbDoc.Fiducials(epcbSelectAll)

                       Dim Side, x, y

                       For each Fid in Fids






                    How do I know it does not work?

                     I collect the variables x, y, side,  to an array. ( or a listbox).  The array remains empty.


                     Why is it empty ?

                      Because Fids is an  empty object.


                      How do I know ?

                      I checked this script in Vb. (not in Vbs). There, I can stop the run anywere and to check values of variables.

                      I tries to stop the program on line : Side=Fid.side, But the program did not stop.


                      Why ?

                       Because Fids is, probably, an empty object.

                       Which means, I do not have Fiducials in my design, or they  are fake.

                      So, I have fiducials, and they are ok.


                     How do I know ?

                     On Display control, tab general I can display and hide them.

                     I believe this is a good evidence  that they are ok.


                     Another reason why it does not work - I can not thing about, except  if it is a Mentor Bug

                     or mine...


                     Many Thanks,




















              • 4. Re: How to extract coordinates + side for fiducial ?

                Attached is an example of a script that retrieves the fiducials. Drag and drop it onto an open Expedition design. If the script reports zero fiducials then you don't have any in your design...


                Regards, Ed

                • 5. Re: How to extract coordinates + side for fiducial ?

                  One more time attempting to attach the script...

                  • 6. Re: How to extract coordinates + side for fiducial ?

                    Looks like it won't let me attach a script (probably by design) so here's the complete text of it... Paste into a file and drag and drop the file onto an open Expedition design.





                    option explicit
                    dim doc: set doc = Application.activeDocument

                    ' Validate the server before using the Document object
                    If ValidateServer(doc) = 0 then
                        MsgBox "Server validation failed."
                    End If

                    dim s: s="Fiducials: " & doc.fiducials.count & vbCr
                    dim fid
                    for each fid in doc.fiducials(epcbSelectAll)
                    s = s & "Side " & fid.Side & " x=" & fid.PositionX & " y=" & fid.PositionY & vbCr
                    MsgBox s

                    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
                        End If

                    End Function

                    • 7. Re: How to extract coordinates + side for fiducial ?

                      Hello Ad,


                        Thanks for you answer.


                        I do not see anything different in you script.

                        The  idea is like in the lines I printed. ( written by Kendall Hiles).

                        I did not mention the license acquiring, which exisits in my code, of couse.

                        Anyway, I will check you code tomorrow morning.




                      • 8. Re: How to extract coordinates + side for fiducial ?

                        ...why do you need a script for extracting Fiducials?


                        In Expedition PCB>Files>Expoprt>General Interfaces>Generic AIS

                        you can generate a Pick and Place File.

                        It contains Fiducials, Coordinates and Side at the end of the file.



                        • 9. Re: Answer  and thanks to Guenni



                          Thanks for you email.


                               Answer to you question:

                               People who use our Pick & place files, are used to a specific format which

                               we provide for last 15 years. That file must include the  fiducial's details.

                               This is why we can not use the Vb_ais.txt  format


                               Thanks to you email, I found the reason why my script did not work.

                                ( Written by Kendall Hiles).


                               I have noticed that when I create the vb_ais.txt  file, no fiducials appear there,

                               where as fiducial really exist in the design.


                               This means the fiducial is not defined properly.

                               I changed the fiducial to another one, since then - everything works !


                               So your mail was the most effective.