Solved! Go to Solution.
Solved by rui_rita. Go to Solution.
Hi,
I use this...
string time = ""
string msg = "select toolpaths for Time statistics"
ENTITY LIST Toolpath = INPUT ENTITY MULTIPLE Toolpath $msg
CREATE NCPROGRAM ; EDIT NCPROGRAM ; QUIT FORM NCTOOLPATH
NCTOOLPATH CANCEL FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST FORM ACCEPT PROBINGNCOPTS
FOREACH tp IN Toolpath {
//EDIT NCPROGRAM ; APPEND TOOLPATH $tp.name
EDIT NCPROGRAM # INSERT Toolpath $tp.name LAST
}
EDIT STATISTICS NCPROGRAM ; FORM STATISTICS
$time = $widget('Statistics.Time').value
Message info "Time for Selected PGMs is " + $time
DELETE NCPROGRAM #
FORM CANCEL STATISTICS
Have attached macro below, save and rename from .txt to .mac
Thanks for the response and this usefull macro.
but what i need is a macro which shows me the time to calculate the toolpath of the whole project.
it wolud be perfect if the macro start the time, run a folder wtih uncalculated toolpath and shows me at the end a message with the complete time of calculation.
Hi,
this will run throu all toolpaths:
STRING $msg = ""
INT $start_time = 0
INT $tp_time = 0
INT $final_time = 0
INT $count = 0
INFOBOX NEW "Batch Time Process"
INFOBOX STYLE "NORMAL"
foreach $tp in FOLDER ('toolpath') {
$msg = " TOOLPATH: '" + $tp.Name +"' ->"
INFOBOX APPEND $msg
if not ( $tp.Computed) {
if ($tp.batch == 0) {
$msg = " Batch Process Off " + CRLF
} else {
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
ACTIVATE TOOLPATH $tp.name
$start_time = time()
EDIT TOOLPATH $tp.Name CALCULATE
$tp_time = time() - $start_time
if not ( $tp.Computed) {
$msg = " Could not Calculate!!!" + CRLF
} else {
$msg = " " + $time_to_string($tp_time ,"S") + CRLF
$final_time = $final_time + $tp_time
$count = $count + 1
}
}
} else {
$msg = " Already Calculated" + CRLF
}
DIALOGS MESSAGE ON
INFOBOX APPEND $msg
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
$msg = " Total Time for " + $count + " toolpaths: "+ time_to_string($final_time ,"S") + CRLF
INFOBOX APPEND $msg
Can't find what you're looking for? Ask the community or share your knowledge.