IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
REAL $feedspeed = INPUT "Enter Type & Operation"
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT $feedspeed
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
Good Day,
I have this macro which allows me to change the Speeds and Feeds of selected tools.
The only thing I have an issue with is the Type and Operation $feedspeed.
Currently I have to input 0 0 for Finishing General or 0 1 for Finishing Slotting and so on.
What I'd like is to have a drop down with all the Types and Operations to select from, but I'm not entirely sure how to go about doing this, any help would be much appreciated.
Regards
Solved! Go to Solution.
Solved by icse. Go to Solution.
Solved by icse. Go to Solution.
heres a simple example what you could do:
string list $operations = {'General', 'Slotting','Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT 0 $feedspeedIndex
}
you macro should look something like this then:
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $operations = {'General', 'Slotting','Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT 0 $feedspeedIndex
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $types = {'Finishing', 'Roughing'}
int $feedspeedIndexType = INPUT choice $types "Enter Type"
string list $operations = {'General', 'Slotting', 'Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT 0 $feedspeedIndex
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
Splendid,
Now how do I distinguish between Roughing and Finishing?
I came up with the above but am unsure how to apply.
So I have two indexes, one for the data type and one for the operation, and they're outputting the correct values,
I'm just unsure how to put both those values on the same line as
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $types = {'Finishing', 'Roughing'}
int $feedspeedIndexType = INPUT choice $types "Enter Type"
string list $operations = {'General', 'Slotting', 'Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT 0 $feedspeedIndexType + $feedspeedIndex
PRINT $feedspeedIndexType
PRINT $feedspeedIndex
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
Cheers, Now it works great
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $types = {'Finishing', 'Roughing'}
int $feedspeedIndexType = INPUT choice $types "Enter Type"
string list $operations = {'General', 'Slotting', 'Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT ${feedspeedIndexType} ${feedspeedIndex}
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
Sorry to be a pain but could you tell me why my coolant choice is failing?
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $types = {'Finishing', 'Roughing'}
int $feedspeedIndexType = INPUT choice $types "Enter Type"
string list $operations = {'General', 'Slotting', 'Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
STRING list $Coolanttype = {'None', 'On', 'Thru'}
STRING $C = INPUT CHOICE $Coolanttype "Enter Coolant Type"
$C = $Coolanttype
PRINT $C
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT ${feedspeedIndexType} ${feedspeedIndex}
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
EDIT TOOL $t COOLANT $Coolanttype
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
try this:
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $types = {'Finishing', 'Roughing'}
int $feedspeedIndexType = INPUT choice $types "Enter Type"
string list $operations = {'General', 'Slotting', 'Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
STRING list $Coolanttypes = {'None', 'Standart', 'Flood', 'Mist', 'Tap', 'Air', 'Thru', 'Both'}
int $index = INPUT CHOICE $Coolanttypes "Enter Coolant Type"
string $Coolanttype = lcase($Coolanttypes[$index])
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT ${feedspeedIndexType} ${feedspeedIndex}
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
EDIT TOOL $t COOLANT ${Coolanttype}
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
Strange,
It's returning the correct coolant type when I PRINT $Coolanttype but fails with this in the command window.
**** EDIT TOOL $t COOLANT ${Coolanttype}\n
**** --------------------^ Unexpected input !!
Error in Network : tool ( CoolantCmd )
Last Valid Token : COOLANT extracted by graph [ COMMAND ]
Received input : " ${Coolanttype}\n"
I tried without the curly brackets but got the same result.
oh ok you could try:
string $cmd = "EDIT TOOL '" + $t.Name + "' COOLANT " + $Coolanttype
docommand $cmd
or
$t.Coolant = $Coolanttype
insted of:
EDIT TOOL $t COOLANT ${Coolanttype}
both should work
Many thanks,
I used the 2nd option,
Here's the working Macro.
IF $powermill.Status.MultipleSelection.First OR $powermill.Status.MultipleSelection.Total == 0 {
reset localvars
DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK
if size(explorer_selected_entities()) <= 0 or explorer_selected_entities()[0].RootType != 'tool' {
return
}
string list $types = {'Finishing', 'Roughing'}
int $feedspeedIndexType = INPUT choice $types "Enter Type"
string list $operations = {'General', 'Slotting', 'Profiling', 'Face Milling', 'Drilling', 'Plunge Milling', 'Copy Milling'}
int $feedspeedIndex = INPUT choice $operations "Enter Operation"
STRING list $Coolanttypes = {'None', 'Standard', 'Flood', 'Mist', 'Tap', 'Air', 'Thru', 'Both'}
int $index = INPUT CHOICE $Coolanttypes "Enter Coolant Type"
string $Coolanttype = lcase($Coolanttypes[$index])
PRINT $Coolanttype
REAL $speed = INPUT "Enter Cutting Speed"
REAL $feed = INPUT "Enter Feed/Tooth"
foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {
EDIT TOOL FEEDSPEED SELECT ${feedspeedIndexType} ${feedspeedIndex}
EDIT TOOL $t SURFACESPEED $speed
EDIT TOOL $t FEEDPERTOOTH $feed
$t.Coolant = $Coolanttype
}
DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK
}
Can't find what you're looking for? Ask the community or share your knowledge.