Author Topic: Drag-Knife Plugin  (Read 102363 times)

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Drag-Knife Plugin
« on: May 28, 2015, 10:52:53 am »
This is a conversion of BillT's Drag-Knife script in this thread; http://www.cambam.co.uk/forum/index.php?topic=3628.msg23778#msg23778

I contacted Bill in the first instance and got his response;
"You are welcome to post it to the forum, probably start a new thread with a link to the old one."

So this is a plugin, the conversion was as close to Bill's code as I could make it.

I've attached a test file that Dragonfly posted in the original thread, running it through both the original script and this plugin I found no differences.
But please satisfy yourself that the plugin is working correctly before cutting any material.

1. Unzip the attached zip file
2. Copy the extracted Dragknife.dll to the CamBam Plugins folder
3. Restart CamBam
4. A new menu item has been created, Plugins -> Drag-Knife
5. Click on the menu item.
6. Hover the cursor over a Label on the popup form to get ToolTipText information.

Any question, please post here.

@David, no translation code included yet.

Edit: Updated with error message if Polylines have issues that need fixing.
Edit: Updated with a check box to Enable/Disable Log Messages, big speed improvement if Logs not required.

Edit: updated with polyline direction buttons

Edit: updated, all input boxes will take positive and negative numbers, you decide.

Edit: updated (to v4), there was a point missing from the swivel path (only when using the retract feature) which caused   the swivel to ramp back into the material instead of swiveling at the RetractDepth.

Edit: updated ( to v5), see this post; http://www.cambam.co.uk/forum/index.php?topic=4911.msg38769#msg38769

Edit: update version 6 attached
Has been compiled with .NET version 4 assemblies and references to CamBam v1.0 dlls

Has been modified and tested to work on;

    Windows
    Linux

Works with CamBam version 1 ONLY
« Last Edit: January 12, 2017, 15:46:23 pm by EddyCurrent »
Filmed in Supermarionation

Offline GraphicMan

  • Droid
  • **
  • Posts: 94
    • View Profile
Re: Drag-Knife Plugin
« Reply #1 on: May 28, 2015, 14:52:00 pm »
Nice job Eddy
First glance it solved a problem with cutting a circle less than 2mm (script wont do a circle less than 2mm)
Would the plugin still need .Net framework to run on XP? I really hope not

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Drag-Knife Plugin
« Reply #2 on: May 28, 2015, 16:24:36 pm »
Would the plugin still need .Net framework to run on XP? I really hope not

It does need .Net framework but that should be of little concern because so does CamBam.
Filmed in Supermarionation

Offline airnocker

  • CNC Jedi
  • *****
  • Posts: 649
    • View Profile
Re: Drag-Knife Plugin
« Reply #3 on: May 28, 2015, 16:43:53 pm »
Many thanks Eddy, makes it easy to use in CamBam, can't wait to try it on cutting material for my project.

airnocker

Everything depends on everything else

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Drag-Knife Plugin
« Reply #4 on: May 28, 2015, 17:16:29 pm »
Before trying it on a project, try it on some scrap first  ;D, also thank Bill for the code, I couldn't have come up with that myself, I just translated it.
Filmed in Supermarionation

Offline airnocker

  • CNC Jedi
  • *****
  • Posts: 649
    • View Profile
Re: Drag-Knife Plugin
« Reply #5 on: May 29, 2015, 03:07:20 am »
You bet I will Eddy. And many, many thanks Bill!  Got the perfect test, too, using the first .cb file I used to test my DIY spring-loaded swivel knife.  The material was TopFlight's adhesive monokoat used in decaling RC airplanes.

http://www.monokote.com/trim.html

The adhesive material is .0025" thick and the backing paper is .0065".  In my first successful drag-knife cut of this material I used a DOC of -.007", a tool diameter of .00001", and an Outside Engraving MOP.  My down force was measured at around 170-180 grams.  No attempts to correct for blade offset of .019" at all.  In the attached photo from several years ago one can see the apparent entry point at the 9 o'clock position on the two "C's".  These letters are just about 1" tall.

A comparison using the new code Bill wrote and the plug-in you made of it Eddy will be very interesting.  Will post a side by side comparison, "then" and "now".







« Last Edit: May 29, 2015, 03:10:18 am by airnocker »
airnocker

Everything depends on everything else

Offline GraphicMan

  • Droid
  • **
  • Posts: 94
    • View Profile
Re: Drag-Knife Plugin
« Reply #6 on: May 29, 2015, 06:39:13 am »
You bet I will Eddy. And many, many thanks Bill!  Got the perfect test, too, using the first .cb file I used to test my DIY spring-loaded swivel knife.  The material was TopFlight's adhesive monokoat used in decaling RC airplanes.

http://www.monokote.com/trim.html

The adhesive material is .0025" thick and the backing paper is .0065".  In my first successful drag-knife cut of this material I used a DOC of -.007", a tool diameter of .00001", and an Outside Engraving MOP.  My down force was measured at around 170-180 grams.  No attempts to correct for blade offset of .019" at all.  In the attached photo from several years ago one can see the apparent entry point at the 9 o'clock position on the two "C's".  These letters are just about 1" tall.

A comparison using the new code Bill wrote and the plug-in you made of it Eddy will be very interesting.  Will post a side by side comparison, "then" and "now".









Interesting, I will soon make cutting comparisons too, whats the "CNC" cut dimensions? how small can you go?

Offline GraphicMan

  • Droid
  • **
  • Posts: 94
    • View Profile
Re: Drag-Knife Plugin
« Reply #7 on: May 29, 2015, 12:56:02 pm »
@EddyCurrent

I have been always having some weird behavior using the script before,
Like I said earlier your plugin solved one of them,
I know that you had only translated the code but maybe you could check that problem out

I have attached a very simple CB file of a polyline of "M" letter
Using the script I get the ZeroDivisionError (line=116)
Using the plugin no log error but the created polyline look empty

The more weird about it that I could have another same letter on the file that works normally!
but lets first see what so wrong with this file first

I am using the latest CB on Win7 64bit
Drag Knife settings 1.5mm for offset, Cut depth 0.3, S Angle 20,Dent L 0, R Angle 20 Enabled, R Depth 0.05
just in case it makes any difference to duplicate the error



Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drag-Knife Plugin
« Reply #8 on: May 29, 2015, 13:10:06 pm »
Hello,

The polyline has a duplicate point ; the first and second point (take a look in the polyline points collection)

   0.73810729304607   7.95432674234095   0   0

Use Polyline/clean to remove this duplicate point, maybe it will solve the problem.
http://www.cambam.info/doc/dw/0.9.8/cad/EditPolyline.htm

++
David
« Last Edit: May 29, 2015, 13:25:14 pm by dh42 »

Offline GraphicMan

  • Droid
  • **
  • Posts: 94
    • View Profile
Re: Drag-Knife Plugin
« Reply #9 on: May 29, 2015, 13:19:50 pm »
Hello,

The polyline has a duplicate point ; the first and second point (take a look in the polyline points collection)

   0.73810729304607   7.95432674234095   0   0

Use Polyline/clean to remove this duplicate point, maybe it will solve the problem.
http://www.cambam.info/doc/dw/0.9.8/cad/EditPolyline.htm

++
David

Thanks, it seem it will solve the problem
Would you tell me what is the best way to convert vector files to CM
I think CM takes only dxf files
I have tried different ways to export dxf files from AI but it seems there is problems in this export
I always get duplicate shapes as well as duplicated points!, it is very annoying specially with large files


Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drag-Knife Plugin
« Reply #10 on: May 29, 2015, 13:36:41 pm »
Hello,

The quality of the DXF is very dependent of the soft that is used to do it  ::) I get nice and clean DXF with AutoCAD or SolidWorks, Those saved from Rhino are not always accurate, those saved from Sketchup have a lot of job to clean them ... with Illustrator (I use it only to vectorize pictures), I also get duplicate lines ... maybe a setting in Illustrator, Ralf (pixelmaker) can certainly help you for that ; I've a very small knowledge of this soft.

Read this post, it can be helpful ... the remove overlaps can certainly solve some problems.

http://www.cambam.co.uk/forum/index.php?topic=1624.0

++
David
« Last Edit: May 29, 2015, 13:46:58 pm by dh42 »

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Drag-Knife Plugin
« Reply #11 on: May 29, 2015, 13:59:42 pm »
David,

Well spotted with the duplicate point.
I can see where the divide by zero occurs, two places I think, so I can catch them before it happens and put up a message.
Try it with the faulty M file here;  (Python Error.cb)

Updated Plugin added to first post.

I think what happens is this;
Polyline segments are examined one at a time, so if there are two identical sets of XYZ points adjacent to each other the segment length between will be zero. That value becomes the denominator of a divide calculation that fails on "Divide by zero" error.
« Last Edit: May 29, 2015, 18:17:01 pm by EddyCurrent »
Filmed in Supermarionation

Offline airnocker

  • CNC Jedi
  • *****
  • Posts: 649
    • View Profile
Re: Drag-Knife Plugin
« Reply #12 on: May 29, 2015, 15:03:38 pm »
Quote
Interesting, I will soon make cutting comparisons too, whats the "CNC" cut dimensions? how small can you go?

Here is the .cb file used to cut the "CNC" letters.  As stated earlier, the letters are just under 1 inch tall.  I do not know how small I can go as I have not had any need to create something small.

I too, use AutoCAD 2011 for DXF creation/conversion and never had any problems importing them into CamBam.

Thanks Eddy for the updated DLL and to everyone else for testing.

airnocker

Everything depends on everything else

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Drag-Knife Plugin
« Reply #13 on: May 29, 2015, 15:09:30 pm »
Wow, that file draws some weird shapes , not that I've done any drag knife cutting  :D
What parameters should I be using for this cut ?

It also shows how much faster Python runs than C#
Edit: No, I was wrong, the Script runs faster because I disabled the log messages, it's those that slow it down.
I think I'll put a check box on the form to Enable/Disable log message for this plugin.
« Last Edit: May 29, 2015, 15:17:59 pm by EddyCurrent »
Filmed in Supermarionation

Offline airnocker

  • CNC Jedi
  • *****
  • Posts: 649
    • View Profile
Re: Drag-Knife Plugin
« Reply #14 on: May 29, 2015, 15:18:11 pm »
Eddy, if you comment relates to the .cb file I just posted then I stated the basic parameters in my post several sub-posts back with my "CNC" photo.  The drag-knife I used had a blade offset of .019" but was used as though it were a tool bit dia. of .00001" with an engraving MOP.

So, this .cb file precedes Bill's and your current efforts by several years.   :o
airnocker

Everything depends on everything else