Esempio n. 1
0
        private void generateMovement(MachineState state, Point3D lastPosition, ToolPath result)
        {
            var startPosition = lastPosition;
            var endPosition   = state.CurrentPosition;

            switch (state.MotionMode)
            {
            case MotionMode.IsLinear:
            case MotionMode.IsLinearRapid:
                //for now aproximate by a simple line
                result.AddLine(endPosition, state);
                break;

            case MotionMode.IsCircularCW:
                addCircularApproximation(result, state, startPosition, endPosition, clockwise: true);
                break;

            case MotionMode.IsCircularCCW:
                addCircularApproximation(result, state, startPosition, endPosition, clockwise: false);
                break;


            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
 public ToolPath CreateToolPath(PathData pd, double inc)
 {
     ToolPath tp;
     WheelsData rd = (WheelsData)pd;
     tp = new ToolPath(CalculateWheels(rd, inc));
     return tp;
 }
Esempio n. 3
0
 public ToolPath CreateToolPath(PathData pd, double inc)
 {
     ToolPath tp;
     BraidData b = pd as BraidData;
     tp = new ToolPath(); //.BarrelOutline((int)(1 / inc)));
     return tp;
 }
Esempio n. 4
0
        private void CheckToolPath()
        {
            string ndocPath = ToolPath == null ? String.Empty : ToolPath.Trim();

            if (String.IsNullOrEmpty(ndocPath))
            {
                ndocPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                ndocPath = Path.Combine(ndocPath, @"NDoc 1.3\bin\net\1.1");

                try
                {
                    using (RegistryKey buildKey = Registry.ClassesRoot.OpenSubKey(@"NDoc Project File\shell\build\command"))
                    {
                        if (buildKey == null)
                        {
                            Log.LogError("Could not find the NDoc Project File build command. Please make sure NDoc is installed.");
                        }
                        else
                        {
                            ndocPath = buildKey.GetValue(null, ndocPath).ToString();
                            Regex ndocRegex = new Regex("(.+)NDocConsole\\.exe", RegexOptions.IgnoreCase);
                            Match pathMatch = ndocRegex.Match(ndocPath);
                            ndocPath = pathMatch.Groups[1].Value.Replace("\"", "");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.LogErrorFromException(ex);
                }
                base.ToolPath = ndocPath;
            }
        }
Esempio n. 5
0
        private void CheckToolPath()
        {
            string nunitPath = ToolPath == null ? String.Empty : ToolPath.Trim();

            if (String.IsNullOrEmpty(nunitPath))
            {
                nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                nunitPath = Path.Combine(nunitPath, DEFAULT_NUNIT_DIRECTORY);

                try
                {
                    using (RegistryKey buildKey = Registry.ClassesRoot.OpenSubKey(@"NUnitTestProject\shell\open\command"))
                    {
                        if (buildKey == null)
                        {
                            Log.LogError(Properties.Resources.NUnitNotFound);
                        }
                        else
                        {
                            nunitPath = buildKey.GetValue(null, nunitPath).ToString();
                            Regex nunitRegex = new Regex("(.+)nunit-gui\\.exe", RegexOptions.IgnoreCase);
                            Match pathMatch  = nunitRegex.Match(nunitPath);
                            nunitPath = pathMatch.Groups[1].Value.Replace("\"", "");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.LogErrorFromException(ex);
                }
                ToolPath = nunitPath;
            }
        }
        private void Machine_FileChanged()
        {
            try
            {
                ToolPath = GCodeFile.FromList(machine.File);
                GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);                 // prevents considerable increase in memory usage
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not parse GCode File, no preview/editing available\nrun this file at your own risk\n" + ex.Message);
            }

            if (Properties.Settings.Default.EnableCodePreview)
            {
                ToolPath.GetModel(ModelLine, ModelRapid, ModelArc);
            }

            LabelFileLength.Content = machine.File.Count;

            int digits = (int)Math.Ceiling(Math.Log10(machine.File.Count));

            string format = "D" + digits;

            int i = 1;

            ListViewFile.Items.Clear();
            foreach (string line in machine.File)
            {
                ListViewFile.Items.Add(new TextBlock()
                {
                    Text = $"{i++.ToString(format)} : {line}"
                });
            }
        }
Esempio n. 7
0
        public ToolPath GetToolPath()
        {
            var result = new ToolPath();

            var machineState = new MachineState();

            foreach (var line in _lines)
            {
                var lineWithoutComments = Regex.Replace(line, "([;%].*|[(][^)]*[)])", "").Trim();
                var rawTokens           = lineWithoutComments.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                var tokenStack     = filter(rawTokens);
                var lastTokenCount = 0;

                if (!tokenStack.Any())
                {
                    continue;
                }

                while (lastTokenCount != tokenStack.Count)
                {
                    lastTokenCount = tokenStack.Count;
                    update(machineState, tokenStack);
                }

                tryAddMove(machineState, result);

                if (tokenStack.Any())
                {
                    throw new NotImplementedException("Tokens not consumed");
                }
            }

            return(result);
        }
Esempio n. 8
0
        private void ButtonEditApplyHeightMap_Click(object sender, RoutedEventArgs e)
        {
            if (machine.Mode == Machine.OperatingMode.SendFile)
            {
                return;
            }

            if (Map == null || Map.NotProbed.Count > 0)
            {
                MessageBox.Show("HeightMap is not ready");
                return;
            }

            try
            {
                machine.SetFile(ToolPath.ApplyHeightMap(Map).GetGCode());
                Machine_OperatingMode_Changed();
            }
            catch (IndexOutOfRangeException)
            {
                MessageBox.Show("The Toolpath is not contained in the HeightMap");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 9
0
        private void CheckToolPath()
        {
            string path = Environment.GetEnvironmentVariable("PATH");
            //Console.WriteLine("DEBUG Make Task: PATH='{0}'", path);
            string makePath = ToolPath == null ? String.Empty : ToolPath.Trim();

            if (!String.IsNullOrEmpty(makePath) && File.Exists(Path.Combine(makePath, ToolName)))
            {
                ToolPath = makePath;
                return;
            }
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                ToolPath = "/usr/bin";
                if (File.Exists(Path.Combine(ToolPath, ToolName)))
                {
                    return;
                }
            }
            string[] splitPath = path.Split(new char[] { Path.PathSeparator });
            foreach (var dir in splitPath)
            {
                if (File.Exists(Path.Combine(dir, ToolName)))
                {
                    ToolPath = dir;
                    return;
                }
            }
            // Blind guess since we can't figure it out.
            ToolPath = "C:\\Program Files\\Microsoft Visual Studio 10.0\\VC\\bin";
        }
Esempio n. 10
0
        void CheckToolPath()
        {
            var nunitPath = ToolPath?.Trim() ?? string.Empty;

            if (!string.IsNullOrEmpty(nunitPath))
            {
                ToolPath = nunitPath;
                return;
            }

            nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            nunitPath = Path.Combine(nunitPath, DefaultNunitDirectory);

            if (Directory.Exists(nunitPath) == false)
            {
                nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
                nunitPath = Path.Combine(nunitPath, DefaultNunitDirectory);
            }

            try {
                var value = Registry.GetValue(InstallDirKey, "InstallDir", nunitPath) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    nunitPath = Path.Combine(value, "nunit-console");
                }
            } catch (Exception ex) {
                Log.LogErrorFromException(ex);
            }
            ToolPath = nunitPath;
        }
Esempio n. 11
0
        private void CheckToolPath()
        {
            var makePath = ToolPath == null ? string.Empty : ToolPath.Trim();

            if (!string.IsNullOrEmpty(makePath) && File.Exists(Path.Combine(makePath, ToolName)))
            {
                ToolPath = makePath;
                return;
            }
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                ToolPath = "/usr/bin";
                if (File.Exists(Path.Combine(ToolPath, ToolName)))
                {
                    return;
                }
            }
            var path = Environment.GetEnvironmentVariable("PATH");
            //Console.WriteLine("DEBUG Make Task: PATH='{0}'", path);
            var splitPath = path.Split(new char[] { Path.PathSeparator });

            foreach (var dir in splitPath)
            {
                if (File.Exists(Path.Combine(dir, ToolName)))
                {
                    ToolPath = dir;
                    return;
                }
            }
            // Fall Back to the install directory
            var vcInstallDir = Environment.GetEnvironmentVariable("VCINSTALLDIR");

            ToolPath = Path.Combine(vcInstallDir, "bin");
        }
Esempio n. 12
0
        private void previewButtonSplit_Click(object sender, RoutedEventArgs e)
        {
            TextInputDialog tid = new TextInputDialog("Split GCode: \n Segment Length (mm)");

            tid.ErrorMessage = "Invalid Number";
            tid.Validate    += (s) =>
            {
                double length;

                if (!double.TryParse(s, out length))
                {
                    return(false);
                }

                return(length > 0);
            };

            if (tid.ShowDialog().Value)
            {
                double length = double.Parse(tid.textBoxInput.Text);

                previewPath = previewPath.Split(length);

                editor_UpdatePreview();
            }
        }
Esempio n. 13
0
        private void CheckToolPath()
        {
            string nunitPath = ToolPath == null ? String.Empty : ToolPath.Trim();

            if (!String.IsNullOrEmpty(nunitPath))
            {
                ToolPath = nunitPath;
                return;
            }

            nunitPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            nunitPath = Path.Combine(nunitPath, DEFAULT_NUNIT_DIRECTORY);

            try
            {
                string value = Registry.GetValue(InstallDirKey, "InstallDir", nunitPath) as string;
                if (!string.IsNullOrEmpty(value))
                {
                    nunitPath = Path.Combine(value, "bin");
                }
            }
            catch (Exception ex)
            {
                Log.LogErrorFromException(ex);
            }
            ToolPath = nunitPath;
        }
Esempio n. 14
0
        internal MillingShapeItemGCode(string gcode, ReadableIdentifier identifier) :
            base(identifier)
        {
            var parser = new GeometryCNC.GCode.Parser(gcode);

            _toolPath = parser.GetToolPath();
        }
Esempio n. 15
0
 public ToolPath CreateToolPath(PathData pd, double inc)
 {
     ToolPath tp;
     Barrel b = pd as Barrel;
     tp = new ToolPath(b.BarrelOutline((int)(1/inc)));
     return tp;
 }
Esempio n. 16
0
        public void abmSurfBuilder_buildFromPath_returnSurfOK()
        {
            string   inputFile = "STRAIGHT-TEST-8-3-15.nc";
            double   increment = .01;
            ToolPath toolpath  = CNCFileParser.ToPath(inputFile);

            ConstantDistancePathBuilder mpb = new ConstantDistancePathBuilder();
            ModelPath mp = mpb.Build(toolpath, increment);
        }
        private void ButtonEditSimplify_Click(object sender, RoutedEventArgs e)
        {
            if (machine.Mode == Machine.OperatingMode.SendFile)
            {
                return;
            }

            machine.SetFile(ToolPath.GetGCode().ToArray());
        }
Esempio n. 18
0
        void initPath()
        {
            string inputFile = "STRAIGHT-TEST-8-3-15.nc";

            ToolPath toolpath = CNCFileParser.ToPath(inputFile);

            var mpb = new ConstantDistancePathBuilder();

            path = mpb.Build(toolpath, meshSize);
        }
Esempio n. 19
0
        public string GetToolPath(string toolName)
        {
            string retVal    = "";
            var    foundTool = ToolPath.FirstOrDefault((item) => item.Name == toolName);

            if (foundTool != null)
            {
                retVal = foundTool.Path;
            }
            return(retVal);
        }
Esempio n. 20
0
        public Tool GetTool(string toolName)
        {
            Tool retVal    = null;
            var  foundTool = ToolPath.FirstOrDefault((item) => item.Name == toolName);

            if (foundTool != null)
            {
                retVal = foundTool;
            }
            return(retVal);
        }
        private void Enw_User_Ok_ArcToLines(double value)
        {
            Properties.Settings.Default.ArcToLineSegmentLength = value;

            if (machine.Mode == Machine.OperatingMode.SendFile)
            {
                return;
            }

            machine.SetFile(ToolPath.ArcsToLines(value).GetGCode());
        }
Esempio n. 22
0
 /// <summary>
 /// 返回应该执行打印的打印机名称
 /// </summary>
 /// <param name="ActivePrinter">当前活动打印机的名称</param>
 /// <param name="Printer">指定的打印机名称,如果为<see langword="null"/>,代表不打印到文件</param>
 /// <param name="FilePath">指定的打印到文件的路径,如果为<see langword="null"/>,代表不打印到纸张</param>
 /// <exception cref="ArgumentException"><paramref name="Printer"/>和<paramref name="FilePath"/>均不为<see langword="null"/></exception>
 /// <exception cref="ArgumentException"><paramref name="FilePath"/>不为<see langword="null"/>,且扩展名不受支持</exception>
 /// <returns></returns>
 public static string PrinterName(string ActivePrinter, IPrinter?Printer = null, PathText?FilePath = null)
 => (Printer, FilePath) switch
 {
     (IPrinter p, null) => p.Name,
     (null, PathText f) => ToolPath.SplitPathFile(f.Path).Extended switch
     {
         "pdf" => "Microsoft Print to PDF",
         "xps" or "oxps" => "Microsoft XPS Document Writer",
         var e => throw new ArgumentException($"由于无法识别扩展名为{e}的路径,程序不知道应该使用哪个打印机进行打印")
     },
     (null, null) => ActivePrinter,
Esempio n. 23
0
        public ToolPath CreateToolPath(PathData pd, double inc)
        {
            ToolPath tp;
            RossData rd = (RossData)pd;
            if (rd.Ex2 == 0)
                tp = new ToolPath(RossCalculate1(rd, inc));
            else
                tp = new ToolPath(RossCalculate2(rd, inc));

            tp.Translate(tp.Extent.Centre);
            return tp;
        }
Esempio n. 24
0
        private void previewButtonInfo_Click(object sender, RoutedEventArgs e)
        {
            ToolPath      path = previewPath;
            StringBuilder info = new StringBuilder();

            Bounds b = path.GetDimensions();

            info.AppendLine($"Dimensions (XY): {b.SizeX:0.###}x{b.SizeY:0.###} mm");
            info.AppendLine($"Lower left corner (XY): {b.MinX:0.###},{b.MinY:0.###} mm");
            info.AppendLine($"Travel Distance: {path.GetTravelDistance():0} mm");
            info.Append($"Total Lines: {path.Count}");

            MessageBox.Show(info.ToString());
        }
Esempio n. 25
0
        /// <summary>初始化</summary>
        /// <param name="addlib"></param>
        /// <returns></returns>
        public override Boolean Init(Boolean addlib)
        {
            var basePath = ToolPath.CombinePath("arm\\bin").GetFullPath();

            Complier = basePath.CombinePath("iccarm.exe").GetFullPath();
            Asm      = basePath.CombinePath("iasmarm.exe");
            Link     = basePath.CombinePath("ilinkarm.exe");
            Ar       = basePath.CombinePath("iarchive.exe");
            ObjCopy  = basePath.CombinePath("ielftool.exe");

            IncPath = basePath.CombinePath(@"arm\include").GetFullPath();
            LibPath = basePath.CombinePath(@"arm\lib").GetFullPath();

            return(base.Init(addlib));
        }
Esempio n. 26
0
        /// <summary>初始化</summary>
        /// <param name="addlib"></param>
        /// <returns></returns>
        public override Boolean Init(Boolean addlib)
        {
            // 子类没有查找,才轮到父类
            if (ToolPath.IsNullOrEmpty())
            {
                if (location == null)
                {
                    location = new GCCLocation();
                }

                Version  = location.Version;
                ToolPath = location.ToolPath;
            }

            return(base.Init(addlib));
        }
        private void SaveFileDialogGCode_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (machine.Mode == Machine.OperatingMode.SendFile)
            {
                return;
            }

            try
            {
                ToolPath.Save(saveFileDialogGCode.FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ButtonEditRotateCW_Click(object sender, RoutedEventArgs e)
        {
            if (machine.Mode == Machine.OperatingMode.SendFile)
            {
                return;
            }

            try
            {
                machine.SetFile(ToolPath.RotateCW().GetGCode());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// 根据路径,创建一个工作簿
        /// </summary>
        /// <param name="path">工作簿所在的路径,
        /// 如果为<see langword="null"/>,则创建一个尚未保存到内存的xlsx工作簿</param>
        public ExcelBookNpoi(PathText?path)
            : base(path, CreateNpoiOffice.SupportExcel)
        {
            FileStream?file = null;

            WorkBook = path switch
            {
                null => new XSSFWorkbook(),
                var p => ToolPath.Split(p).Extended switch
                {
                    "xls" => new HSSFWorkbook(file = new FileStream(p, FileMode.Open)),
                    "xlsx" or "xlsm" => new XSSFWorkbook(p),
                    _ => throw ExceptionIO.BecauseFileType(p, CreateNpoiOffice.SupportExcel)
                }
            };
            file?.Dispose();
            Sheets = new ExcelSheetCollectionNpoi(this);
        }
Esempio n. 30
0
        // TODO

        public virtual void SetPaths(IAbsoluteDirectoryPath appPath        = null, IAbsoluteDirectoryPath dataPath = null,
                                     IAbsoluteDirectoryPath localDataPath  = null, IAbsoluteDirectoryPath tempPath = null,
                                     IAbsoluteDirectoryPath configPath     = null, IAbsoluteDirectoryPath toolPath = null,
                                     IAbsoluteDirectoryPath sharedDataPath = null)
        {
            //if (PathsSet) throw new Exception("Paths are already set!");
            if (PathsSet)
            {
                this.Logger().Debug("Paths were already set!");
            }

            EntryLocation = CommonBase.AssemblyLoader.GetEntryLocation();
            EntryPath     = CommonBase.AssemblyLoader.GetEntryPath();
            ProcessExtensions.DefaultWorkingDirectory = EntryPath;
            AppPath             = appPath ?? GetAppPath();
            DataPath            = dataPath ?? GetDataPath();
            NotePath            = DataPath.GetChildDirectoryWithName("Notes");
            LocalDataRootPath   = GetLocalDataRootPath();
            LocalDataPath       = localDataPath ?? GetLocalDataPath();
            LocalDataSharedPath = sharedDataPath ?? GetLocalDataSharedPath();
            SharedDllPath       = GetLocalSharedDllPath();
            LogPath             = LocalDataPath.GetChildDirectoryWithName("Logs");
            TempPath            = tempPath ??
                                  Path.Combine(Path.GetTempPath(), Common.AppCommon.ApplicationName)
                                  .ToAbsoluteDirectoryPath();
            ToolPath          = toolPath ?? LocalDataSharedPath.GetChildDirectoryWithName("Tools");
            ToolMinGwBinPath  = ToolPath.GetChildDirectoryWithName("mingw").GetChildDirectoryWithName("bin");
            ToolCygwinBinPath = ToolPath.GetChildDirectoryWithName("cygwin").GetChildDirectoryWithName("bin");
            ConfigPath        = configPath ?? ToolPath.GetChildDirectoryWithName("Config");
            StartPath         = Directory.GetCurrentDirectory().ToAbsoluteDirectoryPath();

            AwesomiumPath = LocalDataSharedPath.GetChildDirectoryWithName("CEF");

            MyDocumentsPath = GetMyDocumentsPath();
            ProgramDataPath = GetProgramDataPath();
            SharedFilesPath = AppPath;

            ServiceExePath     = Common.IsMini ? EntryLocation : SharedFilesPath.GetChildFileWithName(ServiceExe);
            SelfUpdaterExePath = SharedFilesPath.GetChildFileWithName(SelfUpdaterExe);

            SynqRootPath = ProgramDataPath.GetChildDirectoryWithName("Synq");

            PathsSet = true;
        }
Esempio n. 31
0
        private void CheckToolPath()
        {
            string nunitPath = (null == ToolPath) ? string.Empty : ToolPath.Trim();

            if (string.IsNullOrEmpty(nunitPath))
            {
                nunitPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
                nunitPath =
                    string.IsNullOrWhiteSpace(nunitPath)
                                                ? string.Empty
                                                : nunitPath.Replace(@"file:\", string.Empty);
            }

            if (!Directory.Exists(nunitPath))
            {
                Log.LogError("Could not find directory '{0}'", nunitPath);
            }
            ToolPath = nunitPath;
        }
Esempio n. 32
0
        public override bool RunTask()
        {
            if (string.IsNullOrEmpty(ToolPath) || !File.Exists(GenerateFullPathToTool()))
            {
                Log.LogCodedError("XA5205", Properties.Resources.XA5205_Lint, ToolName);
                return(false);
            }

            bool fromCmdlineTools = ToolPath.IndexOf("cmdline-tools", StringComparison.OrdinalIgnoreCase) >= 0;

            Version lintToolVersion = GetLintVersion(GenerateFullPathToTool());

            Log.LogDebugMessage("  LintVersion: {0}", lintToolVersion);
            foreach (var issue in DisabledIssuesByVersion)
            {
                if (fromCmdlineTools || lintToolVersion >= issue.Value)
                {
                    if (string.IsNullOrEmpty(DisabledIssues) || !DisabledIssues.Contains(issue.Key))
                    {
                        DisabledIssues = issue.Key + (!string.IsNullOrEmpty(DisabledIssues) ? "," + DisabledIssues : "");
                    }
                }
            }

            foreach (var issue in DisabledIssuesByVersion)
            {
                if (!fromCmdlineTools || (lintToolVersion < issue.Value))
                {
                    DisabledIssues = CleanIssues(issue.Key, lintToolVersion, DisabledIssues, nameof(DisabledIssues));
                    EnabledIssues  = CleanIssues(issue.Key, lintToolVersion, EnabledIssues, nameof(EnabledIssues));
                }
            }

            EnvironmentVariables = new [] { "JAVA_HOME=" + JavaSdkPath };

            resource_name_case_map = MonoAndroidHelper.LoadResourceCaseMap(ResourceNameCaseMap);

            base.RunTask();

            return(!Log.HasLoggedErrors);
        }
Esempio n. 33
0
        private void tryAddMove(MachineState state, ToolPath result)
        {
            var lastPosition = state.CurrentPosition;

            if (state.BufferX.HasValue || state.BufferY.HasValue || state.BufferZ.HasValue)
            {
                if (state.MotionInstructionBuffer == MotionInstruction.Homing)
                {
                    //TODO homing arguments
                    //state.CurrentPosition = new Point3D(lastPosition.X, lastPosition.Y, 0);
                }
                else if (state.MotionInstructionBuffer == MotionInstruction.Nop)
                {
                    var p = state.CurrentPosition;
                    p.X = getPosition(state, p.X, state.BufferX);
                    p.Y = getPosition(state, p.Y, state.BufferY);
                    p.Z = getPosition(state, p.Z, state.BufferZ);
                    state.CurrentPosition = p;
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            if (state.CurrentPosition != lastPosition)
            {
                generateMovement(state, lastPosition, result);
            }

            state.BufferX = null;
            state.BufferY = null;
            state.BufferZ = null;
            state.BufferI = null;
            state.BufferJ = null;
            state.BufferR = null;

            state.MachineInstructionBuffer = MachineInstruction.Nop;
            state.MotionInstructionBuffer  = MotionInstruction.Nop;
        }
Esempio n. 34
0
        /// <summary>初始化</summary>
        /// <param name="addlib"></param>
        /// <returns></returns>
        public override Boolean Init(Boolean addlib)
        {
            if (ToolPath != location.ToolPath)
            {
                Version = location.GetVer(ToolPath);
            }

            var basePath = ToolPath.CombinePath("bin").GetFullPath();

            Complier = basePath.CombinePath("arm-none-eabi-gcc.exe").GetFullPath();
            //Asm = basePath.CombinePath(@"..\arm-none-eabi\bin\as.exe");
            Asm = basePath.CombinePath("arm-none-eabi-as.exe");
            //Link = basePath.CombinePath("arm-none-eabi-ld.exe");
            Link    = basePath.CombinePath("arm-none-eabi-gcc.exe");
            Ar      = basePath.CombinePath("arm-none-eabi-ar.exe");
            ObjCopy = basePath.CombinePath("arm-none-eabi-objcopy.exe");

            IncPath = basePath.CombinePath(@"..\arm-none-eabi\include").GetFullPath();
            LibPath = basePath.CombinePath(@"..\arm-none-eabi\lib").GetFullPath();

            return(base.Init(addlib));
        }
Esempio n. 35
0
 public void Reset()
 {
     DistanceMode = ParseDistanceMode.Absolute;
     ArcDistanceMode = ParseDistanceMode.Incremental;
     Unit = DistanceUnit.MM;
     Position = new Vector3(0.0f, 0.0f, 0.0f);
     ToolPath = new ToolPath();
     LastGCode = -1;
 }
Esempio n. 36
0
 public ToolPath CreateToolPath(PathData pd, double inc)
 {
     ToolPath tp;
     LatticeData l = pd as LatticeData;
     tp = new ToolPath(); //.BarrelOutline((int)(1 / inc)));
     return tp;
 }
        public void ResetFromSelection()
        {
            if (InteractionContext.SingleSelection as ICustomObject == null)
                return;

            toolPathObj = FaceToolPathObject.GetWrapper((InteractionContext.SingleSelection as ICustomObject).Master);
            if (toolPathObj == null || toolPathObj.IDesFace == null) {
                TransportControls.IsEnabled = false;
                return;
            }

            toolPath = toolPathObj.ToolPath;
            locations = toolPathObj.ToolPath.CutterLocations;
            timeToLocation = new double[locations.Count];

            time = 0;
            totalTime = 0;
            timeToLocation[0] = 0;
            for (int i = 0; i < locations.Count - 1; i++) {
                double length = (locations[i + 1].Point - locations[i].Point).Magnitude;
                totalLength += length;
                double rate = locations[i + 1].IsRapid ? toolPath.CuttingParameters.FeedRateRapid : toolPath.CuttingParameters.FeedRate;
                double dtime = length / rate;
                totalTime += dtime;
                timeToLocation[i + 1] = totalTime;
            }
            timeToLocation = timeToLocation.Distinct().ToArray();

            SetGraphics();
            TransportControls.IsEnabled = true;
            TransportControls.Reset(this);
        }
Esempio n. 38
0
        private void previewButtonSplit_Click(object sender, RoutedEventArgs e)
        {
            TextInputDialog tid = new TextInputDialog("Split GCode: \n Segment Length (mm)");
            tid.ErrorMessage = "Invalid Number";
            tid.Validate += (s) =>
            {
                double length;

                if (!double.TryParse(s, out length))
                    return false;

                return length > 0;
            };

            if (tid.ShowDialog().Value)
            {
                double length = double.Parse(tid.textBoxInput.Text);

                previewPath = previewPath.Split(length);

                editor_UpdatePreview();
            }
        }