hi Marko, Fair enough, I had to delve a little in the back of my mind to recall how it works. Due to python's highly dynamic nature its easy to radically change the behaviour of modules So around line 209<https://github.com/tpaviot/pythonocc/blob/master/src/addons/PAF/Context.py#L209> in "_initialize_operation" you see that we're looping through all the attributes that have operations ( like "measure_operations" ) To make the methods in these attributes respect the undo functionality we need to wrap 'em. So here, all the methods in *_operations get decorated If undo is enabled, the method will be executed in the context [ with statement ] of "operation"<https://github.com/tpaviot/pythonocc/blob/master/src/addons/PAF/Context.py#L30> So:
StartOperation >> the method is called FinishOperation Than OCC has collected all the data needed to undo / redo the operation performed... I agree its a little hysteric code ( a little bit too much magic perhaps ), but does the job. -jelle Hi, jelle! > > I have looked through the examples that come with pythonOCC and I know how > parametric modeling works in pythonOCC. > I also tried to go through the tutorial you mention, but it fails because > the > newly created instance of ParametricModelingContext has no attribute > 'init_display'. I guess the tutorial is outdated as it was written shortly > after the release of pythonOCC 0.4. > > Anyway I have read through the tutorial and it looks like it doesn't > provide > any information on undo/redo. Understanding how parametric modeling works > is > not the problem for me - there is enough documentation available for that. > I'm > just trying to find out how undo/redo works. > > Marko >
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users