face.CalculateFacetsAndTextureMap throw exception

face.CalculateFacetsAndTextureMap throw exception

pfk
Enthusiast Enthusiast
482 Views
2 Replies
Message 1 of 3

face.CalculateFacetsAndTextureMap throw exception

pfk
Enthusiast
Enthusiast

Hi

 

I have a valid Face from a SurfaceBody, and the call to face.CalculateFacetsAndTextureMap throws the following exception....

 

[System.Runtime.InteropServices.COMException] = {"Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"}

 

The code I'm using is:

 

                foreach (Face face in surfaceBody.Faces)
                {
                    double tolerance = 0.1;
                    int vertexCount = 0;
                    int facetCount = 0;
                    double[] vertexCoordinates;
                    double[] normalVectors;
                    int[] vertexIndexes;
                    double[] textureCoordinates;
                    face.CalculateFacetsAndTextureMap(tolerance, out vertexCount, out facetCount, out vertexCoordinates, out normalVectors, out  vertexIndexes, out textureCoordinates);
                }

 Can anyone guide to me what I am doing wrong pls?

 

Thanks

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

adam.nagy
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

You would need to initialize the input arrays: http://adndevblog.typepad.com/manufacturing/2013/05/type-mismatch-when-calling-calculatefacetsandtex...

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes
Message 3 of 3

pfk
Enthusiast
Enthusiast

I confirm that this fixes the issue.  Thank you so much for taking the time to add a blog entry on this.  A reminder for other people implementing this function, the vertex indexes start at 1, not 0 (this is in the documentation, but easy to miss).

0 Likes