Author Topic: Paths in Win-10  (Read 3516 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5103
  • Made in England
    • View Profile
Re: Paths in Win-10
« Reply #15 on: May 28, 2020, 22:02:21 pm »
Can someone attach example files so I can give it a go ?
Filmed in Supermarionation

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7008
    • View Profile
    • Cambam V1.0 French Doc
Re: Paths in Win-10
« Reply #16 on: May 28, 2020, 22:10:18 pm »
David,
Thanks.  That give me 'clues', even if it doesn't yet solve the problem.  I'm a 'clue addict'!!!

Lloyd

If it can be of any use for you if you decide to switch to VB .net to do the post treatment (console application > exe file as results)

It is a very simple post treatment that only scans GCode lines to replace "Y" by "C" (empty lines or lines that begin with "(" are skipped) ,certainly you can use it as skeleton and write you own treatment as needed.

Code: [Select]
Imports System.IO
Module Module1
    Sub Main(ByVal args() As String)

        ' change Y axis to C axis

        Dim line, line_out As String
        Dim fname, outname As String

        fname = args(0)

        If fname <> "" Then
            outname = Left(fname, Len(fname) - 3)   'filename without ".nc"
            Try
                Using sr As StreamReader = New StreamReader(fname)
                    FileOpen(1, outname & ".tmp", OpenMode.Output)
                    Do
                        line = sr.ReadLine()    'read a line in the file
                        If Len(line) > 0 And Left(line, 1) <> "(" Then   'if line is not empty and do not start with a comment
'***** treatment *****
                            line_out = Replace(line, "Y", "C")  'change Y to C
                            PrintLine(1, line_out)  'print the new line in the file
'*********************
                        Else
                            PrintLine(1, line)  'print an unchanged line
                        End If

                    Loop Until line Is Nothing
                    sr.Close()
                    FileClose(1)

                    FileSystem.Kill(fname)  'delete old .nc file
                    FileSystem.Rename(outname & ".tmp", outname & ".nc")   'rename .temp file to .nc

                End Using

            Catch E As Exception
                MsgBox("Error" & E.Message)
            End Try
        End If
    End Sub

++
David
« Last Edit: May 28, 2020, 22:16:01 pm by dh42 »

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7008
    • View Profile
    • Cambam V1.0 French Doc
Re: Paths in Win-10
« Reply #17 on: May 28, 2020, 22:14:16 pm »
Can someone attach example files so I can give it a go ?

for a .VBS post treatment ?

the one I talk about is here (PP + .vbs file)
https://cambamcnc.com/forum/index.php?topic=5354.msg44886#msg44886

++
David

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8710
    • View Profile
Re: Paths in Win-10
« Reply #18 on: May 29, 2020, 00:10:04 am »
Thank you, David!

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline Bob La Londe

  • CNC Jedi
  • *****
  • Posts: 4264
  • ^ 8.5 pounds on my own hand poured bait.
    • View Profile
    • CNC Molds N Stuff
Re: Paths in Win-10
« Reply #19 on: June 15, 2020, 15:07:20 pm »
This may have already been addressed, but I've run across some "issues" where W10 seems to retain file/directory associations even when a program is reinstalled and the directory associations should have been reset by the new installation.  I don't see how it could be an issue for you since you are specifying a path in code, but it might be worth a look see. 
Getting started on CNC?  In or passing through my area?
If I have the time I'll be glad to show you a little in my shop. 

Some Stuff I Make with CamBam
http://www.CNCMOLDS.com

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8710
    • View Profile
Re: Paths in Win-10
« Reply #20 on: June 15, 2020, 15:12:05 pm »
Yeah, Bob.  For all I've read, it seems you must change those associations in the registry -- by hand.

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"