public CyPhy2CADPCB_Settings RetrieveWorkflowSettings(CyPhy2CADPCB_Settings settings, CyPhy.ComponentAssembly ca) { var validvisualizers = new List <String> { "step", "stp", "stl", "mix" }; if (String.IsNullOrWhiteSpace(settings.visualizerType)) { Logger.WriteWarning("VisualizerType workflow parameter is not set. Defaulting to STEP models."); settings.visualizerType = "STEP"; } if (!validvisualizers.Any(s => settings.visualizerType.ToLower().Contains(s))) { Logger.WriteError("CyPhy2CADPCB Visualizer Format Type not set to valid format. " + "The visualizer currently only supports STEP & STL files."); this.result.Success = false; return(null); } if (settings.runLayout == "false" || String.IsNullOrWhiteSpace(settings.runLayout)) { if (!String.IsNullOrWhiteSpace(settings.layoutFilePath) && settings.useSavedLayout == "true") { Logger.WriteError("Conflicting interpreter settings: useSavedLayout is set to True, but " + "layoutFilePath is also specified."); this.result.Success = false; return(null); } else if (String.IsNullOrWhiteSpace(settings.layoutFilePath) && settings.useSavedLayout == "true") { string caDesignPath = ca.GetDirectoryPath(ComponentLibraryManager.PathConvention.ABSOLUTE, this.mainParameters.ProjectDirectory); string layoutPath = Path.Combine(this.mainParameters.ProjectDirectory, ca.Attributes.Path, settings.layoutFile); if (!File.Exists(layoutPath)) { Logger.WriteError("Interpreter setting useSavedLayout is set to True, but no {0} " + "file was found in component assembly directory {1}.", settings.layoutFile, ca.Attributes.Path); this.result.Success = false; return(null); } settings.layoutFilePath = layoutPath; } } else { if (!String.IsNullOrWhiteSpace(settings.layoutFilePath) || settings.useSavedLayout == "true") { Logger.WriteError("Conflicting interpreter settings: runLayout is set to True, but " + "either useSavedLayout == True or layoutFilePath is specified."); this.result.Success = false; return(null); } } return(settings); }
void open_component_folder() { this.Logger = new CyPhyGUIs.GMELogger(CurrentProj, this.GetType().Name); string absPath; if (GetCurrentDesignElement() is CyPhy.Component) { CyPhy.Component comp = (CyPhy.Component)GetCurrentDesignElement(); absPath = comp.GetDirectoryPath(ComponentLibraryManager.PathConvention.ABSOLUTE); } else { CyPhy.ComponentAssembly comp = (CyPhy.ComponentAssembly)GetCurrentDesignElement(); absPath = comp.GetDirectoryPath(ComponentLibraryManager.PathConvention.ABSOLUTE); } if (false == Directory.Exists(absPath)) { Logger.WriteError("Component path does not exist: {0}", absPath); clean_up(false); return; } // META-2517 Explorer doesn't like paths with mixed seperators, make them all the same string uniformabspath = absPath.Replace("\\", "/"); try { Process.Start(@uniformabspath); } catch (Exception ex) { Logger.WriteError("Error opening Windows Explorer: {0}", ex.Message); clean_up(false); return; } clean_up(true); }