Looking for a method to set SnapMode #7457
-
Looking for a method to set the SnapMode when a tool is executed, does any such method exist? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
The active snap mode(s) are a user setting, no tool should be changing what the user has selected. |
Beta Was this translation helpful? Give feedback.
-
We are working on a Reality Mesh Volume tool. We need that to work to pick point on Reality Data Meshes. In Reality data web viewer, we use to override snap mode at iModelApp startup and only permit "nearest" snap. Now in iTwin Experience, that is not a viable solution. User can select any snap mode, but the tool that only work on reality meshes needs to force that mode. |
Beta Was this translation helpful? Give feedback.
-
Sounds to me like your tool shouldn't be enabling AccuSnap... For normal geometric elements, AccuSnap extracts the element geometry on the backend to compute the snap information. AccuSnap doesn't actually do anything for reality meshes, it just uses the depth point returned by readPixels. |
Beta Was this translation helpful? Give feedback.
-
That's not sufficient obviously, as I mentioned you need to get the point from the depth buffer instead. You are not going to be able to set the snap mode because that's not it's intended purpose. Imagine a user that has set their snap mode(s) to keypoint, then they run your tool and not noticing or expecting their snap mode to be changed try placing a line. Now they may make an error because they don't get the exact endpoint they'd expect from keypoint snap. The above situation "could" be addressed by your tool saving the current snap mode(s) in onPostInstall and restoring the snap mode(s) in onCleanup...but that's still problematic as the user can change the current snap mode(s) while your tool is running, which will then make your tool not work as expected. Hopefully you can now appreciate why changing the snap mode(s) for your tool isn't the right approach and you will now actually look at the rotate view tool as I suggested (run the tool, see how it works).
|
Beta Was this translation helpful? Give feedback.
That's not sufficient obviously, as I mentioned you need to get the point from the depth buffer instead. You are not going to be able to set the snap mode because that's not it's intended purpose.
Imagine a user that has set their snap mode(s) to keypoint, then they run your tool and not noticing or expecting their snap mode to be changed try placing a line. Now they may make an error because they don't get the exact endpoint they'd expect from keypoint snap.
The above situation "could" be addressed by your tool saving the current snap mode(s) in onPostInstall and restoring the snap mode(s) in onCleanup...but that's still problematic as the user can …