Find an Replace - save object selection set

Find an Replace - save object selection set

thomas_schluesselberger
Advocate Advocate
1,710 Views
22 Replies
Message 1 of 23

Find an Replace - save object selection set

thomas_schluesselberger
Advocate
Advocate

Hi,

 

I'm looking for a lisp to improve on the standard "find and replace" command.


With the standard command, the object selection resets every time I close the command. That's pretty annoying because I have to mark the objects to be searched again every time.
So i need a lisp (or maybe a workaround) that saves the selection.

 

Just to make shure what i want, this is the workflow i have:

> Execute search command

> mark objects that are to be searched

> create a selection set from the list, depending on whether only individual objects or all objects

> make various changes > execute search command

> the same objects that are to be searched should be marked

(if objects have been deleted from them in the meantime, the search should still be done with the objects that still exist)

 

 

0 Likes
Accepted solutions (3)
1,711 Views
22 Replies
Replies (22)
Message 21 of 23

thomas_schluesselberger
Advocate
Advocate

Hello @Kent1Cooper 

 

I would like to improve the program you wrote.

I would like a way to add extra objects to an existing object selection.

So a third command with which the current object selection is marked and I can add extra objects.

 

Any ideas of how you can make that?

🙂 

0 Likes
Message 22 of 23

Accepted solution
Soooo.....

I did it myself!
I just added a third command with: (sssetfirst nil *FFss*)

This selects the current objectselection and now i can add objects to it.
0 Likes
Message 23 of 23

Kent1Cooper
Consultant
Consultant

@thomas_schluesselberger wrote:
.... (sssetfirst nil *FFss*) ... selects the current objectselection and now i can add objects to it.

But then, you need to use FF again to establish that enlarged selection into the *FFss* global variable as the set for the FFF command to use.  If you want to do that without invoking FF again, try this FFA command:

(defun C:FFA (/ n ss); = FF system - Add to selection set
  (if (not *FFss*) (setq *FFss* (ssadd))); if not present, make it [initially empty]
  (repeat (setq n (sslength *FFss*)); highlight what's in it w/o selecting
    (redraw (ssname *FFss* (setq n (1- n))) 3)
  ); repeat
  (prompt "\nTo add to FF Selection Set,")
  (if (setq ss (ssget))
    (repeat (setq n (sslength ss))
      (ssadd (ssname ss (setq n (1- n))) *FFss*)
    ); repeat
  ); if
  (sssetfirst nil *FFss*)
  ;; keep above line to be left with set selected/gripped/highlighted
  ;; (command "_.regen");; instead, to have selection/highlighting cleared
)

Of course, it requires you to invoke the FFA command, which is no savings over needing to invoke FF again, but may seem more logical, or something.

 

Come to think of it, your approach has an advantage, in that it also allows you to "ensmall" the set, too, by un-selecting objects if you want, before FF again to redefine the set in the *FFss* variable.

Kent Cooper, AIA
0 Likes