def run(self): self._i18n_catalog = i18nCatalog("cura"); i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("SolidView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-80, 250, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 100, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) qmlRegisterSingletonType(MachineManagerModel.MachineManagerModel, "Cura", 1, 0, "MachineManager", MachineManagerModel.createMachineManagerModel) self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) for file_name in self._open_file_queue: #Open all the files that were queued up while plug-ins were loading. self._openFile(file_name) self.exec_()
def run(self): self._i18n_catalog = i18nCatalog("cura"); i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Setting up scene...")) controller = self.getController() controller.setActiveView("MeshView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-150, 150, 300)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) controller.getScene().setActiveCamera("3d") self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Loading interface...")) self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() manager = self.getMachineManager() if not self.getMachineManager().getMachineInstances(): self.requestAddPrinter.emit() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) self.exec_()
def run(self): if "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" not in os.environ or os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] != "cpp": Logger.log("w", "Using Python implementation of Protobuf, expect bad performance!") self._i18n_catalog = i18nCatalog("cura"); i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("MeshView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-80, 250, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 100, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) self.exec_()
def run(self): self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("SolidView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Scene_Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-80, 250, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 100, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) # Initialise extruder so as to listen to global container stack changes before the first global container stack is set. cura.Settings.ExtruderManager.getInstance() qmlRegisterSingletonType(cura.Settings.MachineManager, "Cura", 1, 0, "MachineManager", cura.Settings.MachineManager.createMachineManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self._qml_import_paths.append(Resources.getPath(self.ResourceTypes.QmlFiles)) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) for file_name in self._open_file_queue: #Open all the files that were queued up while plug-ins were loading. self._openFile(file_name) self._started = True self.exec_()
def run(self): self._i18n_catalog = i18nCatalog("nk") i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("SolidView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) camera = Camera("3d", root) camera.setPosition(Vector(-80, 950, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 0, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "NinjaKittens.qml")) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) self.exec_()
def run(self): self._i18n_catalog = i18nCatalog("cura"); self.addOutputDevice("local_file", { "id": "local_file", "function": self._writeToLocalFile, "description": self._i18n_catalog.i18nc("Save button tooltip", "Save to Disk"), "shortDescription": self._i18n_catalog.i18nc("Save button tooltip", "Save to Disk"), "icon": "save", "priority": 0 }) self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Setting up scene...")) controller = self.getController() controller.setActiveView("MeshView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-150, 150, 300)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) controller.getScene().setActiveCamera("3d") self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Loading interface...")) self.setMainQml(Resources.getPath(Resources.QmlFilesLocation, "Cura.qml")) self.initializeEngine() self.getStorageDevice("LocalFileStorage").removableDrivesChanged.connect(self._removableDrivesChanged) if self.getMachines(): active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") if active_machine_pref: for machine in self.getMachines(): if machine.getName() == active_machine_pref: self.setActiveMachine(machine) if not self.getActiveMachine(): self.setActiveMachine(self.getMachines()[0]) else: self.requestAddPrinter.emit() self._removableDrivesChanged() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): job = ReadMeshJob(os.path.abspath(file)) job.finished.connect(self._onFileLoaded) job.start() self.exec_()
def snapshot(width = 300, height = 300): scene = Application.getInstance().getController().getScene() active_camera = scene.getActiveCamera() render_width, render_height = active_camera.getWindowSize() render_width = int(render_width) render_height = int(render_height) preview_pass = PreviewPass(render_width, render_height) root = scene.getRoot() camera = Camera("snapshot", root) # determine zoom and look at bbox = None for node in DepthFirstIterator(root): if hasattr(node, "_outside_buildarea") and not node._outside_buildarea: if node.callDecoration("isSliceable") and node.getMeshData() and node.isVisible() and not node.callDecoration("isNonThumbnailVisibleMesh"): if bbox is None: bbox = node.getBoundingBox() else: bbox = bbox + node.getBoundingBox() # If there is no bounding box, it means that there is no model in the buildplate if bbox is None: return None look_at = bbox.center # guessed size so the objects are hopefully big size = max(bbox.width, bbox.height, bbox.depth * 0.5) # Looking from this direction (x, y, z) in OGL coordinates looking_from_offset = Vector(-1, 1, 2) if size > 0: # determine the watch distance depending on the size looking_from_offset = looking_from_offset * size * 1.3 camera.setPosition(look_at + looking_from_offset) camera.lookAt(look_at) satisfied = False size = None fovy = 30 while not satisfied: if size is not None: satisfied = True # always be satisfied after second try projection_matrix = Matrix() # Somehow the aspect ratio is also influenced in reverse by the screen width/height # So you have to set it to render_width/render_height to get 1 projection_matrix.setPerspective(fovy, render_width / render_height, 1, 500) camera.setProjectionMatrix(projection_matrix) preview_pass.setCamera(camera) preview_pass.render() pixel_output = preview_pass.getOutput() min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries(pixel_output) size = max((max_x - min_x) / render_width, (max_y - min_y) / render_height) if size > 0.5 or satisfied: satisfied = True else: # make it big and allow for some empty space around fovy *= 0.5 # strangely enough this messes up the aspect ratio: fovy *= size * 1.1 # make it a square if max_x - min_x >= max_y - min_y: # make y bigger min_y, max_y = int((max_y + min_y) / 2 - (max_x - min_x) / 2), int((max_y + min_y) / 2 + (max_x - min_x) / 2) else: # make x bigger min_x, max_x = int((max_x + min_x) / 2 - (max_y - min_y) / 2), int((max_x + min_x) / 2 + (max_y - min_y) / 2) cropped_image = pixel_output.copy(min_x, min_y, max_x - min_x, max_y - min_y) # Scale it to the correct size scaled_image = cropped_image.scaled( width, height, aspectRatioMode = QtCore.Qt.IgnoreAspectRatio, transformMode = QtCore.Qt.SmoothTransformation) return scaled_image
def run(self): self._i18n_catalog = i18nCatalog("cura") i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage( self._i18n_catalog.i18nc("Splash screen message", "Setting up scene...")) controller = self.getController() controller.setActiveView("MeshView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis( [ToolHandle.XAxis, ToolHandle.YAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics( controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-150, 150, 300)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool( self.getController().getTool("CameraTool")) controller.getScene().setActiveCamera("3d") self.showSplashMessage( self._i18n_catalog.i18nc("Splash screen message", "Loading interface...")) self.setMainQml( Resources.getPath(Resources.QmlFilesLocation, "Cura.qml")) self.initializeEngine() if self.getMachines(): active_machine_pref = Preferences.getInstance().getValue( "cura/active_machine") if active_machine_pref: for machine in self.getMachines(): if machine.getName() == active_machine_pref: self.setActiveMachine(machine) if not self.getActiveMachine(): self.setActiveMachine(self.getMachines()[0]) else: self.requestAddPrinter.emit() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) self.exec_()
def run(self): self.showSplashMessage( self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("SolidView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis( [ToolHandle.XAxis, ToolHandle.YAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() # The platform is a child of BuildVolume self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics( controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-80, 250, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 100, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool( self.getController().getTool("CameraTool")) self.showSplashMessage( self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) # Initialise extruder so as to listen to global container stack changes before the first global container stack is set. cura.Settings.ExtruderManager.getInstance() qmlRegisterSingletonType(cura.Settings.MachineManager, "Cura", 1, 0, "MachineManager", self.getMachineManager) qmlRegisterSingletonType(cura.Settings.SettingInheritanceManager, "Cura", 1, 0, "SettingInheritanceManager", self.getSettingInheritanceManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) self.setMainQml( Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self._qml_import_paths.append( Resources.getPath(self.ResourceTypes.QmlFiles)) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) for file_name in self._open_file_queue: #Open all the files that were queued up while plug-ins were loading. self._openFile(file_name) self._started = True self.exec_()
def run(self): self._i18n_catalog = i18nCatalog("cura"); self.addOutputDevice("local_file", { "id": "local_file", "function": self._writeToLocalFile, "description": self._i18n_catalog.i18nc("Save button tooltip", "Save to Disk"), "icon": "save", "priority": 0 }) self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Setting up scene...")) controller = self.getController() controller.setActiveView("MeshView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics(controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-150, 150, 300)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool(self.getController().getTool("CameraTool")) controller.getScene().setActiveCamera("3d") self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Loading interface...")) self.setMainQml(Resources.getPath(Resources.QmlFilesLocation, "Cura.qml")) self.initializeEngine() self.getStorageDevice("LocalFileStorage").removableDrivesChanged.connect(self._removableDrivesChanged) if self.getMachines(): active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") if active_machine_pref: for machine in self.getMachines(): if machine.getName() == active_machine_pref: self.setActiveMachine(machine) if not self.getActiveMachine(): self.setActiveMachine(self.getMachines()[0]) else: self.requestAddPrinter.emit() self._removableDrivesChanged() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): job = ReadMeshJob(os.path.abspath(file)) job.finished.connect(self._onFileLoaded) job.start() self.exec_()
def snapshot(width=300, height=300): scene = Application.getInstance().getController().getScene() active_camera = scene.getActiveCamera() render_width, render_height = active_camera.getWindowSize() render_width = int(render_width) render_height = int(render_height) preview_pass = PreviewPass(render_width, render_height) root = scene.getRoot() camera = Camera("snapshot", root) # determine zoom and look at bbox = None for node in DepthFirstIterator(root): if node.callDecoration( "isSliceable") and node.getMeshData() and node.isVisible( ) and not node.callDecoration("isNonThumbnailVisibleMesh"): if bbox is None: bbox = node.getBoundingBox() else: bbox = bbox + node.getBoundingBox() # If there is no bounding box, it means that there is no model in the buildplate if bbox is None: return None look_at = bbox.center # guessed size so the objects are hopefully big size = max(bbox.width, bbox.height, bbox.depth * 0.5) # Looking from this direction (x, y, z) in OGL coordinates looking_from_offset = Vector(-1, 1, 2) if size > 0: # determine the watch distance depending on the size looking_from_offset = looking_from_offset * size * 1.3 camera.setPosition(look_at + looking_from_offset) camera.lookAt(look_at) satisfied = False size = None fovy = 30 while not satisfied: if size is not None: satisfied = True # always be satisfied after second try projection_matrix = Matrix() # Somehow the aspect ratio is also influenced in reverse by the screen width/height # So you have to set it to render_width/render_height to get 1 projection_matrix.setPerspective(fovy, render_width / render_height, 1, 500) camera.setProjectionMatrix(projection_matrix) preview_pass.setCamera(camera) preview_pass.render() pixel_output = preview_pass.getOutput() min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries( pixel_output) size = max((max_x - min_x) / render_width, (max_y - min_y) / render_height) if size > 0.5 or satisfied: satisfied = True else: # make it big and allow for some empty space around fovy *= 0.5 # strangely enough this messes up the aspect ratio: fovy *= size * 1.1 # make it a square if max_x - min_x >= max_y - min_y: # make y bigger min_y, max_y = int((max_y + min_y) / 2 - (max_x - min_x) / 2), int((max_y + min_y) / 2 + (max_x - min_x) / 2) else: # make x bigger min_x, max_x = int((max_x + min_x) / 2 - (max_y - min_y) / 2), int((max_x + min_x) / 2 + (max_y - min_y) / 2) cropped_image = pixel_output.copy(min_x, min_y, max_x - min_x, max_y - min_y) # Scale it to the correct size scaled_image = cropped_image.scaled( width, height, aspectRatioMode=QtCore.Qt.IgnoreAspectRatio, transformMode=QtCore.Qt.SmoothTransformation) return scaled_image
def run(self): if not "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION" in os.environ or os.environ[ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] != "cpp": Logger.log( "w", "Using Python implementation of Protobuf, expect bad performance!" ) self._i18n_catalog = i18nCatalog("cura") i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage( self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("MeshView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis( [ToolHandle.XAxis, ToolHandle.YAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setLightPosition(Vector(0, 150, 0)) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics( controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-80, 250, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 100, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool( self.getController().getTool("CameraTool")) self.showSplashMessage( self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) self.setMainQml( Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) self.exec_()
def run(self): self._i18n_catalog = i18nCatalog("cura") i18nCatalog.setTagReplacements({ "filename": "font color=\"black\"", "message": "font color=UM.Theme.colors.message_text;", }) self.showSplashMessage( self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) controller = self.getController() controller.setActiveView("SolidView") controller.setCameraTool("CameraTool") controller.setSelectionTool("SelectionTool") t = controller.getTool("TranslateTool") if t: t.setEnabledAxis( [ToolHandle.XAxis, ToolHandle.YAxis, ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) root = controller.getScene().getRoot() self._platform = Platform(root) self._volume = BuildVolume.BuildVolume(root) self.getRenderer().setBackgroundColor(QColor(245, 245, 245)) self._physics = PlatformPhysics.PlatformPhysics( controller, self._volume) camera = Camera("3d", root) camera.setPosition(Vector(-80, 250, 700)) camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") self.getController().getTool("CameraTool").setOrigin(Vector(0, 100, 0)) self._camera_animation = CameraAnimation.CameraAnimation() self._camera_animation.setCameraTool( self.getController().getTool("CameraTool")) self.showSplashMessage( self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) qmlRegisterSingletonType(MachineManagerModel.MachineManagerModel, "Cura", 1, 0, "MachineManager", MachineManagerModel.createMachineManagerModel) self.setMainQml( Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() if self._engine.rootObjects: self.closeSplash() for file in self.getCommandLineOption("file", []): self._openFile(file) for file_name in self._open_file_queue: #Open all the files that were queued up while plug-ins were loading. self._openFile(file_name) self.exec_()