def createImage(imagePath):
    fileName = os.path.split(imagePath)[1]
    imageName = os.path.splitext(fileName)[0]

    a = FreeCAD.ActiveDocument.addObject("App::FeaturePython", imageName)
    image = LithophaneImage(a, imagePath)
    ViewProviderLithophaneImage(a.ViewObject)

    recomputeView()

    return image
示例#2
0
    def Activated(self):
        lithophaneImage, imageLabel = lithophane_utils.findSelectedImage()

        if lithophaneImage is None:
            qtutils.showInfo("No LithophaneImage selected",
                             "Select exactly one LithophaneImage to continue")

            return

        showPointCloud(lithophaneImage.lines, imageLabel + '_PointCloud')

        lithophane_utils.recomputeView()
    def Activated(self):
        lithophaneImage, imageLabel, documentObject = lithophane_utils.findSelectedImage(
            True)

        if lithophaneImage is None:
            qtutils.showInfo("No LithophaneImage selected",
                             "Select exactly one LithophaneImage to continue")

            return

        self.createGeometryInstance(documentObject, imageLabel)

        lithophane_utils.recomputeView()
示例#4
0
    def accept(self):
        FreeCADGui.Control.closeDialog()

        if self.scaleFactor != 1:
            self.InfoLabel.setText(
                'The image is recomputed. This might take a while...')
            qtutils.processEvents()

            originalPpi = self.freeCadObject.ppi

            # smaller ppi means larger image. So division not multiplication
            self.freeCadObject.ppi = originalPpi / self.scaleFactor

            lithophane_utils.recomputeView()
示例#5
0
    def Activated(self):
        lithophaneImage, imageLabel = lithophane_utils.findSelectedImage()

        if lithophaneImage is None:
            qtutils.showInfo("No LithophaneImage selected",
                             "Select exactly one LithophaneImage to continue")

            return

        timers = []

        timers.append(Timer('Creating ImagePlane (1/7)'))
        imagePlane = makeImagePlane(lithophaneImage.lines)
        timers[-1].stop()

        timers.append(Timer('Creating ImageBase (2/7)'))
        block = makeBlockBase(lithophaneImage.lines)
        timers[-1].stop()

        timers.append(Timer('Create Bottom Plane (3/7)'))
        bottomPlane = createBottomRectangle(lithophaneImage.lines)
        timers[-1].stop()

        timers.append(Timer('Merge Meshes (4/7)'))
        imageMesh = Mesh.Mesh()
        imageMesh.addMesh(imagePlane)
        imageMesh.addMesh(block)
        imageMesh.addMesh(bottomPlane)
        timers[-1].stop()

        timers.append(Timer('Removing Duplicate Points (5/7)'))
        imageMesh.removeDuplicatedPoints()
        lithophane_utils.recomputeView()
        timers[-1].stop()

        timers.append(Timer('Recalculating Normals (6/7)'))
        imageMesh.harmonizeNormals()
        timers[-1].stop()

        timers.append(Timer('Recomputing View (7/7)'))
        Mesh.show(imageMesh, imageLabel + '_Box')
        lithophane_utils.recomputeView()
        timers[-1].stop()

        FreeCAD.Console.PrintMessage('Creating Boxy image took %.3f s' %
                                     (computeOverallTime(timers)))
示例#6
0
    def recomputeView(self, shellData):
        shell = shellData[0]
        meshData = shellData[1]

        Part.show(shell, meshData[1] + '_Solid')
        lithophane_utils.recomputeView()