Editing Constraints of parts in C#

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to build a c# program where I can test a simulation for a robot project
I have made angle constraints in inventor and now I want to be able to send numbers to specific joint.
With the code listed below I can get all the constraints from a selected part and get the name of the specific constraints.
I find it confusing that most of the documentation is in VB so this is what I have discovered on my own, perhaps this isn't at all the way to do it. So any help or suggestion, even an entirely differend approach is more than welcome.
kind regards,
Maarten Witteveen
Inventor.SelectSet selSet=asmDoc.SelectSet;
try
{
Inventor.ComponentOccurrence compOcc;
//getting all objects from the selection in inventor
foreach (object obj in selSet)
{
compOcc = (Inventor.ComponentOccurrence)obj;
//loops through entire list of constraints
for (int i = 1; i < compOcc.Constraints.Count+1; i++)
{
if (compOcc.Constraints[i].Name == "Angle:4")
{
Console.WriteLine("got here");
//get current value of angle:4 and set to desired position
//update view
}
}
}
}