public override bool Execute(ExecutionInfo exInfo = null) { Result = false; if (FilePath.IsValid && Write) { if (Options == null) { Options = new RobotConversionOptions(true); } Document.Model.GenerateNodes(new NodeGenerationParameters()); var robot = new RobotController(); robot.Message += HandleMessage; RobotIDMappingTable idMap = null; if (Document.IDMappings.ContainsKey(FilePath)) { idMap = Document.IDMappings[FilePath] as RobotIDMappingTable; } if (idMap == null) { idMap = Document.IDMappings.GetLatest(".rtd") as RobotIDMappingTable; } if (idMap == null) { idMap = new RobotIDMappingTable(); Document.IDMappings.Add(FilePath, idMap); } robot.UpdateRobotFromModel(FilePath, Model, ref idMap, Options); //robot.WriteModelToRobot(FilePath, Document.Model, ref idMap); robot.Close(); robot.Release(); Result = true; } return(true); }
public override bool Execute(ExecutionInfo exInfo = null) { var robot = new RobotController(); robot.Message += HandleMessage; RobotIDMappingTable idMap = new RobotIDMappingTable(); Model model = robot.LoadModelFromRobot(FilePath, ref idMap); Document = new ModelDocument(FilePath, model); robot.Close(); robot.Release(); Document.IDMappings[FilePath] = idMap; return(true); }
private void WriteModel(RobotController robot, AlertLog log) { log?.RaiseAlert("Writing Salamander model to Robot..."); RobotIDMappingTable idMap = new RobotIDMappingTable(); bool result = robot.WriteModelToRobot(FilePath, Document.Model, ref idMap, null, log); if (result) { robot.Close(); log?.RaiseAlert("Robot file written successfully."); } else { log?.RaiseAlert("Writing Robot file failed!", Nucleus.Alerts.AlertLevel.Error); } robot.Release(result); idMap.LinkToFile(FilePath); Document.IDMappings[FilePath] = idMap; idMap.SaveAsCSV(FilePath.AddNameSuffix("_Mapping", ".csv")); Result = result; }