Simple 'facing' script...

Share and discuss VBScripts here

Simple 'facing' script...

Postby kiwichris » Thu Apr 19, 2007 8:05 am

I posed this on another forum site, but thought it'd be a good idea to post it here as well.

Open notepad, copy'n'paste the text below the 'tear here' line into it, and save in c:\Program Files\NCPlot2.0\scripts It'll then appear under the scripts button in NCplot to use..

The script asks for X Y and Z figures, plus stepover, being the X and Y dimensions of the area to surface, and Z is the cut depth. Stepover is the stepover, or how far the cut steps for each pass.

The ends of each cut are an arc so that if your controller does continous profiliing it'll be a little faster. The arcs are outside the X/Y dimensioned area though.

You'll need to add leadin/out code, and you can shift it around using the shift tools in NCPlot if you want to use it as part of a larger program.

I've only used this for facing fixtures on a friends mill, and surfacing the spoil on my small DIY router, but I'm sure there are other good uses for it!

<-- -------------------------Tear here------------------------>
' Chris H's quick'n'dirty surfacing script...

' (C) Who cares!
' email: chris@trash.co.nz
' (for NCPlot V2.0)

' version string for window boxes.
dim version
version="Surfacing 1.00?"

' precision of Gcode output numbers. (number of digits behind decimal place)
dim prec
prec=3

dim x,y,z ' variables for target sizes
dim xx,yy ' variable used in loop.

dim stepover ' size of steps

x = InputBox("X Dimension of Area",version)
y = InputBox("Y Dimension of Area",version)
z = InputBox("Z height of cut",version)

stepover = InputBox("Stepover",version)

ncplot.ncpinsertline "("+version+")"
ncplot.ncpinsertline "(Check this code!!!)"
ncplot.ncpinsertline "(!!! You may need to add leadin-leadout code !!!)"
ncplot.ncpinsertline "(Don't forget to put in a feed rate.)"

ncplot.ncpinsertline "G01 X0 Y0 Z"+z ' start position.

' the loopy thing..
for yy=0 to y step stepover*2
' the first pass is just a G01, subsequest are G02 to move up a bit.
if yy=0 then ' if the first pass
ncplot.ncpinsertline "G01 X0 Y"+ FormatNumber(yy,prec) ' go to start position.
else
ncplot.ncpinsertline "G02 X0 Y"+ FormatNumber(yy,prec) + " I0 J"+FormatNumber(stepover/2,prec) ' up a bit.
end if
ncplot.ncpinsertline "G01 X" + FormatNumber(x,prec) + " Y"+ FormatNumber(yy,prec) ' first horizontal line.
ncplot.ncpinsertline "G03 X" + FormatNumber(x,prec) + " Y"+ FormatNumber(yy+stepover,prec) + " I0 J"+FormatNumber(stepover/2,prec) ' up a bit.
ncplot.ncpinsertline "G01 X0 Y"+ FormatNumber(yy+stepover,prec) ' and back.
next

' update view in NCPlot.
ncplot.ncpplot
NCPlot.NCPColorize

<-------------------------- End of script ------------------------>
kiwichris
 
Posts: 1
Joined: Thu Apr 19, 2007 5:05 am
Location: New Zealand

Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron