Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

CWIMAQdx.GetAttribute can't get attributes in string or U32 format.

Solved!
Go to solution

I am trying to read all the attributes from a Gige camera. I can get the attributes in I64, F64 and boolean fromat. But when the type is string or U32, the returned 'attribute' object is 'NULL". Can anyone let me know what's wrong with my code?

 

Thanks

 

object attribute = new object();

if(sType=="I64")

{

                   CWIMAQdx.GetAttribute(sid, attributeInformationArray[i].Name, CWIMAQdx.ValueType.I64, out attribute);

                    sValue =Convert.ToInt64(attribute).ToString();

 }

               

if (sType == "String")

{

                   CWIMAQdx.GetAttribute(sid, "attributeInformationArray[i].Name", CWIMAQdx.ValueType.String, out attribute);

                    sValue =Convert.ToString(attribute);

}

               

if (sType == "U32")

{

                   CWIMAQdx.GetAttribute(sid, "attributeInformationArray[i].Name", CWIMAQdx.ValueType.U32, out attribute);

                    sValue =Convert.ToUInt32(attribute).ToString();

}

0 Kudos
Message 1 of 3
(3,487 Views)
Solution
Accepted by topic author mmssdd

Is it just a coincidence that in your second two cases (that you mentioned aren't working) your example code appears to be passing the constant "attributeInformationArray[i].Name" rather than the actual attribute name?

 

Eric

0 Kudos
Message 2 of 3
(3,477 Views)

Thanks for noticing the mistake of passing constant "attributeInformationArray[i].Name" rather than the actual attribute name.

0 Kudos
Message 3 of 3
(3,472 Views)