hexagon logo

Inconsistencies Getting Field Values From Commands

I've been looking at how to get the field values from commands using GetFieldValue. There seem to be some inconsistencies depending on the command type and the type of value (array v. scalar).


1. For some fields like ID, if the command is not a DimensionCommand, HasField will return True for index values {-1, 0, 1, 2}. For DimensionCommand objects, {0, 1} return True. The value returned by calls to GetFieldValue will all be the same. Why does this happen? I would expect ENUM_FIELD_TYPES.ID to be a scalar value and thus only have a value at 0 (or 1 if we're 1-indexing).

2. Are arrays 0 or 1 indexed? It seems like certain fields have values from [1, N] while others have values from [1, N] as well as at 0. An example, for ENUM_FIELD_TYPES.THEO_X, if GetDataTypeCount returns 6, there will be values at {1, 2, 3, 4, 5, 6}, but also a value at 0, which for a Plane will be the location of the Plane. Other fields don't have values at 0 but do have an array of values.

3. GetDataTypeCountUniqueIndex Always returns 0

I'm not sure what the pattern is here. I feel like I'm missing something about how data in fields are represented. Any ideas why I would be seeing the above behavior?

Does does PC-DMIS distinguish scalar and array values? Why do some fields seem to be 1-indexed while also having values at the index 0?

Parents
  • Interesting. It would be really nice if the API was clear, functional and consistent. Seems to be quite a guessing game at this point unless I'm missing something about how to understand what indices exist for different fields and whether something is scalar or array-like.

    index | has field? | field value
    -1 F FALSE
    0 T 0 (has field should probably be false)
    1 T 23.223
    2 T 25.323
    3 T 0
    4 T 0
    (all zeroes from here on)​
    


    Here the field is MEAS_X, which doesn't show up in the VB version and GetDataTypeCount returns 0.
Reply
  • Interesting. It would be really nice if the API was clear, functional and consistent. Seems to be quite a guessing game at this point unless I'm missing something about how to understand what indices exist for different fields and whether something is scalar or array-like.

    index | has field? | field value
    -1 F FALSE
    0 T 0 (has field should probably be false)
    1 T 23.223
    2 T 25.323
    3 T 0
    4 T 0
    (all zeroes from here on)​
    


    Here the field is MEAS_X, which doesn't show up in the VB version and GetDataTypeCount returns 0.
Children
No Data