Author Topic: Curved surface script  (Read 54694 times)

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #30 on: July 07, 2014, 23:04:13 pm »
Dear Lloyd

Thanks for the feedback, I will try to reproduce the problems and try to fix them.

Geoff

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1788
    • View Profile
    • pixelmaker
Re: Curved surface script
« Reply #31 on: July 08, 2014, 10:30:23 am »
hello Geoffrey

thank you for this plugin. It is very useful in many situations

If you are sometimes satisfied with this plugin, maybe you could give it  the possibility of translation. Lloyd and David know how to do that, so I understand it.

ralf

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #32 on: July 09, 2014, 08:14:29 am »
Dear Lloyd, etc.

I have found the issue with the strange paths - it is do do with have a rather large tool for the size of the pocket.  In vers 1.0.0.4 you will see I have removed the paths that "overlapped" near the centre of the pocket on the basis that this material is in fact removed by the tool, and these paths are not necessary (and confusing).  This may place some stress on the lead-in paths as a full width cut may be required, so all I can suggests is that if a large tool is being used the feed rate needs to be reduced to allow this feed-in to happen without stress.  Perhaps there is a better solution?

There may still be some "glitches" in paths, especially with END mills, though I think I have got most of them - they can be minmised (and possible removed) by using a more accurate surface (i.e smaller accuracy value).

I have not been able to reproduce the "intersection" issue, though this may have related to the "overlapping" paths mentioned above.

I will now look up how to do a multilingual; app and see how I go with that, though help with providing translations will be appreciated.

thanks

Geoff

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8360
    • View Profile
Re: Curved surface script
« Reply #33 on: July 09, 2014, 11:08:30 am »
Geoff,
Thanks for the update.

I don't think all the paths should be removed from the middle.  I was only referring to the toolpaths that described semicircles ABOVE the work surface.  Those below are appropriate.  Otherwise, as you say, the tool must do a full-width cut at 1/2 the tool diameter deep, and this could be bad. 

However, it's only the FIRST cut that requires that, and none other.  So all the other little short paths of an actual pocket would be wasted.

I guess someone could set up a separate MOp just for that first cut?

If I had my preferences, I'd personally like to see that 'inner cut' put back, but only for the first set of lines of a given width.  For instance, say the width was the tool diameter plus one stepover.  That would result in two sets of curves.  Just do the inner cut on the first.  Everything else will be cut only one stepover wide, so it won't stress a cutter.
---

The curves look good now.  However, there's a math error that has been around for a while, but I just noticed it.  I tried it on V1.0.3, and the same error is there.  With the example below, it makes everything .0001784584534017" larger.  Wider on both ends of the final cut, and deeper at the center by that same amount.  It's almost like an offset to the line that should be formed.

Again, seed line -1,0 to 1,0
Step increments and depth increment of 0.040
Target depth of -1.0
accuracy of 5

On the intersection points:  when you generate the lines, select only the largest one. (or do a "final cut").
Without selecting any other lines, do "edit/intersection points", and with a tolerance of 0.001". (I think I forgot to state the tolerance last time, and that's important)

You should see two points appear, but if you look at the points list, three are generated. I don't know exactly what is the problem that causes the points at all, but I know why there are three:

There is a "recursion" at the very end of the line, where the last point of the curve ends up higher than the start of the leadout.  I think that has to do with the math, also, because the difference is almost 0.008", which is larger than a rounding error or an integer/single/double conversion error.  Both the start point and end point of the line are higher than the ideal 1/2 tool diameter, and by the same amount.

Hope that helps.

LLoyd



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

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8360
    • View Profile
Re: Curved surface script
« Reply #34 on: July 09, 2014, 11:18:43 am »
oops, sorry.

Here's the beginning of the line.  It should start at X-0.8125,Y0, then X-0.8125,Y-.1875.   Instead it starts like this:
-0.8126784584534017   0   0                                   0
-0.8126784584534017   0   -0.17932136486899958   0
-0.80887315654514724   0   -0.26647710761665766   0
-0.79891184150461869   0   -0.33667451662567066   0

And here's the end.  It should end with X0.8125,Y-.1875, then X0.8125,Y0.   But it ends like this.  (note the recursion at the end)

0.80175225167722042   0   -0.32056575005353682   0
0.810298786584156   0   -0.25018208170639944   0
0.8126784584534017   0   -0.17932136486900044   0
0.8125                           0   -0.18750000000000006   0
0.8125                           0   0                                   0
         
LLoyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #35 on: July 09, 2014, 22:57:42 pm »
Many thanks, I will have another look at the problem with your data.

Geoff

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #36 on: July 10, 2014, 09:21:38 am »
Dear Lloyd

The "error" of 0.0001745.... is caused by the accuracy (or lack of it) selected.  If you reduce the accuracy to, say 1 deg, then the problem goes away.  As the accuracy approaches zero (it can't actually) the error will be zero. The error is caused by the straight line approximations for the curve.  In the next version I will allow smaller accuracy values down to a value that will allow up to 1000 line segments to be generated in a single polyline. This limit could be increase if required, and the expense of computation time.

On the intersection points this issue is related to the fact (I think) that CamBam only tests relative X and Y coordinate values to be within tolerance (not the Z differences).  In this case (and depending on the accuracy level chosen) there may be a few line segments (in the polyline) that seem to "be close", especially those close to the near-vertical edge of the pocket.  If you change the tolerance then different numbers of "intersection points" will be generated.  Also if you decrease the accuracy value (so the curve has lots more segments) then more "intersection points" will be found.

The "recursion" near the end of the cut is also related to the accuracy setting, but it does appear in your sample in the range of 4.9 to 5.0, and not at other values! I will continue to look at this one.  I am also still looking at the odd "reverse" cuts near the centre of the pocket and putting back those central cut paths.

Geoff

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8360
    • View Profile
Re: Curved surface script
« Reply #37 on: July 10, 2014, 11:13:34 am »
Ok, Geoff, I grok the parts about the intersection points and the recursion, but not the part about the inaccuracy of the start, end, and mid points of the line.

The rest of this is not criticism, just my "thinking out loud", trying to work through a rationalization of the problem.

There's always a price for simulating a curve with segments.  The middle of each segment would sit on a curve of a smaller radius than the end points would, and THAT is controlled by the 'accuracy' (the number of segments.  If you do it for 1000 segments, the difference in radii becomes infinitesimal, but for only two segments (90-degree 'accuracy'), the middles of the segments would describe a much smaller curve than the end points of each segment.   The error should be exactly the difference between the two circles circumscribed about and inscribed within a polygon of 'accuracy*2' segments.

That does not affect the positional accuracy of the end points of each segment.  With the circumscribed example, the end points should always lie exactly on the arc of the curve.

With a ball-nosed cutter,  I'll bet much of that 'rounding' error would go away if the arc started and ended exactly one tool radius below the surface, and exactly one tool radius in from the ends of the seed line, instead of some 'calculated' distances.  In the example I tested, the start and end points were -0.179321364869, which is a LONG way from -0.1875.  It's enough off to suspect that it isn't due to 'segmenting' of the arc; most especially, because the start and end points should be 'fixed', not calculated.

Lloyd
« Last Edit: July 10, 2014, 13:22:38 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #38 on: July 12, 2014, 07:27:17 am »
Dear Lloyd and others

I am attaching my latest effort.  I think I have solved the problems with the strange over-cuts when using a larger diameter tool without removing the central cuts (as I did in vers 1.0.0.4), but further testing is required.

The accuracy issue is still there and will stay for the moment as it is a natural part of the method used to approximate the curved shape by a series of straight line segments, and only shows up (noticeably) when making a deep pocket (close to a full half circle) with a large diameter tool (relative to the size of the pocket) and with the accuracy set at a relatively low level (say 5 deg).  Generally the problem becomes insignificant by decreasing the accuracy value (more accurate curves).

I have increased the limits on the size of the generated polylines to allow for more accurate cuts to be made and also placed some reasonable limits on tool sizes to try to pick up extreme combinations.

Please keep the feedback coming as it is only through a active discussion that the bugs can be identified and resolved.

thanks

Geoff

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8360
    • View Profile
Re: Curved surface script
« Reply #39 on: July 12, 2014, 12:01:54 pm »
Geoff,
I'll play with it this evening -- tight work day, today.

However, I wanted you to know that I did some playing with CamBam's native functions to create a 'true' arc, convert it to polylines, and check the accuracy of conversion.

Yours is as good as the native CB functions, so I wouldn't worry much about it.

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

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8360
    • View Profile
Re: Curved surface script
« Reply #40 on: July 13, 2014, 01:30:19 am »
Geoff, very nice.  It does everything needed, so far as I can see.

If I had a 'wish' it would be to also set the tool type in the generated MOp.  Otherwise, it's easy to forget, and have to regenerate the g-code (IF I catch it!).

Technically, the tool type is not necessary to get the right code, but it's important to the prompts I get on my control when changing tools.

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

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #41 on: July 13, 2014, 02:34:38 am »
I am experimenting with a multilingual version of my Curved Surface plugin - trying to see how multilingual forms are handled in VS2010.  The attached version may(?) have a small number of labels in German ( :-[-my poor translation) - not all labels, only some.  In theory if the set language is German these labels should appear.  I cannot test this here as I do not seem to be able to switch languages in my W7pro.

If any one can test/verify this please let me know.  If this works then I will be able to complete the translation task with the help of native speakers out there.

I am attaching the test multilingual version.  I am assuming that all the required resource files are packaged in the DLL.

Geoff

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6211
    • View Profile
    • Cambam V1.0 French Doc
Re: Curved surface script
« Reply #42 on: July 13, 2014, 13:08:47 pm »
Hello Geof,

Cambam use a build-in translation system, not the regular Windows method.

You can find more infos and sources here.
http://www.cambam.co.uk/forum/index.php?topic=3553.msg29395#msg29395

then to do the translation file, you use this plugin.
http://www.cambam.info/ref/plugin.translations

++
David
« Last Edit: July 13, 2014, 13:13:16 pm by dh42 »

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8360
    • View Profile
Re: Curved surface script
« Reply #43 on: July 13, 2014, 21:06:59 pm »
Geoff,
I will suggest one 'major' change.  From the standpoint of establishing the geometry, I find no need for a 'seed line'.  It would be so much better (IMHO) if you simply allowed the location, length, width, and depth of the entire object to be specified in the configuration window.  If you wished to leave the seed line capability in there, that would be fine, but I see no need to actually require it.

Obviously, I do not know how that would affect your code, but the parameters are already in the window, so I'm not sure why one could not simply enter them, rather than requiring the seed.  I can change the entries, so why can't I just enter them "from scratch"?

This is not a criticism.  The plugin works nicely.  It's just a 'wish list'.

Lloyd
« Last Edit: July 13, 2014, 21:14:31 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline GeoffreyGRoy

  • Storm Trooper
  • ***
  • Posts: 201
    • View Profile
Re: Curved surface script
« Reply #44 on: July 14, 2014, 00:59:13 am »
Dear David

Thanks for the tips, I will follow up.  I only came across the CamBam approach yesterday.

Geoff