PDA

View Full Version : How do I do this?



knight_toolworks
03-01-2008, 11:24 PM
I am no programming expert and I need some help in setting this up. first I need to randomly select a point on my mounted zero plate to zero on. how do I set that script up?
also after the zzero command I want a pause and a question whats the thickness of the material? then I will input a number like .75 and have a jog command to .75.
how do I write this?

srwtlc
03-02-2008, 02:51 AM
I'm not sure how you would handle a random location each time without being asked for some input each time you run the file. Maybe something like assigning various locations to numbers and then inputting a number. Something like...

Input "Where would you like to go this time? (1-10)" &where

IF &where = 1 THEN GOSUB Location1
IF &where = 2 THEN GOSUB Location2
IF &where = 3 THEN GOSUB Location3
IF &where = 4 THEN GOSUB Location4
'etc.

'Return here to run your Zzero routine
'and then your material thickness query
'and set your axis values
'then
MSGBOX (You are now zeroed and ready to Bot and Roll,0,Zeroed)
END

'Sub Routines

Location1:
SR 'Set to relative move
J2,0.25,0.25
SA 'Set back to absolute
RETURN

location2:
SR 'Set to relative move
J2,0.375,-0.375
SA 'Set back to absolute
RETURN

location3:
SR 'Set to relative move
J2,0.00,0.375
SA 'Set back to absolute
RETURN

location4:
SR 'Set to relative move
J2,-0.25,0.5
SA 'Set back to absolute
RETURN

'etc.

__________________________________________________

For your material thickness question, you can do this...

INPUT "What is the material thickness?" &thick
JZ,&thick

You may want to utilize your safe Z value here also by loading the custom variables file with C#,90 like this.

C#,90 'Put this somewhere in the beginning of your file.

INPUT "What is the material thickness?" &thick
JZ,&thick
VA,,,0.0 'Set Z to zero if the material surface is to be zero.

JZ,&my_ZzeroSafeZ

I'm sure there are other ways, but this should give you some ideas. The programming handbook and the sample files are good places to go for examples and information.

harold_weber
03-02-2008, 09:15 AM
I think a routine to create a random number between 0 and 1 was given here in 2006:

http://www.talkshopbot.com/forum/show.cgi?tpc=312&post=36356#POST36356

Can you handle the programming from there?

knight_toolworks
03-02-2008, 09:07 PM
I got the z part working great. I will play with the random part. that is not a big deal really.

bcammack
03-03-2008, 09:49 AM
Take a look at this:


Zzero with random point selection

4662 (6.3 k)

Particularly the STARTMOVE routine at the end.