586,308 active members*
3,840 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > PlanetCNC > IF statement returns unexpected value
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2009
    Posts
    14

    Question IF statement returns unexpected value

    I have a parameter _L2R, set to either 1 or 0.


    (txt,L2Rtxt,Neither)
    (print,$<L2Rtxt>)
    (print,#<_L2R>)
    if [#<_L2R> EQ 1] then (txt,L2Rtxt,Yes)
    if [#<_L2R> EQ 0] then (txt,L2Rtxt,No)
    (print,#<_L2R>)
    (print,$<L2Rtxt>)

    displays the following:

    Neither
    1
    1
    No

    So the L2Rtxt parameter is being set correctly to "Neither" originally; _L2R is set to 1 originally.
    The first if statement should then set L2Rtxt to "Yes"
    The second if statement should not do anything...but it's setting L2Rtxt to "No"

    Why?

  2. #2
    Join Date
    Mar 2017
    Posts
    1312

    Re: IF statement returns unexpected value

    IF..THEN was never designed to do this but I can fix it.
    You could also use Oword.

  3. #3
    Join Date
    Nov 2009
    Posts
    14

    Re: IF statement returns unexpected value

    Yes - if you fix it, can we also add the ELSE option?

    if [#<_L2R>] then (txt,L2Rtxt,Yes) else (txt,L2Rtxt,No)

  4. #4
    Join Date
    Mar 2017
    Posts
    1312

    Re: IF statement returns unexpected value


  5. #5
    Join Date
    Nov 2009
    Posts
    14

    Re: IF statement returns unexpected value

    This will be in next version, correct?

  6. #6
    Join Date
    Mar 2017
    Posts
    1312

    Re: IF statement returns unexpected value

    Yes, beta version will be published in few days here:
    https://cnc.zone/tng/tng

    I just need to finish all parameters testing:
    https://cnc.zone/tng/parameters/parameters

  7. #7
    Join Date
    Nov 2009
    Posts
    14

    Re: IF statement returns unexpected value

    Thank you!

  8. #8
    Join Date
    Mar 2017
    Posts
    1312

    Re: IF statement returns unexpected value

    This will also be an option in new version:
    https://cnc.zone/gcode/functions/func-strappend

Similar Threads

  1. Ball screw returns
    By crazybrit in forum BallScrew Repair
    Replies: 11
    Last Post: 02-20-2023, 02:37 PM
  2. Planet CNC returns
    By PhillS in forum PlanetCNC
    Replies: 2
    Last Post: 12-10-2019, 03:19 PM
  3. Alibre returns?
    By MichaelHenry in forum Uncategorised CAD Discussion
    Replies: 6
    Last Post: 11-25-2017, 01:51 PM
  4. Rapid returns on Planar
    By Beansdiesel in forum BobCad-Cam
    Replies: 2
    Last Post: 02-19-2016, 03:52 PM
  5. New Zenbot Returns to Zero Z axis high
    By alterimage in forum Benchtop Machines
    Replies: 4
    Last Post: 03-30-2013, 05:46 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •