Results 1 to 4 of 4

Thread: Undo Dictionary Changes

  1. #1
    I could stop if I wanted to
    Join Date
    2003-03
    Location
    Alberta
    Posts
    260
    Login to Give a bone
    0

    Unhappy Undo Dictionary Changes

    I have a command that stores some data to a Dictionary in an AutoCAD drawing. I am experiencing problems with UNDO where all the data in the Dictionary is lost. I will run the command and store the data to the Dictionary. Now lets say I run the command again to change the values in the Dictionary. If I do UNDO to revert to the previous values there is nothing left in the Dictionary after UNDO. What might cause this and how can I fix it?

  2. #2
    AUGI Addict sinc's Avatar
    Join Date
    2004-02
    Location
    Colorado
    Posts
    1,986
    Login to Give a bone
    0

    Default Re: Undo Dictionary Changes

    Do you explicitly set Start and End Undo marks in your routine?

    I think there might be implicit Start and End Undo marks, but I haven't quite figured out the rules for them. I think it has something to do with the method of invocation. But in any case, I have found it more-reliable to explicitly set a Start Undo mark at the beginning of your routine, then an End Undo mark at the end of your routine. Otherwise, you will undo all the way back to the last command that set an undo mark.

  3. #3
    I could stop if I wanted to
    Join Date
    2003-03
    Location
    Alberta
    Posts
    260
    Login to Give a bone
    0

    Default Re: Undo Dictionary Changes

    I was under the impression that using Transaction did this already. I'll try setting an Undo marker. I'm not sure if I'd seen that in the API, could you tell me where abouts it might be?

  4. #4
    AUGI Addict sinc's Avatar
    Join Date
    2004-02
    Location
    Colorado
    Posts
    1,986
    Login to Give a bone
    0

    Default Re: Undo Dictionary Changes

    You are probably right.

    All of my development right now is for Civil-3D, and unfortunately, C3D does not have a .NET API. That means that all my code is this nasty mix of .NET and COM objects. I think that's why I've found that I often need to explicitly control undo marks - transactions do not work for objects accessed directly via COM methods. They only know about objects that are opened using the GetObject() method on the transaction. And the controls I use are on the AeccApplication interface object used to talk to C3D, so they are not available to you.

    But there is a similar option in the COM Document class in the VBA/ActiveX documentation. If you are only using .NET objects, then I think you're right, and transactions should take care of it all. But if you want to try explicitly setting the mark to see if it helps any, you can try digging down to the COM Document object (use the AcadObject() method from your .NET Document), which has StartUndoMark() and EndUndoMark() methods.

Similar Threads

  1. help with dictionary
    By CHRISSOP in forum Skunk Werx Lounge
    Replies: 1
    Last Post: 2008-04-15, 07:36 PM
  2. Replies: 1
    Last Post: 2007-09-14, 02:26 PM
  3. Ks_object dictionary
    By robert.bouthillette in forum Software
    Replies: 2
    Last Post: 2005-12-04, 08:23 PM
  4. Architectural Dictionary
    By BCrouse in forum ACA Wish List
    Replies: 8
    Last Post: 2005-08-09, 07:48 PM
  5. Undo limiting to one undo
    By mjsregister in forum AutoCAD General
    Replies: 20
    Last Post: 2005-02-01, 07:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •