1300 / 100 = 5,118

When I create a DC attribute formula that adds two length attributes, divides the result by 100 and displays the result as a decimal number (to get rid of the idiotic full spelling out of the units) the result is as shown in the title. There is a beautiful inch lurking somewhere even if I didn’t ask for it to be there. Sigh.

Anssi

are the particular attributes individually set in their cell to cm via => rather than just the general rule on the top of the form? as digits as text are “seen” as inches

The ratio 5118/130 looks suspiciously like the length of a metre in inches. Mixed units, I expect.

No, all my attributes are in centimeters. But when I set the attribute to display the result as a decimal number, I get this. What I expected was just that the result value would be stripped of the unit string so that 1,234 Meters would become a plain 1,234.

Anssi

But DCs (like SU generally) store everything internally in decimal inches, and DCs don’t seem to respect the model units settings. I very strongly suspect that something in the way you read a text box or an internal constant is assuming it’s inches.

This is just one of the unit related DC bugs. If you set SketchUp to not display your units format in ModelInfo>Units, then the whole house of cards collapses and all DCs revert to displaying Inches, whatever their internal unit is set to. It is annoying, as standard practice with metric units is that the unit string is always suppressed (neither do Imperial users spell out their Feet and Inches in their dimension strings). DC-s cannot even use the abbreviations (m,cm,mm).

Anssi

Can you divide one length by another length, both in cm? Probably not, I suppose.

Yes I can. Mathematically, of course, the result ought to be a plain number, but Sketchup retains the unit.

Anssi

I just tried this…
I take LenX and LenY [inches] - let’s say 1000 and 300.
Add then together [giving 1300"],
then divide by 100
I get the [expected] answer of 13.
If I make permutations of the units/decimals etc I still get the same expected result !

Can you post a simple example that displays your issue ?
I haven’t been able to replicate it…

You used Inches. My component has Centimeters as the internal unit. It makes no difference what unit the component is set to display in the Component options dialog, they will show the right result. This is what happens if I set a centimeter field to display as a plain decimal number to the user.

Anssi

If I use cm values for LenX and LenY they end up being show in inches anyway.
So I don’t see the issue ?
If you make a reference to these lengths and then do the maths what happens ?
I can’t get the effect.
Perhaps I’m missing something…

I got better results when making sure that the result was a string instead of a number.
This is what I got - I am investigating a DC approach to level markers (labels added in LayOut):

Users should have a better control of unit and number formatting - I got it to work but using what I think is a workaround.

I just noticed that I got decimal dots instead of commas as specified by my OS.

Anssi

I had the same problem in Sketchup 2017 it returns result in inches
(1300 cm / 100cm = 13)
Multiply the result it with an inch “2.54” and you get 13
(1300cm/100cm=5,118")*2,54 = 13

Basically you need to convert to inches, or multiply the result with an inch, every time to overcome this problem.