Missing regen after editing a block definition, or after its undo

Missing regen after editing a block definition, or after its undo

stefanome
Collaborator Collaborator
383 Views
4 Replies
Message 1 of 5

Missing regen after editing a block definition, or after its undo

stefanome
Collaborator
Collaborator

I have a command that changes the definition of a block.

 

After executing the command, the already existing instance of the block doesn't show the update until a REGEN is executed. 

 

I have added Editor.Regen() at the end of the function, right after it has finished updating the block definition, and now I see the updated block.

 

The problem is that if, after executing the command, I undo, the block definition goes back to its previous condition, but the existing instance doesn't show the update until a manual REGEN. Again, the undo doesn't know that a REGEN is required.

 

The command already has the CommandFlags.Redraw flag.

 

Is adding the Editor.Regen() the correct solution?

If yes, how do I make sure the block is regenerated after undo?

0 Likes
Accepted solutions (1)
384 Views
4 Replies
Replies (4)
Message 2 of 5

ActivistInvestor
Mentor
Mentor
Accepted solution

Autodesk.AutoCAD.Internal.CoreUtils.SetUndoRequiresRegen(Darabase db)

Message 3 of 5

stefanome
Collaborator
Collaborator

Thank you, that's exactly what I need!

 

It's a little scary that searching for it in the whole autodesk.com doesn't find any matches: https://www.google.com/search?q=site%3Aautodesk.com+SetUndoRequiresRegen

 

Where and how did you find this function?

0 Likes
Message 4 of 5

ActivistInvestor
Mentor
Mentor

It is an undocumented API that was intended for internal use only. The primary means of discovering this kind of stuff is by using a decompiler/disassembler like IlSpy

Message 5 of 5

stefanome
Collaborator
Collaborator

I'm not decompiler ready yet!

 

For the time being I'm happy that you gave me the correct solution.

And I'm happy that I wasn't missing some obvious piece of documentation.

0 Likes