private void CallCAD( MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param) { Type tCAD = Type.GetTypeFromProgID("MGA.Interpreter.CyPhy2CAD_CSharp"); if (tCAD == null) { GMEConsole.Info.WriteLine("CyPhy2CAD is not installed on your machine."); return; } ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp"); //cyPhy2CAD.WorkflowParameters["prepIFab"] = "true"; cyPhy2CAD.Initialize(project); cyPhy2CAD.InterpreterConfig = cadSettings; // TODO cyPhy2CAD.MainParameters.config.CADAnalysis = true; //cyPhy2CAD.MainParameters.ConsoleMessages = ; cyPhy2CAD.MainParameters.Project = project; cyPhy2CAD.MainParameters.CurrentFCO = currentobj; cyPhy2CAD.MainParameters.SelectedFCOs = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs")); cyPhy2CAD.MainParameters.StartModeParam = param; cyPhy2CAD.MainParameters.OutputDirectory = this.OutputDirectory; cyPhy2CAD.MainParameters.ProjectDirectory = this.ProjectRootDirectory; cyPhy2CAD.MainParameters.Traceability = (META.MgaTraceability) this.result.Traceability; cyPhy2CAD.Main(); this.componentParameters["results_zip_py"] = cyPhy2CAD.result.ZippyServerSideHook; }
public void Run() { AVM.DDP.MetaAvmProject avmProj; var terr = this.Project.BeginTransactionInNewTerr(); try { this.CurrentObj = this.Project.GetFCOByID(this.m_CurrentObjId); // This can only be a testbench at this point ISIS.GME.Dsml.CyPhyML.Interfaces.TestBenchType tb = ISIS.GME.Dsml.CyPhyML.Classes.TestBenchType.Cast(this.CurrentObj as MgaObject); this.CallFormulaEvaluator(this.CurrentObj); // FIXME: KMS: For multijobrun, is this necessary? avmProj = AVM.DDP.MetaAvmProject.Create(Path.GetDirectoryName(OriginalProjectFileName), Project); avmProj.SaveSummaryReportJson(this.OutputDirectory, this.CurrentObj); avmProj.SaveTestBenchManifest(this.OutputDirectory, tb, Dependencies); avmProj.UpdateResultsJson(this.CurrentObj, this.OutputDirectory); // TODO: test bench export?? } finally { this.Project.AbortTransaction(); } var currentProjectDir = Path.GetDirectoryName(this.Project.ProjectConnStr.Substring("MGA=".Length)); ComComponent interpreter = new ComComponent(ProgId); // Read the copied over configuration (the original one may be changed and/or opened). if (interpreter.InterpreterConfig != null) { interpreter.InterpreterConfig = META.ComComponent.DeserializeConfiguration(currentProjectDir, interpreter.InterpreterConfig.GetType(), interpreter.ProgId); } this.Interpreter = interpreter; interpreter.Initialize(Project); interpreter.WorkflowParameters = WorkflowParametersDict; interpreter.SetWorkflowParameterValues(); interpreter.MainParameters.OutputDirectory = this.OutputDirectory; interpreter.MainParameters.ProjectDirectory = Path.GetDirectoryName(this.OriginalProjectFileName); interpreter.MainParameters.ConsoleMessages = false; interpreter.MainParameters.Project = Project; interpreter.MainParameters.CurrentFCO = CurrentObj; interpreter.MainParameters.SelectedFCOs = SelectedObjs; interpreter.MainParameters.StartModeParam = ParamInvoke; interpreter.Main(); this.RunCommand = interpreter.result.RunCommand; this.Labels = interpreter.result.Labels; this.BuildQuery = interpreter.result.BuildQuery; this.ResultsZip = interpreter.result.ZippyServerSideHook; this.Project.BeginTransaction(terr); try { var manifest = AVM.DDP.MetaTBManifest.OpenForUpdate(this.OutputDirectory); manifest.AddAllTasks(ISIS.GME.Dsml.CyPhyML.Classes.TestBenchType.Cast(this.CurrentObj), new ComComponent[] { interpreter }); manifest.Serialize(this.OutputDirectory); // if some magic happens in the test bench and some interpreters would update the model // and they are NOT updating the summary file accordingly we will do it here. // RISK: if any interpreter wants to update the summary file like CyPython this could mess up the values. this.CallFormulaEvaluator(this.CurrentObj); avmProj.SaveSummaryReportJson(this.OutputDirectory, this.CurrentObj); } finally { this.Project.AbortTransaction(); } }