.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This is really out of my knowlege-Undo in extension Dic.

3 REPLIES 3
Reply
Message 1 of 4
ButterFlyShame
370 Views, 3 Replies

This is really out of my knowlege-Undo in extension Dic.

I have a counter which write to drawing extended dictionary after creating object withing code.

let's say for any line which is being created by program. counter will add up.

Now if user make undo, Undo command doesn't change that counter in Dic. Didn't know this. I thought I have to write an

Event handler. But I thoguht maybe easier way. I  am not really good with events and reactor.

Any Suggestion from Experts Would be appreciated .

3 REPLIES 3
Message 2 of 4
Jeffrey_H
in reply to: ButterFlyShame

The first thought to come to mind is,

You could keep a collection of ObjectIds that you add and use the Database.ObjectUnappended Event to check if your collection contains it and if so remove it and subtract the counter

If you need to keep up with redo's then have another collection that you add the removed Ids to and do the reverse for

Database.ObjectReappended Event

or

if you only need to check between saves you could use a save event and check ObjectID.IsErased property

You can also find your answers @ TheSwamp
Message 3 of 4
ButterFlyShame
in reply to: Jeffrey_H

Thanks Jeffrey for your time. I am going to work on your suggestion. But like I said I don't feel comfortable to work with those events. I guess no other choice. Cheers.

 

Message 4 of 4
Jeffrey_H
in reply to: ButterFlyShame

I would see what others say but if you do not want to mess with events(one day you will) I guess even though it will increase the size some is to add a entry in each objects ExtensionDictionary that you create, and when you want the count all you have to do is itterate BlockTableRecords where IsLayout is true and check for the entry.

 

I guess you would also need consider per document counting. There are examples of per doc at the Swamp.

You can also find your answers @ TheSwamp

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost