Cancel
Showing results for 
Search instead for 
Did you mean: 

Feature attribute: Attribute type mismatch

Valued Contributor
Valued Contributor

Hi,

 

 

I'm coding on java, and I'm trying to run of a feature's attributes.

 

 

........
		try
		{
			switch (i_TheAttribute.type().ordinal())
			{
			case ValueType._INTEGER:
				Object obj = i_TheAttribute.getIntegerValue();
				break;
			case ValueType._STRING:
				Object obj = i_TheAttribute.getStringValue();
				break;			
			case ValueType._BOOL:
				Object obj = i_TheAttribute.getBoolValue();
				break;
			case ValueType._DOUBLE:
				Object obj = i_TheAttribute.getDoubleValue();
				break;
			case ValueType._POINT3:
				Object obj = i_TheAttribute.getPoint3Value();
				break;
			case ValueType._VECTOR3:
				Object obj = i_TheAttribute.getVector3Value();
				break;
			default:
Object obj = null } } catch (NXException e) { e.printStackTrace(); }
.......

 

Sometimes I get a nxopen.NXException: Attribute type mismatch.

How can it be if I always check that I'm asking the right value type?

Is it possible that if the current attribute is NULL, than I get the exception?

If this is the case, is there any way to avoid the exception?

 

Best reagrds,

Tom. 

 

6 REPLIES

Re: Feature attribute: Attribute type mismatch

Esteemed Contributor
Esteemed Contributor

A couple things...

In my C++ code, I have a check for AttributeTypeInvalid (not really sure what would lead to this, but I have a check for it in my "switch" block)

 

You might also want to check if it is "unset" (i.e. a catalog attribute that has not yet been given a value)

 

Ken

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Feature attribute: Attribute type mismatch

Valued Contributor
Valued Contributor

Thanks for the reply
How do I call the method that check if the wanted value is valid?

Re: Feature attribute: Attribute type mismatch

Esteemed Contributor
Esteemed Contributor

Its another "case" - like string or boolean.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Feature attribute: Attribute type mismatch

Valued Contributor
Valued Contributor

Sorry, but I didn't understand the answer fully.

When I'm doing

 

objectType.ordinal()

It will always get into a type case. the problem that it will get in even if the value is null and than I'll get an exception.

 

Do you mean that there is a method like objectType.isValid that check if the current value is valid?

Re: Feature attribute: Attribute type mismatch

Esteemed Contributor
Esteemed Contributor

Here's part of my C++ code:

switch (attrInfo[i].Type)
{
case NXObject::AttributeTypeInvalid:
	ECHO("       Type = invalid\n");
	break;
case NXObject::AttributeTypeBoolean:
	ECHO("       Type = Boolean, Value = %d\n", attrInfo[i].BooleanValue);
	break;
case NXObject::AttributeTypeInteger:
	ECHO("       Type = Integer, Value = %d\n", attrInfo[i].IntegerValue);
	break;
Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Feature attribute: Attribute type mismatch

Valued Contributor
Valued Contributor

No such property on

m_UFSession.param().askParamAttributes(i_IndexParameter)