Undo/Delete feature in Direct design type

Undo/Delete feature in Direct design type

j.han97
Advocate Advocate
558 Views
2 Replies
Message 1 of 3

Undo/Delete feature in Direct design type

j.han97
Advocate
Advocate

Hi all,

 

Concerning the performance issues of my functions, I have switched the modelling environment from 'Parametric' to 'Direct' (which by the way, speeds up everything significantly). The problem with Direct design mode is that, it seems like I cannot obtain the returned object of the features. For example, I usually try to delete some faces using the feature below:

delete = rootComp.features.deleteFaceFeatures.add(faceToDelete)

After deleting the faces, depends on some criteria, I might want to undo this action (revert the deletion). I used:

delete.deleteMe()

to achieve this in 'Parametric' mode. However in 'Direct' mode, I found that the deleteFacesFeatures.add() method returned None instead of the feature.

 

I am not sure if this is the intended design of 'Direct' mode. Is there any workaround to undo the action (deletion of faces, in this case)? 

 

I have tried the UndoCommand, but it seems to undo the whole thing (entire execution of my script) instead of just the deletion. Maybe I am missing something here.

 

Any suggestion / help is highly appreciated!

0 Likes
Accepted solutions (1)
559 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

Direct modeling is making direct changes to the model, without capturing any history about that change.  Some "features" are shown in the browser, but in direct modeling, they are just labeling the set of faces that were created by a particular operation.

 

I would have thought executing the Undo command would do it though. Each action in a script is transacted, so you can undo each action independently.  If you've written a command, everything that happens in the execute event is wrapped in a single transaction so you can't undo individual actions in that case.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

j.han97
Advocate
Advocate

I see. I need to study more about transactions to understand this better. Anyway, this is not a big issue for me since I intended to implement an extra 'safety' measure to avoid breaking the model. 

 

Thank you for your answer!

0 Likes