1 of 1 people found this helpful
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
This means I am really a beginner.
I have checked you code from June 4th. In my office I does not work...
although everything looks ok:
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.
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
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...
One more time attempting to attach the script...
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.
dim doc: set doc = Application.activeDocument
' Validate the server before using the Document object
If ValidateServer(doc) = 0 then
MsgBox "Server validation failed."
dim s: s="Fiducials: " & doc.fiducials.count & vbCr
for each fid in doc.fiducials(epcbSelectAll)
s = s & "Side " & fid.Side & " x=" & fid.PositionX & " y=" & fid.PositionY & vbCr
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
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.
...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.
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.