.NET

Reply
Distinguished Contributor
JanetDavidson
Posts: 139
Registered: ‎08-23-2011
Message 1 of 7 (196 Views)
Accepted Solution

Is Possible to roll back variable within undo command , outside of transaction?

196 Views, 6 Replies
03-10-2012 07:30 AM

Hi,

I need to be able to roll back my variables if user apply an UNDO. I am just wondering if this is possible and what is your trick in this regard. Let's say.

 

Myinteger =1

 

Startstransaction

........

trans commint

 

Myinteger=2

 

 

Startstransaction

........

trans commint

 

Myinteger=3

 

 

if user does undo 2 times  the Variable  Myinteger  keep the value  3 . I want it back to 1. How?

 

Thanks for any help or workaround or trick.

 

Janet.

 

 

 

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 2 of 7 (194 Views)

Re: Is Possible to roll back variable within undo command , outside of transacti

03-10-2012 08:11 AM in reply to: JanetDavidson

Hi,

 

my understanding is one undo makes one (main) transaction-part undone. With main-transaction I mean the "master" transaction without looking to any nested transactions.

If you want to undo more than one actions with one step you can set undo-markers.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
JanetDavidson
Posts: 139
Registered: ‎08-23-2011
Message 3 of 7 (188 Views)

Re: Is Possible to roll back variable within undo command , outside of transacti

03-10-2012 09:43 AM in reply to: Alfred.NESWADBA

Hello Alfred,

Thanks for your time looking into my question. 

My concern is  the public shared variable in whole project  ( in this simple sample, say , "myinteger".

When I  undo a  command that variable doesn't roll back ot initial value . 

Hope I explained or you need a asimple example code?

Regards,

Janet.

 

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 4 of 7 (186 Views)

Re: Is Possible to roll back variable within undo command , outside of transacti

03-10-2012 10:02 AM in reply to: JanetDavidson

Hi,

 

Ok, you want your local variable to be restored, sorry, I did'nt check that.

 

So my ideas would be then: either check CommandEnded-event (watchign for command _UNDO) and use a stack for every variable-change or use a drawings-sysvar for saving and restoring your variable, because the sysvars (e.g. USERI1) will notice undo-commands.

 

In this case (I normally don't use the USER-vars) the advantage is also that you have saved it with the drawing. Because if the user changes the drawing between step 2 and step 3 your global variable will also have to be reset as the other drawing may stay at another step.

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
JanetDavidson
Posts: 139
Registered: ‎08-23-2011
Message 5 of 7 (183 Views)

Re: Is Possible to roll back variable within undo command , outside of transacti

03-10-2012 10:55 AM in reply to: Alfred.NESWADBA

Thanks Alfred ,  I got it and I understood.

Now let's say that local vairable  instead of one,  is 500 local variables . 

In this case what would be the solution ?

Regards,

Janet.

 

*Expert Elite*
Alfred.NESWADBA
Posts: 8,867
Registered: ‎06-29-2007
Message 6 of 7 (182 Views)

Re: Is Possible to roll back variable within undo command , outside of transacti

03-10-2012 11:09 AM in reply to: JanetDavidson

Hi,

 

store it in

  • Dictionary
  • ExtendedEntityData
  • Block with 500 Attributes

 

Just a few examples :smileywink:

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
JanetDavidson
Posts: 139
Registered: ‎08-23-2011
Message 7 of 7 (171 Views)

Re: Is Possible to roll back variable within undo command , outside of transacti

03-11-2012 12:10 AM in reply to: Alfred.NESWADBA

Hi alfred, I like Attributes Idea, Yeah that will do the job for me.

Thanks for showing the trick.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community