Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a macro that posts all my tools used in a toolpath for setups into a Notepad file.
The problem is if I have toolpaths that use the same tool they will show up in the list which I don't want and have to remove them manually. See video.
Is there a way to remove these duplicate tools from appearing in the Notepad list?
//This macro oders toolpaths by their setup
MKDIR "C:\Temp\Lineup"
STRING dir = "C:\Temp\Lineup" + "/" + project.Name + ".txt"
IF ($powermill.Status.MultipleSelection.First) OR ($powermill.Status.MultipleSelection.Total == 0) {
DELETE FILE $dir
}
STRING TOOLName=''
STRING LIST SetupList = {}
FOREACH SetupTP IN folder('setup') {
FOREACH TP IN components(SetupTP) {
int $Count = add_last(SetupList, TP.name)
}
}
ENTITY LIST $Selected_Toolpath = INPUT ENTITY MULTIPLE TOOLPATH "Select Toolpaths For List Of Tools" "" $SetupList
FOREACH $tp IN $Selected_Toolpath {
ACTIVATE TOOLPATH $tp
ENTITY Tool = ENTITY('Tool', '')
STRING LIST msgList = {}
// Check that the toolpath is computed and that it has at least 1 segment.
IF (NOT ENTITY('toolpath','').computed) OR (SEGMENTS(toolpath) == 0) {
RETURN
}
INT toolDia = ROUND(($Tool.Diameter * 25.4), 1)
IF (POSITION($Tool.Name, "MM") > -1) {
IF $Tool.Diameter == "0.059" {
STRING msg = "T" + $tool.Number.Value + " " + ROUND(($Tool.Diameter * 25.4), 1) + " " + "MM " + $Tool.Description + " " + ROUND($Tool.Overhang, 3) + " LONG"
INT $Ok = add_last($msgList, $msg)
} ELSEIF $Tool.Diameter != "0.059" {
STRING msg = "T" + $tool.Number.Value + " " + $toolDia + " " + "MM " + $Tool.Description + " " + ROUND($Tool.Overhang, 3) + " LONG"
INT $Ok = add_last($msgList, $msg)
}
} ELSE {
STRING msg = "T" + $tool.Number.Value + " " + $Tool.Diameter + " " + $Tool.Description + " " + ROUND($Tool.Overhang, 3) + " LONG"
INT $Ok = add_last($msgList, $msg)
}
FOREACH item IN msgList {
FILE OPEN $dir FOR APPEND AS "out"
FILE WRITE $item TO "out"
FILE CLOSE "out"
}
}
IF (size($Selected_Toolpath) != 0) {
OLE FILEACTION 'open' $dir
}
Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro
Solved! Go to Solution.