incorrect return value from API ComponentOccurrence.Transformation.Translation

incorrect return value from API ComponentOccurrence.Transformation.Translation

M.Goodner
Explorer Explorer
226 Views
2 Replies
Message 1 of 3

incorrect return value from API ComponentOccurrence.Transformation.Translation

M.Goodner
Explorer
Explorer

Hello.. I am currently writing some software to automate various tasks.

 

The issue I'm having is I seem to be getting bogus information from the transformation matrix on SOME components and it makes ZERO sense...

 

The workflow in a nutshell is:

 

Get Application pointer -> InventorApplicationPointer

Get pointer to active document (ActiveDoc = InventorApplicationPointer.ActiveDocument)

Enumerate through active document occurrences  (ActiveDoc.ComponentDefinition.Occurrences)

 

Once I find the object I'm looking for, I gather information about it including its position, size via bounding box, rotation (calculated via matrix data), ect, ect..

 

I have attached two images that show a couple of things. The first image shows I have selected the occurrence and to verify my suspicion, output the components of the vector to a dialog box. There you see

X=462

Y=58.551

Z=7.17 <= THIS IS NOT CORRECT..

 

Also on image one, you can see when I measure from the components origin point to the assembly origin point, I get the correct values.

 

Now, I created a breakpoint to inspect the output of ComponentOccurrence.Transformation.Translation

which you can see in image two. The return value on the Z component is -1.82 with a large amount of significant figures which is NOT correct..

 

Anybody know what's going on? The measure tool is obviously able to obtain the correct data.. So where is it getting the component position from if not the transformation matrix?

 

any help would be greatly appreciated.. this has brought me to a complete halt programming wise.. 

 

THANK YOU!

 

 

 

0 Likes
Accepted solutions (1)
227 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor
Accepted solution

This is not a bug. See the end of value 7,17...E-15 it means 0,0000000000000717 and this is due to numeric stability and precision.

0 Likes
Message 3 of 3

M.Goodner
Explorer
Explorer

Michael,

 

Thanks to your input, I applied a round to the transform output and im getting something I can work with.. Thank you for leading me in the right direction!

0 Likes