Hello Guest it is April 18, 2024, 04:10:21 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Chaoticone

Pages: « 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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 »
151
Check the state and store in a variable. Then send message only if it and current state ~=

Stay away from loops when possible and don't spam the core (with 300 unnecessary messages).

152
Mach4 General Discussion / Re: Fusion 360 Cutter Comp "P" Value.
« on: May 02, 2019, 11:23:25 AM »
To find the differences in 2 screens scripts......... open each in Mach4 and then operator, view screen script, copy all and paste into notepad ++. With both versions of script open in a tab use their compare plugin. Every difference (no matter how small) will be made obvious.

153
Mach4 General Discussion / Re: Mach4 Timer Script
« on: May 01, 2019, 04:51:47 PM »
Yup, Craig is right. And I would not use the PLC loop count if accuracy is critical.

You could do some testing and adjust the script but things could change it (like adding more script to the PLC script itself). Would it ever change enough to matter in most cases? No but each line of code takes time to process.

Any of the following would yield more accurate results I think..... os.date, os.difftime, mc.mcCntlGetRunTime at the expense of added complexity.

All ways would have a rounding error.

Lots of ways to skin this cat. Knowing how good is good enough may be the determining factor.

154
Mach4 General Discussion / Re: Mach4 Timer Script
« on: April 30, 2019, 12:50:43 PM »
This might help if you go with my suggestion.

Code: [Select]
local scrName = scr.GetScreenName()
local inter = scr.GetProperty(scrName, "PLC Interval")

155
Mach4 General Discussion / Re: Mach4 Timer Script
« on: April 30, 2019, 11:42:38 AM »
I'm not sure about the RestartTimer but think I know how i would handle it.

In the PLC script keep up with spindle on time. If it's on increment a var. Once that var == Time wanted / scan time start a one shot timer for the amount of time I want the lube on, turn the lube output on and reset that var to 1. The timer would just turn the lube output off.

156
Mach4 General Discussion / Re: Mach 4 Mill CSS
« on: April 30, 2019, 10:55:19 AM »
In lathe it is handled in the default screens PLC script. I'm not sure but you may be able to adapt it to work for your purpose in doing some mill turning. The API says its for lathe but it may well work for mill too. Take note that it uses the X axis current position to determine diameter. Depending on how your doing things that may not work for you. But you could adapt it. Just pointing it out. It uses some screen elements so you would need to....

1) Save your screen as something new and unique.
2) Modify the new screen making sure it has all the elements needed (and named correctly).
3) Test

Here is the code that does the magic in lathe............

Code: [Select]
-------------------------------------------------------
--  Calculate CSS
-------------------------------------------------------
local NativeUnits, rc = mc.mcCntlGetUnitsDefault(inst)
local units, rc = mc.mcCntlGetUnitsCurrent(inst)
local xDia = mc.mcAxisGetPos(inst, 0)
local dia, rc = mc.mcCntlGetDiaMode(inst)

if (dia == 0) then
 xDia = (xDia * 2)
end

if (NativeUnits == 200) and (units == 210) then
 xDia = (xDia * 25.4)
elseif (NativeUnits == 210) and (units == 200) then
 xDia = (xDia / 25.4)
end

if (units == 200) then --Gcode is in inch mode (G20)
    mc.mcSpindleCalcCSSToRPM(inst, xDia, true)
elseif (units == 210) then --Gcode is in mm mode (G21)
    mc.mcSpindleCalcCSSToRPM(inst, xDia, false)
end

-------------------------------------------------------
--  CSS DRO
-------------------------------------------------------
local FeedRate, SpinRPM, CurrentCSS
FeedRate = scr.GetProperty ("droFeedRate", "Value")
FeedRate = tonumber(FeedRate)
SpinRPM = scr.GetProperty("droSpinRPM", "Value")
SpinRPM = tonumber(SpinRPM)
CurrentCSS = (FeedRate / SpinRPM)
if CurrentCSS ~= LastCSS then --We need to update our user DRO
    LastCSS = CurrentCSS --So we only update DRO when needed. Stops blinking DRO
    if (FeedRate > 0) and (SpinRPM > 0) then
        scr.SetProperty("droConstantSurfaceSpeed", "Value", tostring(CurrentCSS))
    else
        scr.SetProperty("droConstantSurfaceSpeed", "Value", "0.0000")
    end
end

157
Mach4 General Discussion / Re: plasma thc
« on: April 29, 2019, 11:05:33 AM »
Also, there are 3 different operation modes.

Manual, simple up and down buttons on the screen.

Digital, which takes an up or down signal from a TCH unit (like the proma).

Analog, which reads the actual voltage from a register. This can be used with any device that can tell Mach4 what the current actual voltage is using a register. So if your motion device has an analog input you can use to get the actual voltage from the plasma unit and can pass that value to a register you're good. Some use a simple PLC for this (like the click from Automation Direct).

The screen doesn't care what device you use. And the THC module doesn't even care if you use our default screen. Everything is controlled through registers. You can run THC using any screen. The values don't have the been shown in the screen anywhere. You can just enter values directly into the registers if you want. Design your own screen and if you want to display the register value, just link the screen element to that register. It's very flexible and as Steve said, should work for most.


158
Mach4 General Discussion / Re: os.execute pdf
« on: April 03, 2019, 08:51:31 AM »
Code: [Select]
local major, minor = wx.wxGetOsVersion()
    local dir = mc.mcCntlGetMachDir(inst);
    local cmd = "explorer.exe /open," .. dir .. "\\Docs\\MyDoc.pdf"
    if(minor <= 5) then -- Xp we don't need the /open
        cmd = "explorer.exe ," .. dir .. "\\Docs\\MyDoc.pdf"
    end
    wx.wxExecute(cmd)

159
Mach4 General Discussion / Re: scr list
« on: March 29, 2019, 10:24:57 AM »
Nice Craig!  :)

160
Mach4 General Discussion / Re: scr list
« on: March 28, 2019, 08:25:00 PM »
If you open a script in zerobrain editor and type scr. you will get a complete list I think. No docs on them but they are pretty self explanatory.

Pages: « 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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 »