コード例 #1
0
    moldWallThickness = 2
    moldGap = 1

    fixture = True
    fixtureWallThickness = 5
    fixtureGap = 1

    export = False

    app1 = qg.QApplication(sys.argv)

    # Import coupon components
    print('Importing Files')
    if stl:
        if highRes:
            end1 = VoxelModel.fromMeshFile('end1x10.stl', (0, 0, 0), 1)
            center = VoxelModel.fromMeshFile('centerx10.stl', (670, 30, 0), 2)
            end2 = VoxelModel.fromMeshFile('end2x10.stl', (980, 0, 0), 1)
        else:
            end1 = VoxelModel.fromMeshFile('end1.stl', (0, 0, 0), 1)
            center = VoxelModel.fromMeshFile('center.stl', (66, 4, 0), 2)
            end2 = VoxelModel.fromMeshFile('end2.stl', (98, 0, 0), 1)

        # Combine components
        coupon = end1 | center | end2
    else: # use vox file
        coupon = VoxelModel.fromVoxFile('coupon.vox') # Should use materials 1 and 2 (red and green)

    start = time.time()

    if blur: # Blur materials
コード例 #2
0
    fixture = True
    fixtureWallThickness = 5
    fixtureGap = 1

    mold = True
    moldWallThickness = 2
    moldGap = 1

    export = False

    app1 = qg.QApplication(sys.argv)

    # Import coupon components
    if stl:
        # TODO: Improve dimensional accuracy of stl model import and use these files instead of vox file
        end1 = VoxelModel.fromMeshFile('end1.stl', (0, 0, 0))
        center = VoxelModel.fromMeshFile('center.stl', (67, 3, 0))
        end2 = VoxelModel.fromMeshFile('end2.stl', (98, 0, 0))

        # Set materials
        end1 = end1.setMaterial(1)
        end2 = end2.setMaterial(1)
        center = center.setMaterial(2)

        # Combine components
        coupon = Linkage.copy(end1.union(center.union(end2)))
    else:  # use vox file
        coupon = Linkage.fromVoxFile(
            'coupon.vox')  # Should use materials 1 and 2 (red and green)

    # Apply effects to material interface
コード例 #3
0
Import a mesh file and convert it to voxels.

----

Copyright 2019 - Cole Brauer, Dan Aukes
"""

import PyQt5.QtGui as qg
import sys
from voxelfuse.voxel_model import VoxelModel
from voxelfuse.mesh import Mesh
from voxelfuse.plot import Plot

if __name__ == '__main__':
    app1 = qg.QApplication(sys.argv)

    # Import model file
    model = VoxelModel.fromMeshFile('axes.stl', (0, 0, 0))

    # To use a copy of gmsh on the system path, replace line 21 with the following:
    # model = VoxelModel.fromMeshFile('axes.stl', (0, 0, 0), gmsh_on_path=True)

    # Create new mesh data for plotting
    mesh1 = Mesh.fromVoxelModel(model)

    # Create plot
    plot1 = Plot(mesh1, grids=True)
    plot1.show()

    app1.processEvents()
    app1.exec_()
            )  # 0/1 min radius that results in a printable structure
            maxRadius = config.get(
                'maxRadius'
            )  # 3/5 max radius that results in a viable lattice element

        if gyroidEnable:
            gyroidType = config.get('gyroidType')
            gyroidMaxDilate = config.get('gyroidMaxDilate')
            gyroidMaxErode = config.get('gyroidMaxErode')

        app1 = qg.QApplication(sys.argv)

        # Import coupon components
        print('Importing Files')
        end1 = VoxelModel.fromMeshFile('coupon_templates/' + couponStandard +
                                       '-End.stl', (0, 0, 0),
                                       resolution=res).fitWorkspace()
        center = VoxelModel.fromMeshFile('coupon_templates/' + couponStandard +
                                         '-Center-2.stl', (0, 0, 0),
                                         resolution=res).fitWorkspace()
        end2 = end1.rotate90(2, axis=Axes.Z)
        center.coords = (end1.voxels.shape[0],
                         round(
                             (end1.voxels.shape[1] - center.voxels.shape[1]) /
                             2), 0)
        end2.coords = (end1.voxels.shape[0] + center.voxels.shape[0], 0, 0)

        # Trim center
        center_cross_section = VoxelModel(center.voxels[0:2, :, :],
                                          3).fitWorkspace()
        centerLength = center.voxels.shape[0]