Author Topic: Quantum Eraser MOP Editor  (Read 11224 times)

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Quantum Eraser MOP Editor
« on: February 19, 2019, 11:16:27 am »
I've been thinking about making a "On Mass MOP Editor" for editing the MOP's  files, and got a little time today to
scratch a bit of code together to see what could be done.
My first thought was to make an grep command line, but on reflection decided that a GUI would be more accessible
for most people.

To that end, here are a few screen shots of what I have so far.
This code does not have exception handling, or translation yet.
To use it, first load up a CB file then start the plugin.
The first dropdown box holds all of the Parts in the file.
The second dropdown box holds all of the mops in the file.
The third dropdown box hold all of the mop types in the file.
The fourth dropdown box holds the MOP Field Property that you wan't to change.
The fifth dropdownbox is the new value for the field Property.

You can either select a dropdown box Item or enter the text manually.
You can select various mops  and parts very selectively by manually entering in text.
For example you could select all profile mops, or just profile mops named "Profile" or "prof".
You can specify single mops or single parts with drill mops in them.
There is a very important button you should use before using the run button it's the "Dry Run" button.
It let's you see how many mop's will be affected by your proposed settings before using the RUN button
you see it's an Atomic function that at the moment can't be undone, so always work with a backup file not
the real one.
 It testing some parts(and all of the MOP's) were Quantum Erased, never to be seen this side of our galaxy's an event horizon. ::)
Dave


Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5321
  • Made in England
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #1 on: February 19, 2019, 11:35:30 am »
Dave,

Been busy I see ! I like the plugin name.

It works okay on my test file, so far.

1. When a "Part Name" is selected in the first drop down, then maybe only those MOps in that Part should populate the second drop down, "Mop Name". Plus, same logic for the other drop downs.
2. Parts and MOps that are "disabled" are also affected, is that required ?

Edit:
3. DepthIncrement, FinalDepthIncrement, ToolNumber, Style, are not working.

« Last Edit: February 19, 2019, 11:47:49 am by EddyCurrent »
Filmed in Supermarionation

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #2 on: February 20, 2019, 00:23:38 am »
Hi Eddy
Quote
2. Parts and MOps that are "disabled" are also affected, is that required ?

It's not required, although I do have some very large files which were made up from two or sometimes more single files that produce a single sub assembly, so with these files I do have large swath's of Parts and Mops disabled (to reduce the time it takes to generate the code).

What I'll do is add a radio/tickbox button, so that the user can decide whether or not to work with Enabled/Disabled MOP's

3. DepthIncrement, FinalDepthIncrement, ToolNumber, Style, are not working. Done
Quote
1. When a "Part Name" is selected in the first drop down, then maybe only those MOps in that Part should populate the second drop down, "Mop Name". Plus, same logic for the other drop downs.


Yeah, I thought of making them (the dropdowns) contextual too, In the pic below you can see a shot of the dropdown menu, and in that menu I discovered that I have a few duplicate "Profile1"  mops, (they are different CB Entities because thay are in different PART's) .

I didn't know they were there, (forgotten, really and was to lazy at the time to re-name after copy/pasting them) and if I did run an batch edit  for Profile1, I would have changed both Profile1 mops and this would cause a lot of trouble as each MOP has different Stock Heights.

It really did help to see all of the MOP's at once, So what I'll do is make the menus contextual, and move/copy  the "All Mop's Dropbox" to a second tab, and I think it would be usefull to display this as a  list of PART's pointing to the  MOP's affected by the Dry run button with some sort of visual representation.

The other thing to do is:  (and the real reason I'm making the tool)
(a bit of background) I have a file using a machining strategy I call shrinking toolpaths where there may be 15-20 identical mops with the Roughing Clearance stepped in a bit between each MOP, the step over is not linear, so what I want to do is adjust each Roughing Clearance field by a Factor. for example  "Roughing clearance  + 10%"    or "Roughing clearance * 1.1", or "Roughing clearance (+-) some value".

Dave







[/pre]

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5321
  • Made in England
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #3 on: February 20, 2019, 07:37:04 am »
Dave,

Quote
In the pic below you can see a shot of the dropdown menu, and in that menu I discovered that I have a few duplicate "Profile1"  mops, (they are different CB Entities because thay are in different PART's) .

I came across it too but forgot to mention it my previous post.

For the shrinking toolpaths, I think it would be ideal on another tab in the plugin form to keep it away from the 'replace' method. Maybe add three text boxes called, "starting clearance", "ending clearance", "increment", then the plugin creates the sequence of MOps required.
Using those three boxes makes it similar to "Stock Surface", "Target Depth", "Depth Increment" and by not using percentages there's no mental maths to do.
« Last Edit: February 20, 2019, 07:43:01 am by EddyCurrent »
Filmed in Supermarionation

Offline onekk

  • CNC Jedi
  • *****
  • Posts: 525
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #4 on: February 22, 2019, 11:47:03 am »
Very good start, I'm waiting for a working plugin and hoping that it will be work even on Linux.

Regards

Carlo D.
Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #5 on: February 23, 2019, 10:54:10 am »
Hi Carlo, Ill'ty to keep it simple, so as to avoid any incompatibilities.
I'm quite happy to give you the VS solution if that will help.

I did a bit more work on it, and have the search logic working with enabled and disabled parts and files.
(Added a Checkbox) Do not work with Disabled Parts and Mops (this is the default state).
I added a second tab page to show the Dry Run results.
Her are a few pics of a run through of an edit.

The first thing to remember is that you should work with backup files only.
The plugin is unaware of any changes that you make to the file or whether you load up a new file (unlike the break edges plugin) so I'll get around soon.
I've also added the rest of the mop Types  to work with.

I have one niggle though, when doing a run through, the property sheet doesn't reflect the changes made by the editor until you click on a part or mop in the tree.
so I need to either pro grammatically click any mop or part in the tree (as this updates the control) .and have had a bit of a rummage around and found a few methods 
in the larder:
                                     //  view.DrawingTree.Update();
                                     // refresh the tree view and drawing views
                                     // view.DrawingTree.ReloadTree();
                                     // view.DrawingTree.Select();
                                     // view.DrawingTree.SelectObject(Apart.MachineOps.Part.Name);
                                     // view.DrawingTree.Update();
                                     // view.DrawingTree.Refresh();
                                     // view.DrawingTree.Machining.Toggle();
                         //             CamBamUI.MainUI.CADFileTree.Machining.TreeView.CollapseAll();// view.DrawingTree.
                                     // view.DrawingTree.Machining.TreeView.ExpandAll();
                                     // view.DrawingTree.TogglePartState(Apart);
                                     //  view.DrawingTree.SelectObject(Apart.Name);
                          //          view.DrawingTree.SelectedMOPs.Clear();

                                    //Apart.CADFile.EnsureActivePart(true);
                                    // view.DrawingTree.Hide();
                                    // view.DrawingTree.SelectObject(Apart.Name);
                         //           view.DrawingTree.Machining.TreeView.ExpandAll();
                         //           view.DrawingTree.CADFile.SetActivePart(Apart.Name);
                                    //  view.DrawingTree.CADFile.MachiningOptions.PropertyChanged("TargetDepth",TargetDepth);

                         //           view.DrawingTree.ReloadTree();
                         //           view.DrawingTree.Refresh();
                         //           view.RefreshView(true);

I thought a few of them would do the trick but no joy.
I did have a brief look at the nodes but i could not see a way to select the mop and highlight it like a mouse click.
I did have the thought that the tree was running on another thread so you might need something like BeginEnvoke/EndInvoke.
I did have a look at the Add/Subtract/multiply functions over a range [start] mop [end] mop  [value type to change] [function(=+/- * value)]
and I think this would be ok to do.

Dave




Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1892
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #6 on: February 23, 2019, 10:56:09 am »
Ran out of room for attachments.
edit: would help if I add the .dll ::)
« Last Edit: February 23, 2019, 10:58:37 am by dave benson »

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5321
  • Made in England
    • View Profile
Re: Quantum Eraser MOP Editor
« Reply #7 on: February 23, 2019, 11:17:08 am »
Dave,

With the Import plugin I had a similar problem refreshing the tree, this worked for me although there has to be a better way one would think and it will be in the layer.Update() code.

foreach (Layer layer in CamBamUI.MainUI.ActiveView.CADFile.Layers)  layer.Update();

But also have a look at jk's script here; http://www.cambam.co.uk/forum/index.php?topic=5193.msg40895#msg40895
It seems to do the trick.
« Last Edit: February 23, 2019, 11:22:28 am by EddyCurrent »
Filmed in Supermarionation