How to use saved filter names in LISP routines

How to use saved filter names in LISP routines

Anonymous
Not applicable
973 Views
4 Replies
Message 1 of 5

How to use saved filter names in LISP routines

Anonymous
Not applicable

I do apologise for hitting up these forums yet again so quickly.  I promise I search through all the existing questions here and google half the internet before deciding I can't find any relevant answer before I post these.

 

Does anyone know how to use saved filter names/states in writting lisp routines?  i.e using the FILTER command I have saved 3 or 4 fairly complicated filters.  Because I don't know how to apply these filter names in writing lisp code, the best way I have found to use them is in recorded macro actions (but even then, the recorder does not retain which filter I applied so each playback will pause the routine until I select the filter I want to use).  To be honest, my ability to code lisp is at the extreme beginner stage anyway so macros have been my bread and butter.  Apart from what the members of this forum have been kind enough to write for me.

 

Before anyone asks, even if I did know lisp quite well, my saved filters are pretty complex with multiple nested begin end/or and end and/or situations.  I wouldn't know where to start if I was to try and grab the relevant entities (that meet certain conditions) in any lisp ssget type routine.  The examples of lisp that demonstrate how to select objects based on filters does not cover the complexity of what I need.

 

Someone savvy at lisp probably could code a way of selecting the objects in my saved filters but it would be quite complex code and that person would then have to write the entire code for what I want to do with the selection...many different actions for each saved filter set.

 

It would be much easier if I could just insert the name of the saved filter into the code in some way.  If someone could just demonstrate an easy example of that, then I would be able to do the work myself and write the subsequent lisp routines I want that use those names.  Much prefer that option than having to ask someone to write half a dozen routines for me.

 

Can someone please sing out if I've just missed something really obvious as what I'm asking doesn't feel like it should be too hard.

 

Thanks very much guys.

0 Likes
Accepted solutions (1)
974 Views
4 Replies
Replies (4)
Message 2 of 5

dlanorh
Advisor
Advisor

Have you tried

 

(ssget saved_filter_name)

I am not one of the robots you're looking for

0 Likes
Message 3 of 5

Anonymous
Not applicable

No joy on that.  Like I said though (and you probably already know, having answered so many of my problems, my lisp knowledge is SUPER limited)... its possible I'm not entering what you've suggested in correct syntax.  I've tried the filter save name with and without quotes, all manner of bracket variations etc... and nada.

0 Likes
Message 4 of 5

dlanorh
Advisor
Advisor
Accepted solution

I don't know a lot about filters set up with the filter command (I don't use it), only that they are stored in a file called "filter.nfl", and you can extract the dxf dotted pairs, but i can only currently make use of very simple filters.

 

You can use (setq path (findfile "filter.nfl")) to return the location of the filter file. This file would be a great help.

I am not one of the robots you're looking for

Message 5 of 5

Anonymous
Not applicable

Yes this seems to be the key.  The .nfl file lists each saved filter state in two ways; the first is ":ai_lisp" and the second way is "ai_string".  Copying from the "ai_lisp" version seems to work nicely.

 

Thank you

0 Likes