genrating models in OBJ instead of X3D

Discussion in 'ShapeJS' started by polychemy, Dec 24, 2013.

  1. polychemy
    polychemy Member
    Hi everyone, i am using three.js as my main choice for displaying and manipulating 3D objects on the web.
    It seems Abfab3d exports to X3D, and there are no x3d three.js converters.

    X3DOM is very limited in my opinion. Anyway way to generate OBJ files instead?
     
  2. polychemy
    polychemy Member
    Hi any help? Exporting to STL would be fine too.

    anyone??
     
  3. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    AbFab3D has STL support but not OBJ. Our servers are only set for X3DB output right now. But if you want to run AbFab3D(the underlying toolkit for ShapeJS) yourself then you can specify the format. Here are the instructions:

    I've been getting some requests about how to run AbFab3D from the command-line. This will also give you STL output instead of X3DB.

    do an ant build at the top of the project.

    then goto apps/volumesculptor(former name of the project).

    ant runShell -Dscript=load.js -Darg0=foo.stl -Darg1=0.2

    For example a simple script to voxelize an stl:

    load.js would contain this:

    function main(args) {
    var baseFile = args[0];
    var voxelSize = args[1];
    var grid = load(baseFile,voxelSize*MM);
    return grid;
    }


    Changing the voxelSize can significantly change the processing time and accuracy(. If your doing small objects such as rings then you can likely use 0.06mm fairly well. If your doing something like a vase then you might have to go up to .5mm or more.

    I have it set for 8.8 gigs max ram, change runarg0 for your environment maximums.

     
    Last edited: Dec 30, 2013
  4. stannum
    stannum Well-Known Member
    Too much punch and not even the 31st. 0.6mm is bigger voxel than .5mm, you have the "up" axis flipped.
     
    Last edited: Dec 30, 2013
  5. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    Sorry, meant .06mm not .6mm for small rings. Post updated, thanks!
     
  6. polychemy
    polychemy Member
    Thanks Alan, I'll try that now.
     
  7. polychemy
    polychemy Member
    Hi Alan, thanks very much for the help.
    I manage to get everything up and running. I can know ouput STL files.

    But one problem is how do i specify the name of the file?

    Right now, the STL files i generate are named like my input script.

    For example i have this in text.txt:

    Code:
    function main(args){  // this script will make a sphere
    
        var radius = 5*MM;        // radius of sphere 5 millimeters
        var voxelSize = 0.1*MM;   // size of grid voxel
        var gw = radius*1.1;      // make the grid size a little larger to have some clearance 
      
        var grid = createGrid(-gw,gw,-gw,gw,-gw,gw,voxelSize); // create the grid 
      
        var maker = new GridMaker();            // create instance of grid maker
        maker.setSource(new Sphere(radius));    // gives GridMaker object to work on 
        maker.makeGrid(grid);                   // GridMaker fills the grid with data 
    
        return grid;   // return the grid for final processing 
    }
    This creates a simple sphere.

    But abFab generates an STL file named: "text.txt.stl"

    Is there a way to specify the file name and possibly the directory?

    Thanks!