What is the relationship between context in the editingLogic function and in the feature?
dave_cowden
Member, Developers Posts: 484 ✭✭✭
Based on a simple experiment with set/get Variable, it seems that the context passed to the editingLogic function and the context passed to the feature are not the same. This surprised me.
I'm looking at a use case in which the editingLogic function needs to construct some geometry in order to adjust user inputs. I'd like to avoid repeating these calculations again in the feature, but then i need these constructions to be accessible ( and mutable ) by the feature.
If I create geometry in the editingLogic function, are those things accessible and mutable if thy are passed to the feature via the definition?
I know that performance will be a concern if i'm getting into creating geometry in the editingLogicFunction, but in this case, there's no way to make a nice-to-use feature without it.
I'm looking at a use case in which the editingLogic function needs to construct some geometry in order to adjust user inputs. I'd like to avoid repeating these calculations again in the feature, but then i need these constructions to be accessible ( and mutable ) by the feature.
If I create geometry in the editingLogic function, are those things accessible and mutable if thy are passed to the feature via the definition?
I know that performance will be a concern if i'm getting into creating geometry in the editingLogicFunction, but in this case, there's no way to make a nice-to-use feature without it.
0
Best Answer
-
We've updated/written the documentation since you likely last looked at it: https://cad.onshape.com/FsDoc/uispec.html#editing-logic-function
From there:- The
contextis passed in at a state immediately prior to the feature. After the editing logic function is executed, it will be rolled back to that same state, so changes made to the context will not persist.
Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5 - The
Answers
-
As a side note, it was implied, but to make it clear: i would find it both more intuitive and more helpful if the context was shared between the editingLogic function and the feature itself...0
-
We've updated/written the documentation since you likely last looked at it: https://cad.onshape.com/FsDoc/uispec.html#editing-logic-function
From there:- The
contextis passed in at a state immediately prior to the feature. After the editing logic function is executed, it will be rolled back to that same state, so changes made to the context will not persist.
Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5 - The
-
Ok thanks, this answers the question. Sorry for not checking the docs first.
0

