Jump to content

Add every new object to a selectionset, how to do that?


Recommended Posts

Posted

I wonder if this is possible, and if so, how to approach this.

 

At one point I want to give a command like "START" and after some time I will give the command "STOP".

 

Every item (lines, plines, text, blocks etc.) that was created between "START" and "STOP" should be added to a selection set.

 

I guess this should be done with a reactor?

 

Any help is much appreciated!

 

BTW I am not asking for you guys to program, I just need some hints, links or maybe small pieces of code to get started.

Posted

Hi marco .

 

You can add the previous created object by the use of function ssadd to add to the current selection set .

 

Example .

 

(setq ss (ssadd))
(command "_.line" '(0. 0. 0.) '(1. 0. 0.) "")
(ssadd (entlast) ss)

And so on .... Hope this what you mean :)

 

Tharwat

Posted

Hi MarcoW,

 

Consider marking the last entity (entlast) in the drawing before running your command. When your command finishes loop through the database from that enity (entnext ) & add each ename to the selection as per Tharwat's suggestion

 

Jammie

Posted

@ Tharwat & Jammie:

Thanks for the replies!

 

However that information is kinda what I allready know :-).

I am sorry for my bad explaining of my goal... I'll try again.

 

After command "START" I will draw lines, circles, blocks, text and anything I need to in order to make my drawing. When giving command "STOP" I need to have all the created objects in a selection set so I can copy them by lisp.

 

Your given solution will only work if the (ssadd) function is added to each command seperately. Because I don't know when "START"ing and when to "STOP" I think this can only be achieved with the use of a reactor.

Posted

Record your start entity with:

(setq fe (entlast))

 

Create en empty selection set:

(setq ss (ssadd))

 

Fill the selection set with the new entities after the stop entity is made:

(while fe
 (ssadd fe ss)
 (setq fe (entnext fe)))

 

Remember to not overwrite fe or ss during the process. -David

Posted

@ David: Just tried it quickly and now I get it, I even get it to do what I want... let me do some experimenting :-)

 

@ Tharwat & Jammie: that means that you did try to put my into the right tdirection but I was not listening :-{ good enough.

 

Thanks all for keeping me from boredom :-)

Posted

Oops I forgot to ask:

 

This:

(setq fe (entlast))

 

will add the last entity, created before the start command, into the selectionset.

How to go about it so that last item is "skipped"?

Posted

Your welcome MarcoW,

 

Just working with David Bethel's code for filling the selection set

 

(while (setq fe (entnext fe))
 (ssadd fe ss)
)

 

This will add all items to the selection set after the initial marker is defined

 

Regards

 

Jammie

Posted

Thanks! I Will have a go tomorrow at THE office

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...