Is there a faster way to order the list of tools by their diameter and name?

Is there a faster way to order the list of tools by their diameter and name?

iamcdn79
Mentor Mentor
2,485 Views
3 Replies
Message 1 of 4

Is there a faster way to order the list of tools by their diameter and name?

iamcdn79
Mentor
Mentor

Right now I have a working macro that reorders my list of tools by their diameter and then their name but it is slow. Was wondering if there could be a faster way that would be instantaneous and not have to watch each tool being moved.

 

Attached is a video of what the macro looks like and the macro 

// First sorting operation on the second option (name)
FOREACH tl IN (sort(folder('tool'),'name')) {
ORDERSESSION Tool $tl.name FIRST
}
// Second sorting operation on the main criteria ( diameter)
FOREACH tl IN (sort(folder('tool'),'diameter')) {
ORDERSESSION Tool $tl.name FIRST
}

 

 


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

0 Likes
Accepted solutions (1)
2,486 Views
3 Replies
Replies (3)
Message 2 of 4

ondrej.mikulec
Advocate
Advocate

In this case, the sorting time can be cut in half if you prepare a sorted list with all the criteria and only then apply the sorting.

ENTITY LIST toolsSorted = sort(folder('Tool'),'name')
$toolsSorted = sort(folder('Tool'),'diameter')

FOREACH tl IN toolsSorted {
	ORDERSESSION Tool $tl.name FIRST
}

 

I also noticed that Windows 11 has faster handling of the entity tree. But that's just my anecdotal experience and I'm actually still using Windows 10.

0 Likes
Message 3 of 4

iamcdn79
Mentor
Mentor

Yes, that is faster but it doesn't give me the list of tool names in the correct order. see below

 

iamcdn79_0-1686763571674.png

 

 


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

0 Likes
Message 4 of 4

ondrej.mikulec
Advocate
Advocate
Accepted solution

I'm sorry, the code before has a bug.

ENTITY LIST toolsSorted = sort(folder('Tool'),'name')
$toolsSorted = reverse($toolsSorted)
$toolsSorted = sort($toolsSorted,'diameter')

FOREACH tl IN toolsSorted {
	ORDERSESSION Tool $tl.name FIRST
}