Thursday, 27 November 2008

Copy versus Array

It came to my attention recently that two different methods of placing an object in what should be the same places actually might end in slightly different results.

I'll explain by way of example. I had an office space into which I imported a .dwg of a cluster of desks. This instance was to be copied 3 further times and the copies were to be placed 3000mm apart, like this:



I did it the slightly laborious way by copying and moving. My clearly much cleverer colleague went for the more efficient array option. When I came to analyze the files using the BoundingBox property I discovered that what we ended up with were ever so slightly differently placed instances. And by ever so slightly I mean a different value in the 11th decimal place.

OK so perhaps I'm picking at straws here, but it had a serious impact on the reliability of what I was trying to do, which was to extract data as strings from two files to two databases, and compare this data looking for precise matches.

My solution was to use 

CDbl(value).ToString("#.000")
 

throughout, as I realised that such accuracy simply isn't required for my purposes.

But why does Revit do this? My guess is its simply a by-product of rounding in Revit's array code, or cumulative rounding from my clumsier but accurate moving and copying. I haven't delved any further, but I would hope if its the former that its not cumulative with the size of an array, as this would mean greater inaccuracies the more objects that are arrayed.

No comments:

Post a comment

Comments are moderated, so you'll have to wait a little bit before they appear!