Created
October 29, 2018 01:54
-
-
Save Tehsurfer/d5c1c81216016a7a97ee141cfd2b7404 to your computer and use it in GitHub Desktop.
Modify your meshgeneratorwidget.py to record grid points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def init(self) | |
self._ui.sceneviewer_widget.grid = [] | |
def keyReleaseEvent(self, event): | |
if self._marker_mode_active: | |
self._marker_mode_active = False | |
self._ui.sceneviewer_widget._model = self._plane_model | |
self._ui.sceneviewer_widget._calculatePointOnPlane = None | |
self._ui.sceneviewer_widget.mousePressEvent = self._original_mousePressEvent | |
if len(self._ui.sceneviewer_widget.grid) is 4: | |
self._grid4 = self._ui.sceneviewer_widget.grid | |
def mousePressEvent(self, event): | |
if self._active_button != QtCore.Qt.NoButton: | |
return | |
if (event.modifiers() & QtCore.Qt.CTRL) and event.button() == QtCore.Qt.LeftButton: | |
point_on_plane = self._calculatePointOnPlane(event.x(), event.y()) | |
print('Location of click (x,y): (' + str(event.x()) + ', ' + str(event.y()) +')') | |
# return sceneviewers 'mouspressevent' function to its version for navigation | |
self._model = self.plane_model_temp | |
self._calculatePointOnPlane = None | |
self.mousePressEvent = self.original_mousePressEvent | |
self.grid.append(point_on_plane) | |
if len(self.grid) > 4: | |
self.grid = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment