Example #1
0
        public void RunPCBAssemblerOnSavedLayout()
        {
            string TestName = System.Reflection.MethodBase.GetCurrentMethod().Name;


            string OutputDir = Path.Combine(TestPath,
                                            "output",
                                            TestName);

            string TestbenchPath = "/@TestBenches|kind=Testing|relpos=0/@Assemble_PCB_Tests|kind=Testing|relpos=0/VisualizeSavedLayout|kind=TestBench|relpos=0";

            var settings = new CyPhy2CADPCB.CyPhy2CADPCB_Settings()
            {
                useSavedLayout = "true",
                visualizerType = "STEP",
                layoutFile     = "layout.json",
                runLayout      = "false"
            };

            bool result = RunInterpreterMainCADPCB(OutputDir, TestbenchPath, settings);

            Assert.True(result, "Interpreter run was unsuccessful");

            RunPythonAssemblerScript(OutputDir, "step");

            Assert.True(File.Exists(Path.Combine(OutputDir, "Test.step")));
            Assert.True(CheckLogForComponentsAddedString(Path.Combine(OutputDir, "log", "CADAssembler.log"), 3, 0, 1));
        }
Example #2
0
        private bool RunInterpreterMainCADPCB(
            string outputdirname,
            string testBenchPath,
            CyPhy2CADPCB.CyPhy2CADPCB_Settings config = null,
            bool copyLayout = false)
        {
            if (Directory.Exists(outputdirname))
            {
                Directory.Delete(outputdirname, true);
            }
            Directory.CreateDirectory(outputdirname);
            Assert.True(Directory.Exists(outputdirname), "Output directory wasn't created for some reason.");

            if (copyLayout)
            {
                File.Copy(Path.Combine(outputdirname + "_PlaceRoute", "layout.json"),
                          Path.Combine(outputdirname, "layout.json"));
            }

            MgaFCO testObj = null;

            project.PerformInTransaction(delegate
            {
                testObj = project.ObjectByPath[testBenchPath] as MgaFCO;
            });

            var interpreter = new CyPhy2CADPCB.CyPhy2CADPCBInterpreter();

            interpreter.Initialize(project);

            var mainParameters = new CyPhyGUIs.InterpreterMainParameters()
            {
                config = (config == null) ? new CyPhy2CADPCB.CyPhy2CADPCB_Settings()
                {
                    Verbose = false
                }
                                          : config,
                Project          = project,
                CurrentFCO       = testObj,
                SelectedFCOs     = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs")),
                StartModeParam   = 128,
                ConsoleMessages  = false,
                ProjectDirectory = project.GetRootDirectoryPath(),
                OutputDirectory  = outputdirname
            };

            var result = interpreter.Main(mainParameters);

            interpreter.DisposeLogger();
            return(result.Success);
        }
Example #3
0
        public void CheckModuleTemplateFound_AlternateCategoryName()
        {
            string TestName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            string OutputDir = Path.Combine(TestPath,
                                            "output",
                                            TestName);

            string TestbenchPath = "/@TestBenches|kind=Testing|relpos=0/@Assemble_PCB_Tests|kind=Testing|relpos=0/@UsesModuleTemplateAltCategory|kind=TestBench|relpos=0";

            var settings = new CyPhy2CADPCB.CyPhy2CADPCB_Settings()
            {
                useSavedLayout = "false",
                visualizerType = "STEP",
                runLayout      = "true"
            };

            bool result = RunInterpreterMainCADPCB(OutputDir, TestbenchPath, settings);

            Assert.True(result, "Interpreter run was unsuccessful");

            Assert.True(File.Exists(Path.Combine(OutputDir, "AraTemplateParts.json")));
        }