def __init__(self, display): super(ViewController, self).__init__() self._manipulator = AIS_Manipulator() self._manipulator.SetModeActivationOnDetection(True) self._display = display self._selectedShape = None self._active = False
def AddManipulator(self): self.manip = AIS_Manipulator(self.base_axs.Ax2()) ais_shp = self.display.DisplayShape( self.base_axs.Location(), update=True ) self.manip.Attach(ais_shp)
def test_method_not_wrapped_exception(self) -> None: """ checks that calling a non wrapped class raises an ClassNotWrapped exception """ class TestClass: def meth1(self) -> None: pass # does not raise any exception @methodnotwrapped def meth2(self) -> None: pass # calling this method will raise an exception a = TestClass() a.meth1() with self.assertRaises(MethodNotWrappedError): a.meth2() # test with OCC m = AIS_Manipulator() with self.assertRaises(MethodNotWrappedError): m.TransformBehavior()
##You should have received a copy of the GNU Lesser General Public License ##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>. """ The very first pythonocc example. This uses to be the script used to check the following points: pythonocc installation is correct, i.e. pythonocc modules are found and properly imported a GUI manager is installed. Wether it is wxpython or pyqt/pyside, it's necessary to display a 3d window the rendering window can be initialized and set up, that is to say the graphic driver and OpenGl works correctly. If this example run on your machine, that means you're ready to explore the wide pythonocc world and run all the other examples. """ from OCC.Display.SimpleGui import init_display from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox from OCC.Core.AIS import AIS_Manipulator display, start_display, add_menu, add_function_to_menu = init_display() my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape() display.View.TriedronErase() ais_shp = display.DisplayShape(my_box, update=True) manip = AIS_Manipulator() manip.Attach(ais_shp) start_display()