Surface Lattice

Endpoint: https://studiobitonti.appspot.com/surfaceLattice


The surface lattice function generates a lattice structure defined by a series of surfaces (or a single surface + a defined height).

Input:


Component: The uploaded .Obj component that would be arrayed on the surface.
Surfaces: A list of uploaded surfaces defining the levels of the lattice
Division:  The number of cells in the U, V dimensions along the surfaces and the W dimension off the surface
File Name:  Name of the resultant file for the surface lattice.
T: [YOUR SECRET TOKEN]

Optional:


BlendTargets: List of other components to be blended according to chosen attractors.
Cell Height:  The height of each cell (only applicable if there is only one surface)
Auto Scale: This component scales the module to fit a 1X1X1 box. The inputs are true or false.
ESIPLON: Is a float value, defining the tolerance to remove duplicated line or faces.
Bin: The input of true or false, defines whether to export result as a compressed binary format instead of obj.

Methods:

.setComponent(‘unit.obj‘):
-sets the basic component that will populate the final lattice

.setSurfaces([input_00.stp’,‘ input01.stp’, ‘input02.stp’ ]):
-sets the surfaces that will guide the shape of the surface lattice in the W direction

.setDivision([U, V, W]):
-sets the number (int) of cells along the surface (U,V directions) and normal to the surface (W direction)

.setGridOuput(‘grid.json‘):
-Sets the output file name of the surface lattice grid that is created by the .genGrid() method

.addCurveAttractor( ‘target.obj’, [ [x1,y1,z1] , [x2,y2,z2], …], range = 20 ):
-Adds an attractor curve that morphs the default component into a target component, using a list of 3-D coordinates and a user defined range.

.genGrid(token):
-Generates the grid needed to populate the final lattice

.populateLattice(token):
-populates the grid generated with the given components

.setOutput(‘filename.obj‘):
-sets the output file name of the populated lattice mesh.

Output:

A list of result files in storage.


Example:

First we set the surfaces that will define the lattice object by using the .setSurfaces() method, then we set the number of units in each direction along the surfaces (U,V) and normal to the surfaces (W) using the .setDivisions() method. With these to attributes assigned we use the .setGridOutput() method and .genGrid method to create the cells that will be populated with the lattice components.

Input:   Surfaces

Input: Surfaces

genysis.upload('EXPORTS/handleBot_Srf.igs','bot.igs',token)
genysis.upload('EXPORTS/handleTop_Srf.igs','top.igs',token)

texture = genysis.surfaceLattice()
texture.setSurfaces(['bot.igs','top.igs'])
texture.setGridOutput('boxes.json')
texture.setDivision(u=20,v=80,w=1)
texture.genGrid(token)

Next we focus on setting the components. In this case use a solid cube and diamond pattern to create a gripping texture for the handlebar. The units must be topologically equivalent. In this case, the cube, as the default unit is assigned to the lattice using the .setComponent() method, and the diamond is placed on the lattice based on attractor curves using the .addAttractorCurve() method.

Input:   Topologically Equivalent Mesh Componets

Input: Topologically Equivalent Mesh Componets

genysis.upload('EXPORTS/crosshatch_deep.obj','diamond.obj',token)
genysis.upload('EXPORTS/crosshatch_shallow.obj','cube.obj',token)

texture.setComponent('diamond.obj')

Once the default component is set, the code shown below imports curve information from a .csv file as a list of points that is then used in the .addCurveAttractor() method.

def parseAtt(dir):
    f = open(dir,'r')
    lines = f.read().split('\n')
    if lines[0] == "":
        return []
    else:
        crvPts = []
        for i in range(len(lines)):
            entries = lines[i].split(' ')
            points = []
            for j in range(len(entries)):
                info = entries[j].split(',')
                point = [float(info[0]),float(info[1]),float(info[2])]
                points.append(point)
            crvPts.append(points)
    return crvPts

attCrvs = parseAtt('CSV/attCrvs_SrfDemo.csv')

for i in range(len(attCrvs)):
   texture.addCurveAttractor('diamond.obj',attCrvs[i],range=21)

Once all the components are assigned to the lattice object we use the .setOutput() and .populateLattice() method to create the final surface lattice.

texture.setOutput('texture.obj')
texture.populateLattice(token)

Output:   The Final Ouput Surface Lattice

Output: The Final Ouput Surface Lattice

Francis Bitonti