for developers
Sign In
Join
Discussions
Documentation
Tutorials
Examples
Editor
Scene
Import Scene
Export Scene
Load Last Scene
Save Current Scene
Model
Save Model
Upload Model
Show Printability
Render
Preferences
Help
Reference Guide
Examples
Tutorials
Generate
Save Model
Reset Params
Check Model
var params = [ { name: "profile", label: "Profile", desc: "Profile", type: "uri", defaultVal: "http:\/\/www.shapeways.com\/rrstatic\/img\/shapejs\/creator\/toothbrush_holder_profile.png" }, { name: "pattern", label: "Pattern Type", desc: "Pattern Type", type: "enum", values: ["Gyroid","Lidinoid","SchwarzP","SchwarzD"], defaultVal: "Gyroid", }, { name: "period", label: "Period", desc: "How often to repeat", type: "Double", rangeMin: 15, rangeMax: 40, step: 1, defaultVal: 30, unit: "MM" }, { name: "thickness", label: "Thickness", desc: "How much to thicken the surface", type: "Double", rangeMin: 1, rangeMax: 5, step: 0.25, defaultVal: 3.2, unit: "MM" }, { name: "blend", label: "Blend", desc: "How much to blend the objects", type: "Double", rangeMin: 0, rangeMax: 5, step: 0.2, defaultVal: 2, unit: "MM" }, { name: "xtrans", label: "X Translation", desc: "Move the gyroid in x direction", type: "Double", rangeMin: -10, rangeMax: 10, step: 0.25, defaultVal: 0, unit: "MM" }, { name: "ytrans", label: "Y Translation", desc: "Move the gyroid in y direction", type: "Double", rangeMin: -10, rangeMax: 10, step: 0.25, defaultVal: 0, unit: "MM" }, { name: "topRim", label: "Top Rim", desc: "Percent Top Rim", type: "Double", rangeMin: 0, rangeMax: 0.25, step: 0.05, defaultVal: 0 }, { name: "bottomRim", label: "Bottom Rim", desc: "Percent Bottom Rim", type: "Double", rangeMin: 0, rangeMax: 0.25, step: 0.05, defaultVal: 0 } ]; function makeShell(profilePath, width, height, voxelSize, blend){ var radius = width/2; var boxDepth = 2*Math.PI*radius + blend / 2 + 2 * voxelSize; var boxWidth = radius; var boxHeight = height; var image = loadImage(profilePath); var grid = image.getGrid(); var expandOp = new ExpandOp(0,3,3,3); grid = expandOp.execute(grid); var image = new Image3D(grid, boxWidth, boxHeight, boxDepth, voxelSize); image.setBaseThickness(0.0); image.setBaseThreshold(0.5); image.setUseGrayscale(false); image.setBlurWidth(2*voxelSize); var ct = new CompositeTransform(); ct.add(new Rotation(0,1,0, -Math.PI/2)); // align side of the image box with xy lane ct.add(new Translation(0, 0, -radius/2)); ct.add(new RingWrap(radius)); image.setTransform(ct); return image; } function main(args){ var voxelSize = 0.5*MM; var vaseWidth = 84.6*MM; var vaseHeight = 127*MM; var profilePath = args.profile; var padding = 2*MM; var gWidth = vaseWidth + 2*padding; var gHeight = vaseHeight + 2*padding; var shell = makeShell(profilePath, vaseWidth, vaseHeight, voxelSize,args.blend); var pattern; if (args.pattern == "Gyroid") { pattern = new VolumePatterns.Gyroid(args.period, args.thickness); } else if (args.pattern == "Lidinoid") { pattern = new VolumePatterns.Lidinoid(args.period, args.thickness); } else if (args.pattern == "SchwarzP") { pattern = new VolumePatterns.SchwarzP(args.period, args.thickness); } else if (args.pattern == "SchwarzD") { pattern = new VolumePatterns.SchwarzD(args.period, args.thickness); } if (args.xtrans !== 0.0 || args.ytrans !== 0.0) pattern.setTransform(new Translation(args.xtrans,args.ytrans,0)); var volume; if (args.topRim === 0 && args.bottomRim === 0) { volume = pattern; } else { volume = new Union(pattern); } if (args.topRim !== 0) { volume.add(new Plane(new Vector3d(0,-1,0), -vaseHeight / 2 * (1.0-args.topRim))); } if (args.bottomRim !== 0) { volume.add(new Plane(new Vector3d(0,1,0), -vaseHeight / 2 * (1.0 - args.bottomRim))); } var intersection = new Intersection(shell,volume); intersection.setBlend(args.blend); var bounds = new Bounds(-gWidth/2,gWidth/2,-gHeight/2,gHeight/2,-gWidth/2,gWidth/2,voxelSize); var scene = new Scene(intersection, bounds,0.1*MM); scene.setMeshSmoothingWidth(2); scene.setMeshErrorFactor(0.05); scene.setMaxPartsCount(1); return scene; }
Preferences
Close
Printability Check
Region check
Voxel size
Number of regions
Largest region
Close