![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hi, Does anyone have VB code to calculate the cut length of a G code program which is both in 2D and 3D forms. I do know that Cimco gives this option by default but i was trying to develop something independant of available softwares so that we can find the cut length at shop floor level. thanks |
|
#2
| |||
| |||
| Conceptually its not hard to do, but you'd have to interpret all the movement G codes to work out the distance travelled while also deciding if the cutter is in the work or not. Or you could just ignore all the rapids and only calculate the slow feeds on the assumption they are cutting actions although this might give an overestimate. How accurate does this need to be - do you need to include Z-traverses into/out of the work? |
|
#3
| |||
| |||
| Here is some code that I used in a program that will give the path length. It calculates the distance between the previous point and the current point. You could have a number of these adding up the path lengths of different feed rates. If F = 50 then numDist = Sqr((X2 - X) ^ 2 + (Y2 - Y) ^ 2) PathStep = Sqr(numDist ^ 2 + (Z2 - Z) ^ 2) PathLength = PathLength + PathStep End If X2 = X:Y2 = Y:Z2 = Z |
|
#5
| ||||
| ||||
| Here is the picture..Before dry running the G-code reset the Maintenance Hours in the dialogue by pressing the reset button. You not require to run the machine just calculate through the software. My 1000 cents |
| Sponsored Links |
|
#6
| |||
| |||
|
|
#7
| |||
| |||
Do you know of any ways to calculate near accurate machining time with the help of programs when i also take into account the machine acceleration and deceleration ? After finding the path length this would be my target since in large 3D programs involving high feed rates, i find there is a lot of mismatch between predicted time (path length / feed rate) and actual time on the machine due to acceleration and deceleration of machine in the corners. The problem is also with lots of rapid moves in rest milling routines. |
|
#8
| |||
| |||
|
|
#9
| |||
| |||
I think you will need to gather information from your machine as different machines performances will vary. Your code may need to analyse the path variations to include acceleration and deceleration of the machine in the corners. Sounds quite a task. Sorry...I don't have any code for the length of three axis arcs. I'll see what I can do. |
|
#10
| |||
| |||
| This code should calculate the arc length. Pi = Atn(1) * 4 If Left$(strGCode, 3) = "G02" Or Left$(strGCode, 3) = "G03" Then StepDist = Sqr((X2 - X) ^ 2 + (Y2 - Y) ^ 2) Radius = Sqr(I ^ 2 + J ^ 2 + K ^ 2) Adjacent = Sqr(Radius ^ 2 - (StepDist / 2) ^ 2) RadAngle = Atn((StepDist / 2) / Adjacent) DegAngle = RadAngle / Pi * 180 ArcLength = Radius * 2 * Pi / 360 * (DegAngle * 2) PathStep = Sqr(ArcLength ^ 2 + (Z2 - Z) ^ 2) PathLength = PathLength + PathStep I = 0: J = 0: K = 0 End If X2 = X:Y2 = Y:Z2 = Z Last edited by Kiwi; 08-02-2008 at 09:35 PM. Reason: simplfied code |
| Sponsored Links |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tape Length??? | ShortRunCNC | G-Code Programing | 1 | 05-12-2007 01:12 PM |
| cut to length | chathorne | General Metal Working Machines | 0 | 04-25-2007 10:47 AM |
| Anyone got any basic examples of a program using a subroutine/program? | Darc | CamSoft Products | 11 | 10-08-2005 11:45 PM |
| Max length of linear rod? | MrBean | DIY-CNC Router Table Machines | 3 | 03-05-2005 08:47 PM |
| total line length program? | ljoe1969 | General CAM Discussion | 6 | 01-09-2004 10:27 AM |