In my tests, sometimes Robot acepts 9 decimal places, sometimes 6, sometimes 3, ...
I've made a table in excel with 20 rows (in column 3).
In the first row I put 123456789123456
In the second row I put 123456789123456 / 10
In the third row I put 123456789123456 / 100
and so on...
In the 20th row I put 123456789123456 / (10^19)
Running the code below, 20 nodes are created in Robot and column 4 is filled with the coordinates obtained.
Im' getting some curious results...
Dim robapp As irobotapplication
Set robapp = New RobotApplication
Dim X As Double
Dim oNode As IRobotNode
For I = 1 To 20
X = Cells(3 + I, 3)
robapp.Project.Structure.Nodes.Create I, X, 0, 0
Set oNode = robapp.Project.Structure.Nodes.Get(I)
Cells(3 + I, 4) = oNode.X
That's true, but something must be missing.
I try what you suggest and I get the same result.
Then I went to robot and executed the command "zoom all".
Then I repeated the process in excel and I got different results: the coordinates became with only 5 decimal places.
This is something that happened in other situations.
A second exportation to robot, after a "zoom all" command, results in different coordinates. !!!?
There must be a clear criteria when robot rounds the coordinates.
Did you got any idea from the Development people?
Yes, you are right. Zoom all command calculates interal tolerance based on the farthest nodes.
This tolerance is also used in API.
If you have reasonable coordinates: max hundreds\ thousands of meters then accuracy should be up to 8 digits after comma.
In general it is recommended to create model as close as possible to 0,0,0 point not to see strange effects in Robot.
This should help:
Dim rud As RobotUnitData
Set rud = RobApp.Project.Preferences.Units.Get(I_UT_STRUCTUR
rud.Precision = 10
RobApp.Project.Preferences.Units.Set I_UT_STRUCTURE_DIMENSION, rud
Dim x As Double
Dim oNode As RobotNode
Dim n As Double
n = 123456789123456#
For I = 1 To 20
RobApp.Project.Structure.Nodes.Create I, n, 0, 0
n = n / 10
Set oNode = RobApp.Project.Structure.Nodes.Get(I)
Cells(I, 1) = oNode.x