Dynamic Simulation - Create DSJoint
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am looking for some help with creating new dynamic simulation joints programmatically. Any help appreciated - thank you.
Autodesk Inventor Professional Build: 353, Release: 2021.3.1
Here is my method so far (mostly a copy from the VBA dynamic simulation example from the chm help):
public static void SetupDynamicSimEnv(Inventor.AssemblyDocument asmDoc)
{
//the dynamic sim environment active
Inventor.UserInterfaceManager UIManager = GlobalVar.InvApp.UserInterfaceManager;
//check if the active environemnt is dynamic sim, if not then set it
if (UIManager.ActiveEnvironment.InternalName != "DynamicSimulationEnvironmentInternalName")
{
//get the environment manager
Inventor.EnvironmentManager environmentManager = asmDoc.EnvironmentManager;
Inventor.Environment dsEnv = UIManager.Environments["DynamicSimulationEnvironmentInternalName"];
environmentManager.SetCurrentEnvironment(dsEnv);
}
//get simulation manager from the assembly
Inventor.SimulationManager simManager = asmDoc.ComponentDefinition.SimulationManager;
//get the first simulation
Inventor.DynamicSimulation sim = simManager.DynamicSimulations[1];
Inventor.DSJoints simJoints = sim.DSJoints;
Inventor.DSJoint simJoint = simJoints[1];
Inventor.DSJointDefinition simJointDef = simJoint.Definition;
//Inventor.DSJointDefinition newJOintDef = simJointDef.Copy();
//Inventor.DSJointDefinition newJointDef = new Inventor.DSJointDefinition();
I am stuck on the last two commented lines (two routes that I can see implementing). I found the DSJointDefinition.Copy() method from the help .chm and I think that can help. I also see creating a new instance of a DSJointDefinition though that is a interface and believe I need to create a class instance to work with it (I'm not sure how to implement that yet, still learning c# there).
I am aware of the simulation settings (automatically convert constraints) checkbox and have played around with converting assembly constraints and assembly joints, though the conversions are < 100%. I came across a whitepaper from Autodesk University 2013 "Speeding Up Dynamic Simulation and Animation Workflows Using the New Joint Tool in Autodesk® Inventor®" Sergio Duran – SolidCAD Solutions MA2749. It describes that assembly joints can be automatically converted to dynamic simulation joints (figure 19, page 20). This method would work for me (I am successful in creating regular assembly joints with the API), but the assembly joints do not convert to simulation joints (Again, having played around the automatic convert constraints settings checkbox).