Inheritance: IInterpreterConfiguration, IInterpreterPreConfiguration
Example #1
0
        public IInterpreterPreConfiguration PreConfig(IPreConfigParameters parameters)
        {
            var config = new PrepareIFabConfig();

            config.ProjectDirectory = parameters.ProjectDirectory;
            return(config);
        }
Example #2
0
        public IInterpreterResult Main(IInterpreterMainParameters parameters)
        {
            this.OutputDirectory      = parameters.OutputDirectory;
            this.ProjectRootDirectory = parameters.ProjectDirectory;

            result.RunCommand = "PrepareIFab.bat";
            result.Labels     = "Creo&&CADCreoParametricCreateAssembly.exev1.4&&" + JobManager.Job.DefaultLabels;

            PrepareIFabConfig config = (PrepareIFabConfig)parameters.config;

            cadSettings.AuxiliaryDirectory       = config.AuxiliaryDirectory;
            cadSettings.StepFormats              = config.StepFormats;
            cadSettings.OtherDataFormat.STLAscii = true;
            InvokeEx(parameters.Project, parameters.CurrentFCO, parameters.SelectedFCOs, parameters.StartModeParam);

            MgaGateway.PerformInTransaction(() =>
            {
                // TODO: this part needs to be refactored!
                string Parameters = parameters
                                    .CurrentFCO
                                    .ChildObjects
                                    .OfType <MgaReference>()
                                    .FirstOrDefault(x => x.Meta.Name == "WorkflowRef")
                                    .Referred
                                    .ChildObjects
                                    .OfType <MgaAtom>()
                                    .FirstOrDefault(fco => fco.Meta.Name == typeof(CyPhy.Task).Name &&
                                                    String.Equals(CyPhyClasses.Task.Cast(fco).Attributes.COMName, this.ComponentProgID, StringComparison.InvariantCultureIgnoreCase))
                                    .StrAttrByName["Parameters"];

                Dictionary <string, string> workflowParameters = new Dictionary <string, string>();

                try
                {
                    workflowParameters = (Dictionary <string, string>)Newtonsoft.Json.JsonConvert.DeserializeObject(Parameters, typeof(Dictionary <string, string>));
                    if (workflowParameters == null)
                    {
                        workflowParameters = new Dictionary <string, string>();
                    }
                }
                catch (Newtonsoft.Json.JsonReaderException)
                {
                }

                META.AnalysisTool.ApplyToolSelection(this.ComponentProgID, workflowParameters, this.result, parameters);
            }, abort: true);

            result.Success = true;
            return(result);
        }
 public IInterpreterPreConfiguration PreConfig(IPreConfigParameters parameters)
 {
     var config = new PrepareIFabConfig();
     config.ProjectDirectory = parameters.ProjectDirectory;
     return config;
 }