Populate Lattice Module
Endpoint: https://studiobitonti.appspot.com/boxMorph
The Populate modulus function populates a given component (or set of components) into a conformal grid structure.
Input:
Component: Is the uploaded .Obj component to be arrayed.
Boxes: Is the name of uploaded box scaffold .json name.
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.
EPSILON: Is a float value determining the tolerance of removing duplicated members.
Bin: The input of true or false, defines whether to export result as a compressed binary format instead of obj.
Methods:
.setComponent(‘component.obj’):
-Assign an .obj component to the lattice for population
.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.
.setOutput(‘output.obj’):
- Sets the output of the generated conformal lattice
.populateLattice(token):
-populates the grid generated with the given components
Output:
The result is an .obj file located in storage.
Example:
The image and code below show an example grid for populating. The .json file is structured as a series of 8x3 matrices that represent the 8 corners of every cell in clockwise order from the bottom face to the top face.
Input .Json Format: [ [ # 3d coordinates for 8 corners of a box [0,0.5,0.7],[0,1.2,2.3],[3.5,-0.2,0.7],[2.5,3.2,2.22],[5.25,6.12,1.12],[5.1,-12.2,3.3],[4.6,0.11,-8],[12,2.4,-3] ], [ # 3d coordinates for 8 corners of a box [4.1,0.5,0.2],[6,1.42,1.3],[4.2,3.2,5.1],[2.3,3.1,5.52],[7.28,6.72,5.42],[5.4,11.2,5.3],[22.6,2.44,1.2] ], # [[...],[...]....[...]]...... list of boxes composing the conformal grid ]
Below we assign a default component (shown above) as an uploaded .obj file to fill in the lattice, using the .setComponent() method.
genysis.upload("EXPORTS/dimpleCube.obj", 'cell_0.obj', token) genysis.upload("EXPORTS/jackCube.obj", 'cell_1.obj', token) lattice.setComponent("cell_0.obj")
We can add multiple topologically equivalent components to blend between (shown above) within the lattice by adding attractors, using the .addCurveAttractor() method.
# FUNCTION TO IMPORT ATT CURVES (as sets of points) 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_ConformalDemo.csv') for i in range(len(attCrvs)): lattice.addCurveAttractor(cell_1,attCrvs[i],range=20)
Finally, we use the .setOutput() method and the .populateLattice() method to generate the populate the lattice and store its output mesh on the server.
out_file_name = 'conformalLattice_0.obj' lattice.setOutput(out_file_name) lattice.populateLattice(token)