[MERGED] Approximate/rough guess of milling time

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
JoshM
Posts: 456
Joined: Thu Oct 05, 2017 5:34 pm
Location: New Hampshire

Re: Approximate/rough guess of milling time

Post by JoshM »

sliptonic wrote: Tue Feb 13, 2018 4:44 pm
sliptonic wrote: Tue Feb 13, 2018 4:35 pm
GeneFC wrote: Tue Feb 13, 2018 3:53 pm
sliptonic wrote: Tue Feb 13, 2018 3:35 pm Correct me if I'm wrong.
LinuxCNC Axis main screen.jpg

;)

Gene
Cool. I use gmoccapy and the version I have doesn't have that option. Nice.
Out of curiosity, why would you ever run with a rapid rate slower than the machine is able to go? I suppose during a first test run, you might want to minimize a chance of a crash. But with known gcode, I can't think of a case where the user would choose to go slower. That's not true of Feed. I can think of several cases where the operator would choose to go slower or faster, even with proven gcode.
I've limited my maximums from what my machine can "theoretically" do to what it can "reliably" do...
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Approximate/rough guess of milling time

Post by GeneFC »

sliptonic wrote: Tue Feb 13, 2018 4:44 pm Out of curiosity, why would you ever run with a rapid rate slower than the machine is able to go? I suppose during a first test run, you might want to minimize a chance of a crash. But with known gcode, I can't think of a case where the user would choose to go slower.
That is exactly the reason I slow down. Probably half of the things I do are not repeated, so I operate in "tryout mode" a lot of the time. (with my hand close to the E-Stop.)
JoshM wrote: Tue Feb 13, 2018 5:07 pm I've limited my maximums from what my machine can "theoretically" do to what it can "reliably" do...
I ran a lot of stress tests before finalizing my basic rapids and accelerations. I chose numbers that never gave dropped steps or other quirks. I greatly prefer a few percent more time compared to a few percent more scrap.

I work a lot in stainless steel, so feed rates are quite low, and rapids are not a very big portion of the total time. I can be pretty conservative without significant penalty.

Of course a job shop might take a different view of the value of time

Gene
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Approximate/rough guess of milling time

Post by Pauvres_honteux »

Anyone of ye merry cnc-owners being merciful and check "roivai's"script versus reality? Mabye it works on specific areas/volumes?
roivai wrote: Mon Feb 12, 2018 8:25 pm
Here's a quick scratch I made. It seems to output a number, I really did not have time to analyze/compare if it makes any sense. Does not support drilling cycles.

Code: Select all

import FreeCAD, FreeCADGui, Part, Path
from PathScripts.PathGeom import PathGeom

#select the Job object
sel = FreeCADGui.Selection.getSelection()
# the expected rapid feed is taken from the first tool controller in the Job
tc = sel[0].ToolController[0]
horizrapid = tc.HorizRapid


curX = 0
curY = 0
curZ = 0
curFeed = 0
time = 0
for cmd in sel[0].Path.Commands:
	if cmd.Name in  ['G0', 'G1', 'G2', 'G3']:
		p=Path.Path()
		p.addCommands([cmd])
		w, r = PathGeom.wireForPath(p, startPoint=FreeCAD.Vector(curX,curY,curZ))
		length = w.Length
		if 'X' in cmd.Parameters:
			curX = cmd.Parameters['X']
		if 'Y' in cmd.Parameters:
			curY = cmd.Parameters['Y']
		if 'Z' in cmd.Parameters:
			curZ = cmd.Parameters['Z']
		if cmd.Name == 'G0':
			curspeed = horizrapid.Value
		else:
			if 'F' in cmd.Parameters:
				curFeed=cmd.Parameters['F']
			curspeed = curFeed

		time = time + length/curspeed

print str(time) + " sec"
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Approximate/rough guess of milling time

Post by reox »

One reason you might slow down in production runs, is that the machine has some issue, but not too bad so you can continue with a lower feedrate... On our CNC machine we had the problem that the lead screws would start to vibrate on higher speeds, as somehow they would resonate with the motion. Therefore we reduced the speed during the program run.

What about the following option: Give the total estimate but split it also down into the separate parts, like G0, G1, ..., G81. For fancyness you could also calculate the average feed rate.

I tried the script btw, but I get this error message:

Code: Select all

Traceback (most recent call last):
  File "/home/reox/.FreeCAD/Macro/Milltime.FCMacro", line 20, in <module>
    w, r = PathGeom.wireForPath(p, startPoint=FreeCAD.Vector(curX,curY,curZ))
  File "/usr/lib/freecad-daily/Mod/Path/PathScripts/PathGeom.py", line 342, in wireForPath
    return (Part.Wire(edges), rapid)
<class 'Part.OCCError'>: BRep_API: command not done

Code: Select all

OS: Debian GNU/Linux testing (buster)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13247 (Git)
Build type: None
Branch: master
Hash: 5022c8df5cef0690f2c8acff4bcebd82655a5f04
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Austria (de_AT)
edit: okay I got it to run, the problematic commands are those:
('error', Command G0 [ F:40 Z:15 ])
('error', Command G0 [ F:40 Z:13 ])
('error', Command G0 [ F:40 Z:13 ])
('error', Command G0 [ F:40 Z:13 ])
from a helix drill operation. I tested it on a blank file and it worked there. Maybe the file is too old?

Anyways, the script tells me 163s - LinuxCNC says 2.2min (132s). I also runned it in the simulator and got to 3min 23s... Not sure where this difference comes from, but the script was a little bit closer ;) I plan to produce this thing in the next weeks or so, so maybe I remember and stop the time.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Approximate/rough guess of milling time

Post by Pauvres_honteux »

Easter is coming and... one would then of course have a virtual Easter egg mold! ;)

I could not make the script provided by roivai to work. Anyone else like to try?
.
Easter_egg_Milling_test.fcstd
(142.21 KiB) Downloaded 42 times
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Approximate/rough guess of milling time

Post by roivai »

Pauvres_honteux wrote: Sat Feb 17, 2018 1:39 pm Easter is coming and... one would then of course have a virtual Easter egg mold! ;)

I could not make the script provided by roivai to work. Anyone else like to try?
.
Easter_egg_Milling_test.fcstd
Did you get a "division by zero" error? The rapid feedrate was set to 0 in your file. I set it to 5mm/sec and got:
2852.46260517 sec
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Approximate/rough guess of milling time

Post by Pauvres_honteux »

roivai wrote: Sat Feb 17, 2018 7:07 pm ...The rapid feedrate was set to 0 in your file. I set it to 5mm/sec...
How did you change that? Here it´s blocked! In user interface that is.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Approximate/rough guess of milling time

Post by roivai »

Pauvres_honteux wrote: Sat Feb 17, 2018 8:29 pm
roivai wrote: Sat Feb 17, 2018 7:07 pm ...The rapid feedrate was set to 0 in your file. I set it to 5mm/sec...
How did you change that? Here it´s blocked! In user interface that is.
Did you try clicking this one?
2018-02-18-193642_1920x1080_scrot.png
2018-02-18-193642_1920x1080_scrot.png (71.6 KiB) Viewed 1576 times
By default those feed rates are bound to the setup sheet values, so another option is to go to SetupSheet and set it there, there you can simply edit it without clicking the expression icon.
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Approximate/rough guess of milling time

Post by reox »

I think you should edit that in the SetupSheet, especially when using LinuxCNC as it does not recognize those values...
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Approximate/rough guess of milling time

Post by Pauvres_honteux »

reox wrote: Mon Feb 19, 2018 9:08 am I think you should edit that in the SetupSheet...
I tried that but it was blocked/"greyed out".
I'll try roivai's version after work.

By the way, does it matter which post processor I choose? I didn't choose one... :oops:
Post Reply