filter function confused

filter function confused

hx
Advocate Advocate
602 Views
2 Replies
Message 1 of 3

filter function confused

hx
Advocate
Advocate

About the filter function.
I use the filter function to get toolpaths which is set rest.active.

 

ENTITY LIST EntityToolpaths = filter(folder('Toolpath'), 'AreaClearance.Rest.Active==1')

 

 

But when I use filter to the toolpath which where use specify tool, it raise error infor.
Can somebody tell me why.

ENTITY LIST UseToolToolpaths = filter(folder('Toolpath'), "Tool.Name=='1'")

How can I to get the toolpath list which was use the tool 1.

0 Likes
Accepted solutions (2)
603 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution
ENTITY LIST UseToolToolpaths = filter(folder('Toolpath'), "Tool.Identifier=='1'")

Problem: The Tool.Identifier  not necessarily unique...

0 Likes
Message 3 of 3

urizenYHS3W
Advocate
Advocate
Accepted solution

The problem that you'll have is if one of the toolapths' doesn't have a tool. In such cases '"Tool.Name' will raise an error.

Try something like:

ENTITY LIST UseToolToolpaths = filter(filter(folder('Toolpath'), 'entity_exists(Tool)'),"Tool.Name=='1'")

the inner filter will return a list of toolapths that have a tool to the outer filter which then returns just the toolpaths that use the Tool named '1'.