Hello Guest it is March 28, 2024, 09:17:54 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 »
571
Mach4 General Discussion / Re: Understanding Lua
« on: December 19, 2016, 08:41:54 AM »
Let me try to help and hopefully Daz will correct any mistakes I make.

The reason mcTouchOff's functions do not have a prefix (mcTouchOff.) is because none of its functions are called or available for use from outside the module. The only one that is, is the Dialog which is called from outside the module. It opens the dialog or user interface. Any other functions are only called form it. Not that the functions could not be used from outside the UI but from a support stand point its not something we wanted to do.

I did this example a few days ago. Its a very simple module that simply pops up a message box and displays the message parameter you pass it. You have 5 things to do to see all of.

1) Create and save a module.
2) Load the module with the screen so it can be used form screen elements.
3) Load the module with the macros so it can be called from macros (Mcodes).
4) Call the module passing it your message from a button.
5) Call the module passing it your message form a custom Mcode (m110 in the example).

Play with it. Break it, fix it, add to it and have some fun.

Code: [Select]
--This is the mcUserScript.lua module that goes in the modules folder
local mcUserScript = {}

function mcUserScript.UserMessage(Message)
if (Message == nil) then --No message was passed
Message = "No message passed" --If no message is passed this will be the default message
end
wx.wxMessageBox(Message)
end

return mcUserScript -- Module End

--This is what loads the module above.
--Add this to the modules load section of the screen load script so you can call its functions from buttons on the screen.
--Add this to the load_modules.mcs file in the macros folder of the profile that will be using it so you can call its functions from M codes.
package.loaded.mcUserScript = nil
us = require "mcUserScript"

--Put this in a buttons clicked script and when you click it a message box will pop up that says... No message passed
us.UserMessage() --This is not passing a message for the Message parameter so the message will be the default

--m110 goes in the macros folder of the profile that will be using it
function m110()

us.UserMessage("This is my message")

end

if (mc.mcInEditor() == 1) then
 m110()
end

572
Mach4 Plugins / Re: Pokeys Mach4 plugin LUA reference for LCD
« on: December 16, 2016, 05:02:25 PM »
Would be interesting to see if replacing your function with the last I posted fixes it.

573
Mach4 Plugins / Re: Pokeys Mach4 plugin LUA reference for LCD
« on: December 16, 2016, 04:15:45 PM »
Sounds like there is something wrong in some of your script somewhere.

You can take the script that's in the function and put it in a wizard........... then open that wizard and step through it to debug. That's usually what I do. I keep a wizard named test in my wizards directory just to play in.

574
Mach4 General Discussion / Re: Feed Rate Override Absolute Value?
« on: December 16, 2016, 03:39:24 PM »
Not sure exactly what your looking to do but jogging speed is only set as a percentage of max velocity. But with some math you can arrive at what percentage any speed would be.............. so you could have a DRO you enter a speed into.

You can do feed moves at any speed you want but you also have to know what position or distance.

The following example has a little of everything your looking for I think. Down script goes in a buttons down script event and the up script goes in the same buttons up script event. It will get the vale from the JogRate DRO and jog the X axis negative at 50% of that percentage and it will jog the Z axis positive at 100% of that percentage. Lets see what you can do with it........

Code: [Select]
--Down Script

local inst = mc.mcGetInstance()
local rate = scr.GetProperty("droJogRate", "Value")
rate = tonumber(rate)

mc.mcJogSetRate(inst, mc.X_AXIS, (rate/2))
mc.mcJogSetRate(inst, mc.Z_AXIS, rate)
mc.mcJogVelocityStart(inst, mc.X_AXIS, mc.MC_JOG_NEG)
mc.mcJogVelocityStart(inst, mc.Z_AXIS, mc.MC_JOG_POS)

--Up Script
local inst = mc.mcGetInstance()
mc.mcJogVelocityStop(inst, mc.X_AXIS)
mc.mcJogVelocityStop(inst, mc.Z_AXIS)

575
Mach4 General Discussion / Re: Feed Rate Override Absolute Value?
« on: December 16, 2016, 12:59:00 PM »
But Daz is right............ if you want to alter how that function works alter it in the function.

576
Mach4 General Discussion / Re: Feed Rate Override Absolute Value?
« on: December 16, 2016, 12:55:28 PM »
You can link the DRO to a register or a parameter and get those values in your script. You can also assign the DRO to neither and get the value property of the DRO. Like this.......

local rate = scr.GetProperty("droJogRate", "Value")

You can set the jog rate for all axis or each axis individually.

scr.SetProperty("droJogRate", "50")

mc.mcJogSetRate(inst, mc.X_AXIS, 50)

There isn't much you can't do really.

577
Mach4 Plugins / Re: Pokeys Mach4 plugin LUA reference for LCD
« on: December 15, 2016, 05:30:20 PM »
Try replacing your function with this..........

function YPenLCD(Axis, Line)
    local CurPos = scr.GetProperty("droCurrent" .. Axis, "Value")
    CurPos = string.format("%4.4f", CurPos)
    local hreg = mc.mcRegGetHandle(inst, "PoKeys_32062/LCD Line" .. Line)
    mc.mcRegSetValueString(hreg, Axis .. ":  " .. CurPos .. "          ")
end

578
Mach4 Plugins / Re: Pokeys Mach4 plugin LUA reference for LCD
« on: December 15, 2016, 04:47:42 PM »
Where your calling the function try putting the axis letter and line number in double quotes........ like this.

YPenLCD("X", "1")

I would just try in the plc scripts first run to start with. If when mach opens the LCD displays right (before any axis moves) you got it.

579
Mach4 Videos / Re: Creating a function for the Screen Load Script
« on: December 14, 2016, 03:01:08 PM »
You might want to enable "Deref Axes in E-Stop" in general Config. and see if it does about what you want. I don't think it will do all of it but should get you at least part of the way there.

580
Mach4 Videos / Re: Creating a function for the Screen Load Script
« on: December 14, 2016, 10:10:37 AM »
If I was selling machines I would force a reference when needed, no doubt about it. Reset would force a dereference and only slow jogging would be allowed until referenced. Soft limimts would be active at all times........ unless referencing.

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 »