Author Topic: [polyradius] A script that could be useful for some  (Read 32888 times)

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6933
    • View Profile
    • Cambam V1.0 French Doc
Re: A script that could be useful for some
« Reply #30 on: February 20, 2015, 16:34:57 pm »
Ok Lloyd,
oui suivant les logiciels de dessin, il n'y a pas d'arc mais des secteurs ou polylignes et dans ce cas cela pose des problemes pour retrouver les rayons mini.
---
Ok Lloyd,
yes next drawing software, there is no arc or polyline sectors but in this case this causes problems to find the mini-rays.

Yves.

Hello,

Yes, but you can use "Arc Fit" to rework your polyline.

Oui, mais tu peux utiliser "Insérer des arcs" pour re-travailler ta polyligne.

http://www.atelier-des-fougeres.fr/Cambam/Aide/cad/EditPolyline.htm#insert_arcs

++
David

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8659
    • View Profile
Re: A script that could be useful for some
« Reply #31 on: February 20, 2015, 16:52:39 pm »
Yeah, but... (my life is dedicated to the "Yeah, but!")....

That's why I wrote "any line".  Although the arc-fit works it, it would be nice to be able to run such a routine on any selected shape and get a useful result.

(Perhaps the algorithm itself might make a copy and do the arc fit in order to solve it).

There will be lines where straight segments join at apices, and for those, finding what cutter radius would work to the user's 'closeness choice' would seem a nice feature.

Of course, no cutter - except one of zero diameter - could properly cut such a union.

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

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6933
    • View Profile
    • Cambam V1.0 French Doc
Re: A script that could be useful for some
« Reply #32 on: February 20, 2015, 17:20:58 pm »
There is also the grooves smaller/equal than the tool diameter that cause problems, but how to detect that ?

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8659
    • View Profile
Re: A script that could be useful for some
« Reply #33 on: February 20, 2015, 17:23:06 pm »
I don't know -- but Andy does it!  So the code must be in there somewhere!

Actually, I think that for things like this, we should perhaps not think "brute force", and start seeking the mechanisms by which CamBam already does them.  I can write convoluted scripts with the best of them (maybe even Better! <G>), but I like tight code when I can do it.

Lloyd
« Last Edit: February 20, 2015, 17:25:33 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6933
    • View Profile
    • Cambam V1.0 French Doc
Re: A script that could be useful for some
« Reply #34 on: February 20, 2015, 17:42:47 pm »
Quote
I don't know -- but Andy does it!  So the code must be in there somewhere!

Yes, somewhere ....  ??? ... but not necessary accessible for us .. the CreatOffsetPolyline() do the job but the functions that it use internally are certainly hidden (protected)

++
david

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5083
  • Made in England
    • View Profile
Re: A script that could be useful for some
« Reply #35 on: February 20, 2015, 20:27:42 pm »
I can't get my head around it either, so I was thinking, toolpath is just an offset from the polyline by the radius of the tool. If the offset could be measured at some intervals then if it was calculated to be larger than tool radius, the tool would not fit. Of course it all has to be done in a script and are these parameters available ?

Edit: sorry, it seems I missed a load of posts while I was writing this, I'll just exit stage left and put the kettle on  ;D
« Last Edit: February 20, 2015, 20:42:17 pm by EddyCurrent »
Filmed in Supermarionation

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1605
    • View Profile
Re: A script that could be useful for some
« Reply #36 on: February 20, 2015, 22:25:57 pm »
Hi All
I had the same thought as Eddy, In that you could use the tool path distance property
and  subtract one from the other to determine if the cutter could cut along the shape to be cut.
So I made a square of 60 units by 60 units with a profile mop with a cutter of zero dimension
and CB came back with a distance 240 units.
Then made a profile mop using the same square with a cutter of 1 unit width and
CB came back with a distance of 243.1415926535.This struck me as the original 240 units plus PI.
This would not cut a square.
This is the original distance + the circumference of the cutter.
So to check this I made a square of 60.5 units X 60.5 units with a cutter of zero width
and this worked at 242 units which is what I thought it should be.
I guess what I'm saying is that the distance CB is reporting in the log window is an approximation.
Dave.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8659
    • View Profile
Re: A script that could be useful for some
« Reply #37 on: February 20, 2015, 22:35:04 pm »
Dave,
I've done all that, over and over.  It looks good... very intuitive... and falls apart completely on lines that are not completely 'convex'.

That's what I meant earlier when I said I could envision lines where the tool would 'roll' further than 360 degrees.  Try it with a closed line drawn in the form of a cruciform.

As far as I can tell, the reports in the log are quite accurate, not mere approximations.

We're all "hitting all around the ball"... close, just no exact hit, yet.  There's got to be a method in the UI to do this.  David's 'minimum radius' routine comes closest to serving the need than any other idea, so far.


Lloyd

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5083
  • Made in England
    • View Profile
Re: A script that could be useful for some
« Reply #38 on: February 21, 2015, 10:33:03 am »
Don't panic, this is a different ball I'm talking about now  :D

If a ball (tool diameter) rolls around a shape and it fits to that shape it will have one point of contact all the way around. If it won't fit to the shape it will at those points encounter two points of contact. This works for both inside or outside the shape. So some kind of collision detection maybe ?
Filmed in Supermarionation

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8659
    • View Profile
Re: A script that could be useful for some
« Reply #39 on: February 21, 2015, 11:54:10 am »
Now THAT is an idea, Eddy.  One of those "Eureka moments"!

Now... how to do that as if an integral function, rather than in discrete steps...

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

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1605
    • View Profile
Re: A script that could be useful for some
« Reply #40 on: February 21, 2015, 12:04:54 pm »
Hi All
Lloyd you are correct the log is accurate, But what I'd seen was still bugging me so I produced another file
with a 60 X60 square and 3 profile mops  with  cutter widths of  0 0.5 and 1 units and after examining the gcode and saw that the code was identical for the zero cutter width and the 1 unit cutter width and I realised that, if you specify a value of zero for cutter width, CB replaces this with a value of 1, otherwise (I think) with a profile mop you would get a </0> error.
In a couple of days I'll have a whole day to rummage through the UI to see what I can find.
And Eddy I think you might be onto something and I'll try to investigate this line of thought further.
Dave.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8659
    • View Profile
Re: A script that could be useful for some
« Reply #41 on: February 21, 2015, 12:30:10 pm »
No...... No; CB does not replace the cutter diameter, either in the MOp or the g-code.

Dave,  I just downloaded your example -- you've got the zero-cutter diameter MOP actually SET for a diameter of 1!

I have done this many, many times in the last week.  A cutter diameter of zero causes no divide-by-zero errors, and it exactly follows the polyline.

With the cutter diameters set correctly, here is the code: (stuff snipped that has nothing to do with the toolpath)

: CUTTER WIDTH 0
...
F800.0 X60.0
Y60.0
X0.0
Y0.0
...
: CUTTER WIDTH .5
...
G0 X0.0 Y-0.25
...
G1 X60.0
G3 X60.25 Y0.0 I0.0 J0.25
G1 Y60.0
G3 X60.0 Y60.25 I-0.25 J0.0
G1 X0.0
G3 X-0.25 Y60.0 I0.0 J-0.25
G1 Y0.0
G3 X0.0 Y-0.25 I0.25 J0.0
...
: CUTTER WIDTH 1
...
G0 X0.0 Y-0.5
...
G1 X60.0
G3 X60.5 Y0.0 I0.0 J0.5
G1 Y60.0
G3 X60.0 Y60.5 I-0.5 J0.0
G1 X0.0
G3 X-0.5 Y60.0 I0.0 J-0.5
G1 Y0.0
G3 X0.0 Y-0.5 I0.5 J0.0 

LLoyd
« Last Edit: February 21, 2015, 12:36:55 pm by lloydsp »
"Pyro for Fun and Profit for More Than Fifty Years"

Offline klystron

  • Ewok
  • *
  • Posts: 36
    • View Profile
Re: A script that could be useful for some
« Reply #42 on: February 21, 2015, 13:23:13 pm »
good morning LLoyd,
How's the research?
have a good weekend.
---
bonjour LLoyd,
comment vont les recherches ?
Bon week-end.

Yves.

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8659
    • View Profile
Re: A script that could be useful for some
« Reply #43 on: February 21, 2015, 13:29:24 pm »
Comme l'a dit M. Edison , "Je ne ai pas échoué. Je ai trouvé 10000 façons qui ne fonctionnent pas . "

----
"I have not failed.  I have found 10000 ways that do not work."

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

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5083
  • Made in England
    • View Profile
« Last Edit: February 21, 2015, 15:20:44 pm by EddyCurrent »
Filmed in Supermarionation