Results 1 to 3 of 3

Thread: having difficulties reading CSV data from sbp file...

  1. #1
    Join Date
    Aug 2012
    Location
    Victoriaville, QC, Canada
    Posts
    57

    Default having difficulties reading CSV data from sbp file...

    Hi there,

    Does anyone has any information or examples on reading data from a CSV file (csv=comma separated values) from a sbp script ? I mean using the <open file for input as #1> and <input #1,&varx,&vary> statements.

    I want to write a custom sbp file where the user inputs a position-ID and the sbp file reads a csv file where multiple x-y locations are defined and have a corresponding name. When the position name corresponding to position-ID is found, the script would move to that location.

    I have tried a couple of things but the doc are very vague on the subject and so far, it doesn`t work.

    The reason for this script is that I have to run the same toolpath at different locations that must be very precise and I want to decrease the possibility of error by using names instead of having the user enter position directly.

    thanks in advance for any help.

  2. #2
    Join Date
    Dec 2000
    Location
    Thorp, WI
    Posts
    2,783

    Default

    Sounds like you need an "IF CASE" statement. It's been asked for, but.....

    You could use a bunch of "IF THEN" looking for variables using your chosen names, which in turn have the locations for positioning and then the same file is run in 2D offset from that position.
    Scott

    "It’s easier to fool everyone than it is to convince them they've been fooled" - Mark Twain





  3. #3
    Join Date
    Aug 2012
    Location
    Victoriaville, QC, Canada
    Posts
    57

    Default

    I finally got it to work almost as intended. Using if case of if then was not an option because I create the position file from a spreadsheet.

    The main drawbacks of using the open, input and close statements that I could not improve upon are:
    1- the script cannot figure out if the data file' s format is not as expected... If the data is not formatted as expected the scripts spits out an error dialog and terminates (out of script control).
    2- the script cannot test if the data file is present or not and give the appropriate error message.
    3- the script has not easy way of detecting that we reached the end of the data file, it just gives an error message and terminates. This forces me to put a special data (marked END) at the last record in the file to test if all the data has been read without having an error.

    I feel back in 1970 as far as computing is concerned sometimes when it comes to sbp files but it's still a lot better than G-code.

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
  •