I see, it seems like there are at least a couple options then:
1) The getValueAs() method could be made to "succeed" if it's run on an object where the Unit is (0,0,0,0,0,0,0,0). I feel like this is maybe a little too sloppy.
2) Could make a new method "hasUnit()" that returns a boolean like:
Code: Select all
>>> withoutUnit = u'0.000009'
>>> tc = FreeCAD.Units.Quantity(withoutUnit)
But, I don't really understand what the situation is, that's creating objects that have Unit == (0,0,0,0,0,0,0,0) when they really mean something like ThermalConductivity. It feels like there might be an earlier problem to be solved, which would prevent the issue you're having. -Ian-