Create Temporary Objects for Selection

Create Temporary Objects for Selection

alexisgacia
Advocate Advocate
1,984 Views
5 Replies
Message 1 of 6

Create Temporary Objects for Selection

alexisgacia
Advocate
Advocate

Hi,

 

Good day.

 

I'm trying to create a temporary object base on my selected objects. Those temporary object will be part of the selection. After the temporary object was created, user will pick 1 of the object. Then after the selection it will remove all temporary object except the selected one.

 

Picture sample is for the selection of objects.

Selection.png

 

Then after selected it will show Temporary Objects for selection

Temp Objects Created.png

 

After selected 1 of the temporary objects it will erase the other temporary objects and remain the only object that is selected.

 

I don't know if that is possible in AutoCad.

 

Thank you in advance

 

 

0 Likes
Accepted solutions (2)
1,985 Views
5 Replies
Replies (5)
Message 2 of 6

norman.yuan
Mentor
Mentor

Here are what I see of your requirements:

 

1.  certain existing entities in drawing could be used as base information to create new entities;

2. When user select these entities, you want to show the possible new entities temporarily, as visual hint to help user to decide to choose one existing entity, from which a new entity would eventually be drawn permanently

3. User then choose one existing entity from all previously selected entities (with associated temporary new entity visually shown).

4. Once user makes the choice, a new entity is added to the drawing permanently and all other temporary new entities are gone.

 

There are at least 2 different way to do it, as I can see:

 

1. Use Transient Graphics in conjunction with handling Editor.SelectionAdded/Removed events. With this approach, you can draw temporary entities during the call of Editor.GetSelection().

 

2. Use DrawableOverrule. With this approach, you can enable your custom DrawOverrule during the call of Editor.GetSelection, so that the selected entities would be drawn with extra shape.

 

While either approach would not be very difficult to code, it is somewhat advanced AutoCAD .NET API topic, which I am not sure whether you are up to. I might be able to put some code together later (late today or early tomorrow) and post back, using one of aforementioned approaches (not sure if I have enough time for both).

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 6

norman.yuan
Mentor
Mentor
Accepted solution

I completed coding the first approach - handling Editor.SelectionAdded/Removed event in conjunction with Transient Graphics. As usual, in order to make the sample code easier to read, it is posted in my blog here:

 

https://drive-cad-with-code.blogspot.com/2020/04/show-temporary-entityshape-during-user.html 

 

HTH

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 4 of 6

alexisgacia
Advocate
Advocate

Hi Yuan,

 

I am new in C# for Autocad it may take a while to understand the code. It was a very good example and very helpful.

 

I think this the one that I'm looking for. 

 

Thank you very much. 

 

Best regards,

Alex

 

0 Likes
Message 5 of 6

norman.yuan
Mentor
Mentor
Accepted solution

I just posted second article on this topic where using DrawableOverrule is demonstrated:

 

https://drive-cad-with-code.blogspot.com/2020/04/show-temporary-entityshape-during-user_21.html 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 6 of 6

alexisgacia
Advocate
Advocate

This is very helpful.

 

Thank you again Yuan. 

0 Likes