Import XYZ Points from external source

Post Reply
User avatar
CrashN8
Site Admin
Site Admin
Posts: 447
Joined: Thu Feb 09, 2017 4:07 pm

Import XYZ Points from external source

Post by CrashN8 » Tue Jan 29, 2019 11:10 am

CMM-Manager has built-in Import Points Operation that allows importing point data from external source such as 3rd party metrology software. Maybe this 3rd party system lacks CAD and reporting capabilities needed for the current task... If so, just import you point and CAD data to CMM-Manager and perform Alignment, Feature constructions, Best-Fitting, Reporting, etc. See specific example for processing points from Inspec software from MicroVu vision system here

import_points_1.jpg

Point data format can vary to some extent... For example both formats shown below are acceptable. Typically the data should be comma delimited and could contain Point Name, X, Y, Z, I, J, K. The Point Name should start with alpha character, afterwords CMM-Manager automatically detects XYZ / IJK data.
//----------------------------------------------------------
// name: CAD_CLOUD < total_points: 2205 >
// probe radius: 0.0000000
//----------------------------------------------------------
// X Y Z
//----------------------------------------------------------
1.7131581, 0.0000000, -67.0721419
5.2486686, 0.0000000, -70.6076524
8.7841529, 0.0000000, -74.1431367
9.1457864, 0.0000000, -74.5047703
9.0714713, 1.7695448, -76.2000000
Or this...
Feature,CAD_CLOUD
RefFrame,Use Current
Data#,2205
Probe Diameter,0.00000
, X, Y, Z
P1,1.71316,0.00000,-67.07214
P2,5.24867,0.00000,-70.60765
P3,8.78415,0.00000,-74.14314
P4,9.14579,0.00000,-74.50477
P5,9.07147,1.76954,-76.20000
Unfortunately the data coming from Automeasure software is a bit strange since it contains Point label that only includes Numeric text, thus confusing the CMM-Manager import mechanism that is trying to automatically distinguish a difference between numeric point data and alpha-numeric point labels. Automeasure file looks something like this:
1,1.71316,0,-67.07214
2,5.24867,0,-70.60765
3,8.78415,0,-74.14314
4,9.14579,0,-74.50477
5,9.07147,1.76954,-76.2
6,5.53587,5.30515,-76.2
7,2.00038,8.84064,-76.2
So now we use VBScript to Read, edit, and then re-write the file from Automeasure so that it is usable in CMM-Manager. In summary this Script prompts user for input file, reads input file, removes blank lines, ignores lines that start with "//", and then writes each line to a new file while adding "P" to the Point Label. Here is the script:

Code: Select all

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWShell = CreateObject("WScript.Shell")
Set ChooseFile = objWShell.Exec( "mshta.exe ""about: <input type=file id=X><script>X.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(X.value);close();resizeTo(0,0);</script>""" )
MyFile = ChooseFile.StdOut.ReadAll

'strip out Carriage Return
ChrPos = InStr(MyFile, Chr(13))
ChrPos = ChrPos -1
MyFile = Left(MyFile, ChrPos)

'Create file for writing
MyFileOut = "C:\ProgramData\Nikon\xyz_data_file.dat"
Set objFileOut = objFSO.CreateTextFile(MyFileOut)

' Open file and read all lines
Set objFile = objFSO.OpenTextFile(MyFile, 1)
i = 0
          Do While objFile.AtEndOfStream = False
               MyLine = objFile.ReadLine
           If Left(MyLine, 2) = "//" Then
           Else
               MyLine = "P" + CStr(MyLine)
               objFileOut.WriteLine(MyLine)
                i = i + 1
            End If
            Loop
objFile.Close      'close input file
objFileOut.Close  'close output file
When you run the CMM-Manager program you will see the standard Windows file selection dialog, like this:

import_points_2.jpg

Once the script runs you should see points imported automatically. The remaining program could include Alignment, Feature Constructions, Reporting, etc. It is typical to use CAD for Best-Fitting and Comparison in these cases. See attached example file including Automeasure XYZ Point data file.

Enjoy ;)
You do not have the required permissions to view the files attached to this post.

Post Reply