CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 07-31-2008, 04:32 AM
 
Join Date: May 2008
Location: India
Posts: 85
yaji63 is on a distinguished road
Finding Cut Length of a 2D & 3D Program

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
Reply With Quote

  #2   Ban this user!
Old 07-31-2008, 04:47 AM
 
Join Date: Jul 2008
Location: UK
Age: 54
Posts: 411
irving2008 is on a distinguished road

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?
Reply With Quote

  #3   Ban this user!
Old 07-31-2008, 06:50 AM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,040
Kiwi is on a distinguished road

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
Reply With Quote

  #4   Ban this user!
Old 07-31-2008, 07:05 AM
Khalid's Avatar  
Join Date: Apr 2006
Location: Pakistan
Age: 32
Posts: 2,850
Khalid is on a distinguished road

If u have Mach3 then run the programm and then check in the 'Maintenance Hour' menu.
Reply With Quote

  #5   Ban this user!
Old 07-31-2008, 07:11 AM
Khalid's Avatar  
Join Date: Apr 2006
Location: Pakistan
Age: 32
Posts: 2,850
Khalid is on a distinguished road

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
Attached Thumbnails
Click image for larger version

Name:	Maintenance Hour.JPG‎
Views:	66
Size:	161.1 KB
ID:	64049  
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-01-2008, 12:21 PM
 
Join Date: May 2008
Location: India
Posts: 85
yaji63 is on a distinguished road

Originally Posted by irving2008 View Post
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?
Yes i do need the rapid moves also taken into account as in certain 3D programs there are lots of rapid moves generated in the NC path when i generate rest milling paths.
Reply With Quote

  #7   Ban this user!
Old 08-01-2008, 12:29 PM
 
Join Date: May 2008
Location: India
Posts: 85
yaji63 is on a distinguished road

Originally Posted by Kiwi View Post
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
Thanks a ton. I will use this and give you the feedback.

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.
Reply With Quote

  #8   Ban this user!
Old 08-01-2008, 11:44 PM
 
Join Date: May 2008
Location: India
Posts: 85
yaji63 is on a distinguished road

Originally Posted by Kiwi View Post
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
I have encountered a problem. The code above seems to take care of only linear moves where as my program has both linear and circular moves (G03, G03). Do you have the codes for calculating length of circular moves in all three planes ? (XY, YZ and XZ planes).
Reply With Quote

  #9   Ban this user!
Old 08-02-2008, 12:00 AM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,040
Kiwi is on a distinguished road

Originally Posted by yaji63 View Post
.................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 ..................and actual time on the machine due to acceleration and deceleration of machine in the corners........
Unable to help any further with code.
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.

Originally Posted by yaji63 View Post
......Do you have the codes for calculating length of circular moves in all three planes ? (XY, YZ and XZ planes).
Sorry...I don't have any code for the length of three axis arcs. I'll see what I can do.
Reply With Quote

  #10   Ban this user!
Old 08-02-2008, 05:18 AM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,040
Kiwi is on a distinguished road

Originally Posted by yaji63 View Post
.................... Do you have the codes for calculating length of circular moves in all three planes ? (XY, YZ and XZ planes).
You may need to make the variables X,X2,Y,Y2,Z,Z2,I,J,K, all Abs (eg: Abs(Z)) as not sure if this code is correct when some values have minus values.
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
Reply With Quote

Sponsored Links
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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




All times are GMT -5. The time now is 10:15 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361