-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_nest.sbp
More file actions
120 lines (104 loc) · 5.17 KB
/
sample_nest.sbp
File metadata and controls
120 lines (104 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
'S_nest.sbp -- Program to NEST a single part on a sheet of material
'David Nadeau 5/28/01
' The following licensing information must accompany this file at all times.
' ********** Licensing Information **********
' Copyright 2001 ShopBot Tools
'
' We encourage ShopBot users to modify this part file to suit their own needs and have licensed it
' under the Creative Commons Atribution 3.0 license. This license allows you to copy, distribute,
' or modify the file with certain restrictions. Any other use requires permission from ShopBot Tools.
'
' A simplified explanantion of this license is available at
' http://creativecommons.org/licenses/by/3.0/us/
'
' and the full legal code can be found at
' http://creativecommons.org/licenses/by/3.0/us/legalcode
' We encourage you to read this legal code before modifying or distributing this file,
' ESPECIALLY sections 5 and 6 that cover warranties and liability.
'
' If you plan on distributing your new version, you must also state in the header of your file that it
' is a modification of a file supplied by Shopbot Tools, supply information on finding the original file,
' and rename the file to make it clear to the user that it is a modified version.
'
' ********** End Licensing Information **********
' User takes responsibility for the effects and outcomes of the use of this program, and ShopBot Tools assumes
' no liability it's use.
'Test Run this program in Preview Mode and with air-cutting above material to make
' sure you are satisfied that it is doing what you expect it to do.
'This program will prompt you for values to create layout.
'Make sure that your Part File is in the same directory as this
' file or you will need to enter a path name in front of your file
' name (for example, C:\sbparts\filename).
'This routine works best if your Part File has 0,0 set at it's bottom corner.
'Set your Tool's X=0,Y=0 at lower left corner of cuttable area of material.
'Set your Z=0 as you would for individual part.
'This program assumes you have already set the correct Move and Jog Speed values
'Initialize
SA 'set to absolute mode
SL 'clear all variables
&colcount=0 'set up counting variables
&rowcount=0
'Sample default values ... if you would like to run the file without prompts and
' using your own default values, just remove the " ' " from the last line of this
' section and the program will run with the defaults without the user prompts.
&partfile = "mypartfile.sbp" 'put the name of your Part File (with path) here
&xperpart = 5 'X distance needed per individual part
&yperpart = 5 'Y distance needed per individual part
&xgap = .5 'Desired gap between parts in X direction
&ygap = .5 'Desired gap between parts in Y direction
&zclear = 1 'safe Z clearance height between parts
&numcolumns = 17 'Number of parts to be cut along X axis
&numrows= 8 'Number of parts to be cut along Y axis
' GOTO Cutrow
'This is where we get the variables from user
PRINT " "
INPUT "Name of part file? (w/path, no .sbp)" &partfile
PRINT " "
INPUT "Length of each part (in X direction)?" &xperpart
INPUT "Width of each part (in Y direction)?" &yperpart
INPUT "Gap between parts in X direction?" &xgap
INPUT "Gap between parts in Y direction?" &ygap
INPUT "Clearance height for Z moves between parts?" &zclear
'Specify the number of parts in row and columns or compute from material
&answer=M 'default
INPUT "Cut by specifying (N)umber of parts OR by specifying (M)aterial size?" &answer
&answer="&answer"
IF &answer="M" THEN GOTO Material
'If we are just telling it how many parts to cut...
INPUT "Number of parts to be cut along the X axis?" &numcolumns
INPUT "Number of parts to be cut along the Y axis?" &numrows
GOTO Cutrow
Material:
INPUT "Enter cuttable length of material (along X axis)" &xcuttable
&xsizeper=(&xperpart+&xgap)
&numcolumns=(&xcuttable/&xsizeper)
&numcolumns=(&numcolumns-.5)\1 'make integer
PRINT &numcolumns, " parts will be cut in the X direction."
PAUSE 3
IF &numcolumns=0 THEN END
INPUT "Enter cuttable width of material (along Y axis)" &ycuttable
&ysizeper=(&yperpart+&ygap)
&numrows=(&ycuttable/&ysizeper)
&numrows=(&numrows-.5)\1 'make integer
PRINT &numrows, " parts will be cut in the Y direction."
PAUSE 3
IF &numrows=0 THEN END
Cutrow:
MZ, &zclear
¤tY = (&rowcount*(&yperpart + &ygap))
J2, 0,¤tY
Cutsingle:
MZ,&zclear
J2,(&colcount*(&xperpart + &xgap)),¤tY
FP,&partfile,,,,,2
&colcount=&colcount+1
IF &colcount < &numcolumns THEN GOTO Cutsingle
&colcount=0
&rowcount=&rowcount+1
IF &rowcount < &numrows THEN GOTO Cutrow
PRINT " Finished....Raising bit"
PAUSE 3
MZ, &ZCLEAR
PRINT " Cutting completed ! "
PAUSE 10
END