PDA

View Full Version : Using a variable for an .sbp with the FP command?



byoc
01-06-2007, 07:12 PM
I wrote a bit of code that chooses from several .sbp files and drops them into a template. I'm running into a problem when using a variable for the first parameter (file name)of the FP command. I'm using the INPUT command to get the file name from the user but the FP command doesn't seem to recognize the variable from the FP command. Any suggestions?

paco
01-06-2007, 07:22 PM
Post the code here...

byoc
01-06-2007, 09:06 PM
sorry, but it doesn't "tab" when it renders on the forum. Anyways....The program is supposed to take anywhere from 1 - 4 different 2" x 4" .sbp files and "nest" as many as you tell it to inside a 48 x 96 area.


&number_of_files = 1

'question 1

bill.young
01-06-2007, 09:38 PM
Hey Keith,

Looks like you forgot the "&" in the variable names for the filenames in your FP commands. They should be...

FP, &fp1,,,,,2
FP, &fp2,,,,,2

..etc

beacon14
01-07-2007, 12:51 AM
also in the "number of files" counter

&number_of_files = number_of_files + 1

should be

&number_of_files = &number_of_files + 1


This error trips me up occasionally as well

Brady Watson
01-07-2007, 03:42 AM
This file is included in the SBParts folder, already setup to do nesting. Take it & modify it for your own use.

FYI - All .sbp files in the SBParts folder that have a 'S_' prefix, denote that they are sample files, meaning that they are a good foundation for modifying & customizing to suit your particular needs.

-B



3995 (4.2 k)

byoc
01-07-2007, 03:53 AM
Thanks Bill and Dave. I actually haven't tried the code that I copy/pasted above. I just finished the training at the shopbot factory and I was having problems with this when trying it out on their training comps. Everyone there was super cool, but this wasn't what they were discussing at the time and I was kinda off in my own world utilizing the things that I had just learned that pertained to what I wanted to do with my machine, so I didn't want to interupt the lecture with something that was completely off topic.

Anyways...thanks for pointing out those errors. The "number_of_files" counter is something that I just added in the hotel on my laptop without trying it out, but I think I did leave the "&" off the fp"X" variables when I was running this in the shop. So I'll edit this new code and give it a go in the morning (had a little bit too much to drink this evening).

Aside from typos, do you guys think this code is logically sound?

p.s. I was initially planning to write a much more complicated UI in VB6 to do this operation until Ted told me to check out "Bill's Corner". That's where I became aware of the very simple INPUT command. It's pretty cool how similar shopbot code is to Q-BASIC....takes me back to highschool programming class. Thanks Bill!

byoc
01-07-2007, 03:57 AM
Thanks, Brady.

For daily use, I think my code is far more efficient. One thing I noticed in that code though is that it suggests you supply the file path. Is that something I need to do when I enter the .sbp file in the INPUT field? I don't recall this being a necesity in the example Ted showed us.

bill.young
01-07-2007, 10:38 AM
Keith,

(Hope Brady doesn't mind if I jump in on his question!)

You can use relative paths when calling part files, as long as you know where they are in relation to the file that's calling them. For instance, if all the files are in the same folder then you can just call them by name like...

FP, file1.sbp
FP, file2.sbp

If the files you were calling are in a subfolder ( called "files" maybe) then you could call them like this...

FP, \files\file1.sbp
FP, \files\file2.sbp

You can also go "up" a folder using "..\" for each level that you want to go up. So if "file1.sbp" is in a folder and the file that's calling it is in it's subfolder, it could be called like this...

FP, ..\file1.sbp

If you don't know where the file is in relation to the file that's calling it, though, then you have to use the full path like...

FP, C:\SbParts\S_sblogo.sbp

Good start with your programming. I'll dig through your code more thoroughly in a little bit and let you know if I see any ShopBot-specific syntax issues that might cause problems.

Bill

bill.young
01-07-2007, 02:33 PM
Hey Keith,

In your file you have this line toward the end...

IF &count4 > OR = &qty4 THEN GOTO END

You don't need the OR between the ">" and the "=", so that line (and any others in the file with the same test) should be...

IF &count4 >= &qty4 THEN GOTO END


Also END is a programming command so you can't have a GOTO statement direct you to it...a GOTO can only go to a label. That line can either be...

IF &count4 >= &qty4 THEN END

or

IF &count4 >= &qty4 THEN GOTO end_of_file

Like the lines above.

don_roy
01-27-2008, 05:51 PM
can anyone tell me where to find sopbot variables
THANKS DON

paco
01-27-2008, 06:07 PM
Default installation location is

C:\Program Files\ShopBot\ShopBot 3\Help\ShopBotSystemVar.pdf

bill.young
01-27-2008, 06:12 PM
They're also at the end of the Programming handbook "ProgHand.pdf" that's in your "C:\Program Files\ShopBot\Developer Tools" folder.

Bill

don_roy
01-28-2008, 08:18 PM
Thanks Guys