Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Long pause screws up work, and programing question

  1. #11
    Join Date
    Jun 2005
    Location
    Portland, Oregon
    Posts
    71

    Default

    Hi David. That would not work for me as I needed to test more than one condition to trigger a single event. Testing the vars in "isolation" would not get me what I needed in this case.

    I was hoping that Ted and Gary were saying above that it was possible to test multiple conditions that would trigger a single action by using some sort of multi-line syntax.

    That would be great to have on a wish list for the control SW.

  2. #12
    Join Date
    Apr 2003
    Location
    ShopBot Tools, Inc, Durham NC
    Posts
    187

    Default

    Here's an example of one way to do your test.

    IF &y < 3 THEN GOTO True_y
    GOTO Continue
    True_y:
    IF &x < 5 then GOTO True_both

    Continue:
    'Your main stuff or a GOSUB Here
    END

    True_both:
    GOSUB Skip
    END

  3. #13
    Join Date
    Oct 2000
    Location
    Atlanta GA
    Posts
    1,499

    Default

    Howie,

    Did you try it or are you just assuming it won't work? I think this is one version of the multi-line syntax they are referring to.

    I am assuming in this case that &xcount and &ycount will be integers (whole numbers, not fractions); if that is not correct you'd have to change the equations a little but the logic should still work.

    Let's look at the logic of each line:

    If &xcount > 2 Then GOTO Next

    In this case if &xcount is 0, 1 or 2 (ie, less than 3) then control will pass to the following line, but if &xcount is 3 or more the following line will be bypassed and the file will continue with the 3rd line, the "Next:" label.

    If &ycount < 5 then GOSUB skip

    This line only tests the &ycount variable, but this line will never be evaluated unless the &xcount variable is less than 3 due to the If/Then in the first line.

    So the first two lines, taken together, do the same logic test as what you wanted in your original post, "if &xcount < 3 and &ycount < 5 then GOSUB skip"

    I hope this makes sense. Ted beat me to the post but unless I am mistaken my three lines will do the same thing as what he posted. In programming, as in ShopBotting, there is always more than one way to make something work.

  4. #14
    Join Date
    May 2006
    Location
    , South Daytona Florida
    Posts
    408

    Default

    Decomposing a multi-conditional test works. Most compilers don't perform the 2nd conditional test if the first conditional test fails. Why should it? (meaning:if "this" AND "that". if "this" OR "that" decomposes differently.)

    Back when dinosaurs roamed the earth, I used this fact to construct a precompiler for Basic language that didn't support conditional looping, ElseIf, Case statements, or most other sophisticated conditional structures that are commonplace today.

  5. #15
    Join Date
    Jun 2005
    Location
    Portland, Oregon
    Posts
    71

    Default

    David, Ted-

    Thanks much for the examples...those make sense now that I have had a chance to mess with it for a bit.

Similar Threads

  1. Roughing and finishing programing question
    By maverickx50 in forum Techniques for Cutting, Drilling, Machining
    Replies: 12
    Last Post: 12-18-2015, 01:38 PM
  2. Another new shop bot user with a programing question
    By JimMetully in forum ShopBotter Message Board
    Replies: 8
    Last Post: 06-01-2014, 01:25 PM
  3. driver programing
    By 2006prt in forum ShopBotter Message Board
    Replies: 1
    Last Post: 02-26-2014, 02:09 PM
  4. Advnced Programing Question
    By jve in forum Archives2007
    Replies: 11
    Last Post: 05-17-2007, 12:19 AM
  5. VFD Programing
    By les_linton in forum Archives2006
    Replies: 11
    Last Post: 04-11-2006, 06:31 PM

Posting Permissions

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