cancel
Showing results for 
Search instead for 
Did you mean: 

Tecnomatix.Engineering.TxUnknownErrorException by retrieve color of Tx2Or3DimensionalGeometry

Valued Contributor
Valued Contributor

Hello!

 

I get the TxUnknownErrorException by trying to read the color of the Tx2Or3DimensionalGeometry.

This is my code, with which I can reproduce the exception:

 

Dim devices As TxObjectList = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(New TxTypeFilter(GetType(TxDevice)))

Dim deviceObj As ITxObject = devices.First()

Dim testDevice As TxDevice = deviceObj

Dim geometries As TxObjectList = testDevice.GetAllDescendants(New TxTypeFilter(GetType(Tx2Or3DimensionalGeometry)))

For Each geometryobj As ITxObject In geometries

Dim geometry As Tx2Or3DimensionalGeometry = geometryobj

Dim color As TxColor = geometry.Color

Next

 

Exception:

Message: Error in the application.

Source: Implementation

StackTrace:  

at Tecnomatix.Engineering.Implementation.TxRose.GetObjectColor(TxObjectImpl objImpl)
at Tecnomatix.Engineering.TxGeometry.get_Color()

at ASE.... (my code)

 

What is wrong with this device?

5 REPLIES

Re: Tecnomatix.Engineering.TxUnknownErrorException by retrieve color of Tx2Or3DimensionalGeometry

Siemens Genius Siemens Genius
Siemens Genius

Hi,

 

Just by examining your code I'm uncertain why this should not work. Might be it relates to some specific geometry your device contains. Does this happen with any device?

 

I can suggest to turn on Tecnomatix Application Logs via Tx Doctor, and post the last log errors after you run your code.

Another suggestion (might not work, but worth a try) is to try the ITxDisplayableObject interface instead of Tx2Or3DimensionalGeometry. I.e.:

Dim geometries As TxObjectList = testDevice.GetAllDescendants(NewTxTypeFilter(GetType(ITxDisplayableObject)))

For Each displayableObj As ITxDisplayableObject In geometries

  Dim color As TxColor = displayableObj.Color

Next

 

Kind regards,

Zachi

Re: Tecnomatix.Engineering.TxUnknownErrorException by retrieve color of Tx2Or3DimensionalGeometry

Valued Contributor
Valued Contributor

Zachi,

 

apologize for a delay. I have done some experiments with this issue. I get the error with ITxDisplayableObject also.

Please find the application log to the error in the attachment.

 

Berst regards

Witalij.

Re: Tecnomatix.Engineering.TxUnknownErrorException by retrieve color of Tx2Or3DimensionalGeometry

Valued Contributor
Valued Contributor
I have forgotten to mention, that I get this error with different JT’s. This JT’s are created by Siemens JT Translator bidirectional.
Witalij.

Re: Tecnomatix.Engineering.TxUnknownErrorException by retrieve color of Tx2Or3DimensionalGeometry

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi,

 

Color property returns only the instance (engineering) color of the object (if any), otherwise it throws exception (the one that you got).

Instead you can use the GetColors() method of ITxDisplayableObject that returns also the prototype colors if no instance colors are defined for the object.

 

Re: Tecnomatix.Engineering.TxUnknownErrorException by retrieve color of Tx2Or3DimensionalGeometry

Valued Contributor
Valued Contributor

Hi,

 

how can I check is the geometry an instance object or no before I try to get a color? Just put this operatio in try catch block? I n case of many geometries it wil make a performance problem.

 

Witalij.