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
  • Hello,

    I also used getfieldvalue before but ran into difficulties just like you did.

    I then switched to “command.getText()”. With the right code word, this command will give you exactly the values that are displayed in the edit window. Works better I think.​


    to the index...
    I think it's mostly 1 based.
    If you specify 0 or -1, instead of giving an error message, the largest or first index will be displayed. There are also fields that do not have an index; 0 is usually specified there

    If you export a pcDMIS program as "Basic" you will get, among other things, a bunch of command.setText() commands, the correct index is in there. You just need to convert these commands into getText, that gives you a good overview of where exactly the index is 0 or index 1..n is used​
Reply
  • Hello,

    I also used getfieldvalue before but ran into difficulties just like you did.

    I then switched to “command.getText()”. With the right code word, this command will give you exactly the values that are displayed in the edit window. Works better I think.​


    to the index...
    I think it's mostly 1 based.
    If you specify 0 or -1, instead of giving an error message, the largest or first index will be displayed. There are also fields that do not have an index; 0 is usually specified there

    If you export a pcDMIS program as "Basic" you will get, among other things, a bunch of command.setText() commands, the correct index is in there. You just need to convert these commands into getText, that gives you a good overview of where exactly the index is 0 or index 1..n is used​
Children
No Data