Unit Confusion


#1

 

 

I’m confused…

What format does the XYZ Distance node output? In the attached image, the Watch node from the XYZ Distance node shows a list that is the same as the Watch node from the Feet to Meters node. How can the output be both a number, and a foot value that can be converted to the same value in meters? That make no sense.

And the only way I am able to compare the XYZ Distance list to a Length in feet is to convert the length from Meters To Feet. The same thing happens if I substitute a Number node for the Length node.

This has got to be a bug… either that or I’m going slightly crazy.

Can someone shed some light on what’s going on here?

Thanks.
Dynamo_Q


#2

Hi Greg—there are a few things going on here, and I agree that it’s confusing. Let me explain how it works now and get your feedback.

  1. The first is that XYZs and XYZ Distance nodes now always output a length, even if the inputs were numbers. This means that depending on your length display settings, you will see in a Watch from XYZ Distance, potentially different numbers as you toggle between show data and show raw data, where “show raw data” will always give the length’s numerical value in meters. The default display setting for a watch window is to show you the raw data, which is the length in meters. Toggling this will show you the feet-numerical value (as that’s the setting you are using), and for clarity, will append the text “ft.”

  2. The formula node, which is also hidden inside the Feet to Meters custom node available on the Package Manager, does not read units, so when you feed it a length, it will take the numerical equivalent in the unit system you are using and always give you back a number at the end. Feeding in “12 inches” (raw data = 0.305) to a formula node will read 12 if using inches, 1 if using feet, or 0.305 if using meters.

In your example, at the top, part of the confusion is that Watch displays raw data by default, which matches the value of a length in meters and the rest is due to the fact that you are viewing a length to begin with but a number to end with since your data passed through a formula node. See, for example:

01

  1. “Length” is the data type, not “feet,” “meters,” “inches,” etc, so when you have 1.5ft it is already simultaneously 0.4572m. What happens when you try to convert a length depends on how you tried to do it. If you use a formula node, it strips the units from the value so you are left with a number, which is, indeed, the meter equivalent as a number (in your example, you converted feet from meters to feet, which explains the particularly weird value—you probably meant to use Feet to Meters). You can preserve the unit information by not using a formula node.

02

In the second, lower part, of your definition is a variation on that earlier theme. The length “1.5 ft” is behaving as a number when it comes out of the Meters to Feet node because inside a formula node is multiplying by 3-something. You are using a formula node again to effectively compare “4.921” to the various lengths coming from XYZ Distance, which converts them to numbers as well, using the number of their feet-equivalent since you are viewing lengths in feet.

Your comparison on the bottom would make more sense if you compare the lengths directly, without the conversion factor which is actually muddying the waters.

03

I hope this helps. As a way to make this less confusing—this was an excellent question, btw—which of these things do you think should change and how:

  1. - XYZ and XYZ Distance always produce a length
  2. - The Formula node does not operate mathematically on units (we would love to do this, but it will require a massive rewrite of the code, and would be a ways off)
  3. - You have the option to see raw data at all
  4. - The Watch node shows you the raw data by default

Or any other reactions would be very helpful!


#3

Hi, what build are you running? in 0.6.3 and latest, you have a unit settings that is a user choice. distance and xyz will be displayed in the chosen unit. But I know that in some case (can’t exactly remember where), output from nodes is still in the core unit of Revit, Imperial feet.


#4

Colin, in my opinion the Watch node should by default show data with their units - to me the fact that it shows raw data by default has been the most confusing aspect since units were introduced.


#5

Watch node now shows unit data by default.


#6

That’s great news - thanks!