예제 #1
0
def getPath4axis(context, operation):
    o = operation
    utils.getBounds(o)
    if o.strategy4axis in ['PARALLELR', 'PARALLEL', 'HELIX', 'CROSS']:
        path_samples = getPathPattern4axis(o)

        depth = path_samples[0].depth
        chunks = []

        layers = strategy.getLayers(o, 0, depth)

        chunks.extend(utils.sampleChunksNAxis(o, path_samples, layers))
        strategy.chunksToMesh(chunks, o)
예제 #2
0
def proj_curve(s, o):
    print('operation: projected curve')
    pathSamples = []
    chunks = []
    ob = bpy.data.objects[o.curve_object]
    pathSamples.extend(curveToChunks(ob))

    targetCurve = s.objects[o.curve_object1]

    from cam import chunk
    if targetCurve.type != 'CURVE':
        o.warnings = o.warnings + 'Projection target and source have to be curve objects!\n '
        return

    if 1:
        extend_up = 0.1
        extend_down = 0.04
        tsamples = curveToChunks(targetCurve)
        for chi, ch in enumerate(pathSamples):
            cht = tsamples[chi].points
            ch.depth = 0
            for i, s in enumerate(ch.points):
                # move the points a bit
                ep = Vector(cht[i])
                sp = Vector(ch.points[i])
                # extend startpoint
                vecs = sp - ep
                vecs.normalize()
                vecs *= extend_up
                sp += vecs
                ch.startpoints.append(sp)

                # extend endpoint
                vece = sp - ep
                vece.normalize()
                vece *= extend_down
                ep -= vece
                ch.endpoints.append(ep)

                ch.rotations.append((0, 0, 0))

                vec = sp - ep
                ch.depth = min(ch.depth, -vec.length)
                ch.points[i] = sp.copy()

    layers = getLayers(o, 0, ch.depth)

    chunks.extend(utils.sampleChunksNAxis(o, pathSamples, layers))
    chunksToMesh(chunks, o)