Author Topic: Gcode by part name V2.2.0.0  (Read 17584 times)

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Gcode by part name V2.2.0.0
« on: March 27, 2016, 13:22:33 pm »
Thanks to EddyCurrent and all others who help with this.

Creates all the gcode for a project in separate files, by part name.

After unzipping and putting the .dll in the plugins folder, then you must create an accompanying text file (also in the plugins folder) called PartSavePath.txt

On the first line of that file, put the path to your desired destination for the g-code files.  For instance:
C:\master_gcodes\{$cbfile.name}.nc

The {$cbfile.name} part is necessary.  The ".nc" can be any suffix you choose for your nc files.

You may also place an identically-named file in each of your cb file working folders, and the path may be different for each one.

You may also fill-in the "Out File" field in the machining tab of each .cb file.

This allows up to three different possible paths to save the g-codes.  If more than one path has been 'enabled' by you, you'll get a chance to choose which path when you run the plugin.

LLoyd

(updated source to reflect V2.2.0.2.  Fixed a minor exit bug mentioned down later)
(updated object to V2.3.0.0 to account for very minor changes.  Will post source when time permits)
« Last Edit: April 09, 2016, 14:46:43 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3268
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #1 on: March 27, 2016, 15:57:04 pm »
Lloyd,

Just tried your plugin on parts that were machined couple days ago.. Must say I like it, it spit out the gcode like I was expecting to do. It looks like nice addition to the process of creating gcode for assembly parts. Thanks for that!

Happy Easter to EVERYONE! 
My 2ยข

Win10 (64 bit, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, Endurance Laser.

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #2 on: March 27, 2016, 16:47:49 pm »
Thanks, Bubba!

One minor correction.  Eddy cleaned things up nicely (Thanks, Thomas), but misunderstood my intent in the case where the Machining Tab's "Out File" field is blank.  In that case, I wanted NO save path into the .cb file directory.

If the user wants the files there, then he/she must assert the OutFile value (or point it there with one of the two possible PartSavePath.txt files).

The corrected version is attached.  I am cooking Easter Feast right now, and don't have the time to update the full source above, but will as soon as time permits.  This is V2.2.0.1.

LLoyd
« Last Edit: March 27, 2016, 17:02:36 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #3 on: March 27, 2016, 18:20:42 pm »
The .dll and new source are posted back at the first post in the thread -- V2.2.0.1

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5115
  • Made in England
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #4 on: March 27, 2016, 18:43:12 pm »
I just gave it a go on a current job and it's a lot easier and quicker than doing it by hand. I see what you mean now about leaving the path blank, through lack of use I forgot you can click in the Machinig Out File box and it brings up a file browser.
Filmed in Supermarionation

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7048
    • View Profile
    • Cambam V1.0 French Doc
Re: Gcode by part name V2.2.0.0
« Reply #5 on: March 27, 2016, 19:14:22 pm »
Hello,

Is it normal that the file requester ask for a file name for each "part" instead of using the name of the part added to the file name ? (it propose the name of the CamBam file without adding the name of the part as when we produce Gcode for a part only)

ex: my file is called: Gcode_part_test, and the plugin propose the same name for the part instead of Gcode_part_test.part1, Gcode_part_test.part2, etc ...

When I use it with 2 parts, it give me a warning when saving the second part because it use the same name than for part1 (file already exist, overwrite ?), and I must click NO, then enter a new name for each part..

++
David

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #6 on: March 27, 2016, 19:20:33 pm »
I've fixed one other 'minor' that changed.

Your idea of using full paths is very good.  However, we ended up editing the original 'snapshot' variable that saved the OutFile text for restoration at the end of a run.

So I just posted that _slight_ correction to V2.2.0.2 above, with the only change that I created both the CBfilePathString and one called originalCBfilePathString, then used the 'original' version in RestoreOriginalConditions().

On entry:
      string originalCBfilePathString = null;
      string CBfilePathString = null;

On reading the OutFile spec:
   CBfilePathString = myCBview.MachiningOptions.OutFile;
   originalCBfilePathString = myCBview.MachiningOptions.OutFile;


and on exiting:
        private void Restore_original_conditions()
        {
            myCBview.MachiningOptions.OutFile = originalCBfilePathString;
            view.CADFile.Name = strOrig_filename;
            Reenable_parts();
        }
"Pyro for Fun and Profit for More Than Fifty Years"

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #7 on: March 27, 2016, 19:24:37 pm »
dh42--
"Is it normal that the file requester ask for a file name for each "part" instead of using the name of the part added to the file name ? (it propose the name of the CamBam file without adding the name of the part as when we produce Gcode for a part only)?"
-------------


David, how do you manage to have duplicate part names in one .cb file?

You're supposed to move all the g-code files to a 'holding area' after creation, since the only purpose of this is to create ALL the g-code files for a single .cb drawing.

Hmmmm... maybe I don't understand your question.  The more I read it, the more I think I got your meaning wrong.

What is it NOT doing, and what is it DOING that doesn't look right to you?

Lloyd
« Last Edit: March 27, 2016, 19:32:01 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7048
    • View Profile
    • Cambam V1.0 French Doc
Re: Gcode by part name V2.2.0.0
« Reply #8 on: March 27, 2016, 19:31:49 pm »
Ah ok, we must set a file name in each part Outfile property before using the plugin ?

++
David

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7048
    • View Profile
    • Cambam V1.0 French Doc
Re: Gcode by part name V2.2.0.0
« Reply #9 on: March 27, 2016, 19:34:09 pm »
Quote
David, how do you manage to have duplicate part names in one .cb file?

No, they have different names in the tree (but the Outfile is blank in all)

I'll try a little video later ..

++
David
« Last Edit: March 27, 2016, 19:35:43 pm by dh42 »

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #10 on: March 27, 2016, 19:34:41 pm »
No... it uses the PART's own name as the gcode file's name (plus .nc... etc. as you please).

For that reason, the parts should be named in a way that makes them valid filenames.  

Other than that, no... you do NOT have to set the part's outfile property.  In fact, you should not.

Perhaps if you supplied a sample file that misbehaves, along with the PartSavePath.txt file you're using, I could better discern what you're seeing.

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

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7048
    • View Profile
    • Cambam V1.0 French Doc
Re: Gcode by part name V2.2.0.0
« Reply #11 on: March 27, 2016, 19:50:27 pm »
a video
++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5115
  • Made in England
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #12 on: March 27, 2016, 20:13:58 pm »
If the default Part names were kept, such as Part1, Part2, etc, then every CamBam file would want to overwrite them.
I'm thinking the file names should be the CamBam file + Part name.
Filmed in Supermarionation

Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8723
    • View Profile
Re: Gcode by part name V2.2.0.0
« Reply #13 on: March 27, 2016, 20:24:27 pm »
Eddy,
We could add a 'rule' to allow that, but hard-coding it to do that would defeat Michel's original purpose.

David,

I see that it's asking the name. 

Is this a fresh invocation of CamBam.exe, for which the file has never been saved? (actually,  I just tried that, and it gives an unhandled exception, so that's not it)

If not, please give me more information than only a three second video showing only what you believe is an error.  I can't see anything else from that piece that would help discern what is the problem.

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

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7048
    • View Profile
    • Cambam V1.0 French Doc
Re: Gcode by part name V2.2.0.0
« Reply #14 on: March 27, 2016, 21:16:52 pm »
Lloyd, not a bug, just maybe it works a different manner that I assumed ... but don't worry for me, I have no usage of this plugin, I never generate Gcode for only a part ;)

++
David