public void GenerateMultiBodyOutput() { Multibody.Model mbdModel = new Multibody.Model(); mbdModel.Name = Name; // Units mbdModel.Units = new Multibody.ModelUnits(); mbdModel.Units.Angle = Multibody.ModelUnitsAngle.rad; mbdModel.Units.Force = "newton"; mbdModel.Units.Length = "mm"; mbdModel.Units.Mass = "kg"; mbdModel.Units.Time = "sec"; // Loads mbdModel.Loads = new Multibody.ModelLoads(); mbdModel.Loads.Motion = MotionList.ToArray(); if (Gravity != null) { mbdModel.Loads.Gravity = new Multibody.ModelLoadsGravity(); mbdModel.Loads.Gravity.Active = Multibody.ModelLoadsGravityActive.on; mbdModel.Loads.Gravity.Value = String.Format("{0};{1};{2}", Gravity.X, Gravity.Y, Gravity.Z); } // Simulation mbdModel.Simulation = new Multibody.ModelSimulation(); mbdModel.Simulation.Steps = SimulationStep.ToString(); mbdModel.Simulation.Time = (float)SimulationTime; // Terrain if (!String.IsNullOrEmpty(TerrainFileName)) { mbdModel.Terrain = new Multibody.ModelTerrain(); mbdModel.Terrain.FileName = TerrainFileName; } // Ground if (!String.IsNullOrEmpty(GroundCyphyID)) { mbdModel.Ground = new Multibody.ModelGround(); mbdModel.Ground.CyphyId = GroundCyphyID; } if (ContactList != null) { mbdModel.Contact = ContactList.ToArray(); } if (Scripts != null) { mbdModel.Script = Scripts.ToArray(); } mbdModel.SerializeToFile(Path.Combine(OutputDirectory, "Analysis_MBD.xml")); }
public void GenerateMultiBodyOutput() { Multibody.Model mbdModel = new Multibody.Model(); mbdModel.Name = Name; // Units mbdModel.Units = new Multibody.ModelUnits(); mbdModel.Units.Angle = Multibody.ModelUnitsAngle.rad; mbdModel.Units.Force = "newton"; mbdModel.Units.Length = "mm"; mbdModel.Units.Mass = "kg"; mbdModel.Units.Time = "sec"; // Loads mbdModel.Loads = new Multibody.ModelLoads(); mbdModel.Loads.Motion = MotionList.ToArray(); if (Gravity != null) { mbdModel.Loads.Gravity = new Multibody.ModelLoadsGravity(); mbdModel.Loads.Gravity.Active = Multibody.ModelLoadsGravityActive.on; mbdModel.Loads.Gravity.Value = String.Format("{0};{1};{2}", Gravity.X, Gravity.Y, Gravity.Z); } // Simulation mbdModel.Simulation = new Multibody.ModelSimulation(); mbdModel.Simulation.Steps = SimulationStep.ToString(); mbdModel.Simulation.Time = (float)SimulationTime; // Terrain if (!String.IsNullOrEmpty(TerrainFileName)) { mbdModel.Terrain = new Multibody.ModelTerrain(); mbdModel.Terrain.FileName = TerrainFileName; } // Ground if (!String.IsNullOrEmpty(GroundCyphyID)) { mbdModel.Ground = new Multibody.ModelGround(); mbdModel.Ground.CyphyId = GroundCyphyID; } if (ContactList != null) mbdModel.Contact = ContactList.ToArray(); if (Scripts != null) mbdModel.Script = Scripts.ToArray(); mbdModel.SerializeToFile(Path.Combine(OutputDirectory, "Analysis_MBD.xml")); }