Hi,
Here is my C# code:
private void Button1Definition_OnExecute(NameValueMap context)
{
try
{
// get current document
PartDocument oCurrentDoc = m_inventorApplication.ActiveDocument as PartDocument;
PartComponentDefinition oCompDef = oCurrentDoc.ComponentDefinition;
SurfaceBody body = oCompDef.SurfaceBodies[1];
if (body == null)
return;
int VertexCount, SegmentCount;
int[] VertexIndices;
double[] VertexCoordinates;
double v = body.get_Volume(90); // <---- returns fine
body.CalculateStrokes(.1, out VertexCount, out SegmentCount, out VertexCoordinates, out VertexIndices);
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.ToString());
}
}
The line:
body.CalculateStrokes(.1, out VertexCount, out SegmentCount, out VertexCoordinates, out VertexIndices);
ALWAYS generates a COMException 0x80020005 (Type mismatch). I am trying to figure out if my paramaters are wrong... Any help is greately appreciated.
Thank you.
-Serge
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
I updated my copy of winodw 7 with all system updated (optional or not). I went ton Autodesk's website and dwonloaded Inventor 2013 SP2, installed it, no luck. I would really appreciate if someone would maybe take a lo look at the project.... If it is not something obvious with the code, then maybe the project settings??? But then again, I used the project wizzard with no specai modifications... Ayways, please let me know if I can provide you need more information.
Please use initialized arrays:
int VertexCount; int SegmentCount; int[] VertexIndices = {}; double[] VertexCoordinates = {}; body.CalculateStrokes(.1, out VertexCount, out SegmentCount, out VertexCoordinates, out VertexIndices);
This works for me.
Can't find what you're looking for? Ask the community or share your knowledge.