|
Communications
The low-level communications with your color measuring Instrument is built-in
to ColorFacts. Your macro only needs to run a single line to get a reading, and
then access the data. If you were to write your own code, it would take many
weeks of testing to send the correct commands to the device.
ColorFacts API
The ColorFacts API (Application Programming Interface) is a rich set of COM
objects that hide the complexity and mathematics of color science. The script
writer can concentrate on solving specific business without having to
understand precisely how all of the different color spaces and measurements
relate to each other.
ColorFacts API includes many powerful color algorithms and functions, which makes writing code
very easy. For example, you can automatically convert readings to other colorspace systems such
as CIELuv, CIELab, CIELCh, RGB, and XYZ.
With simple method calls, the API can return a matrix of data that can easily be written to other
applications for further analysis.
Sample Code:
Here is some sample code to take a reading and write it to a file:
With oMeter
Set oReading
= .Reading
Open
"C:\MyFile.csv"
For Append
As #1
Write
#1, oReading.xyY.x
, oReading.xyY.Y, oReading.xyY.Lum
Close #1
End With
With just a single line of code "
Set oReading = .Reading",
the macro will communicate with your color measuring- instrument and take the reading. The
oReading object will have all of the readings in easy-to-use properties. For example, to access
the x value from the xyY reading, you simply use "oReading.xyY.x", as is shown in the
code above. In this example, the three values (xyY) are written to a CSV file, which can
be opened by Excel.
The are many dozens of properties and methods built into the API that simplify your programming
tasks.
|