Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So at this point, I am lost.
I've managed to create and control parts using a 3rd program written in c# and inventors API. However, now I can't seem to figure out how to constrain two objects. So here's my setup:
Basically, I'm pulling the occurrences in the assembly and getting their faces. Then using that, constraining two faces together. Ultimately no user interaction can happen during this process.
ComponentOccurrences CompOccurrences; AssemblyComponentDefinition AsmCompDefinition; AsmCompDefinition = m_AssemblyDocument.ComponentDefinition; CompOccurrences = AsmCompDefinition.Occurrences; //grab occurrence 1 ComponentOccurrence CompOccurrence = CompOccurrences[1]; string OccurrenceName = CompOccurrence.Name; Console.WriteLine(OccurrenceName); object oFace1 = CompOccurrence.SurfaceBodies[1].Faces[6]; //grab occurence two ComponentOccurrence CompOccurrence2 = CompOccurrences[2]; object oFace2 = CompOccurrence2.SurfaceBodies[1].Faces[6]; string OccurrenceName2 = CompOccurrence2.Name; Console.WriteLine(OccurrenceName2); double offset = 0; Console.ReadKey(); Oconstraint.Constraints.AddMateConstraint(oFace1, oFace2, offset);
when I run this I get an exception on the Oconstraint.Constraints call. Any help would be greatly appreciated!
Solved! Go to Solution.