Skip to content
bsutton edited this page Oct 23, 2011 · 11 revisions

The 3DC library provides for the manipulation of common graphics file formats (STL, AMF) including:

  • rotation
  • position translations
  • unit conversion
  • merging
  • file format conversion

The 3DC library also provides a command line interface which supports all of the above functions.

Prerequisites

  • Java 1.6

Download

Download the 3dc.jar

Supported file formats

  • STL
  • STLB
  • Obj - limited
  • AMF

Running

To run 3DC from the command line type:

java -jar 3dc-1.0.jar

Command Line Arguments

3dc takes a series of command line arguments which essentially define the set of input files, the set of transformation to be applied to the input files and the final output file.

The simplest form of the command line is:

java -jar 3dc-1.0.jar -i input.stl -o output.stl

The above command would simply read the input.stl file and write it out to the file output.stl. This is actually a somewhat useful operation as some CAD applications output STL files which can't be ready be all programs. 3dc is able to clean these files up as it copies them.

Every time 3dc is invoked you MUST specify one or more input files and one output file. If you specify multiple input files all of the objects are combined and written out to the output file. The most useful form of this is when the output file is an AMF file as AMF supports 'multi-object' files with each object being able to specify a different material and/or colour.

java -jar 3dc-1.0.jar -i input1.stl -i input2.stl -o output.amf

The above command reads both of the input files and writes any contained objects to the resulting AMF file.

To apply transformation to an input file add a set of transformation directives after the input file.

java -jar 3dc-1.0.jar -i input1.stl -r 90:0:0 -i input2.stl -t 10:0:0 -o output.amf

The above command reads the objects from input1.stl and rotates them 90 degrees around the X axis, the objects from input2.stl are read and translated +10 units along the X axis. The transformed objects from both sets of input files are then written to the output.amf file.

You can also apply multiple transforms to each input file.

java -jar 3dc-1.0.jar -i input1.stl -r 90:0:0 -t 5:10:100 -i input2.stl -o output.amf

The above command applies two transformations to input1.stl, input2.stl's object as simply read without any transformations being applied. Both sets of objects are then written out to output.amf.

3dc -v -i src/test/resources/cube.stl -u millimeter -material pla -colour red -i src/test/resources/kwartzlab.stl -u meter -material abs -r 0:0:0 -i src/test/resources/rook.amf -material pla -u micron -t 10:10:10 -r 180:0:180 -i src/test/resources/rook.stl -material pla -colour yellow -o src/test/resources/result.amf -u millimeter ###-c | -colour Used by input files to assign a colour to the objects contained in the file. The output file must be able to support colour properties for this to have any meaning. Currently only AMF supports colour.

The colour option must come after the -i option.

e.g. -c red

###-i | -input <inputfilename.ext> Defines an input file to be loaded an manipulated according to the arguments that follow after the filename.

e.g. -i input.stl

###-v | -version Prints the version number of 3DC on startup.

-u | -units <micron|millimeter|meter|inch|feet>

Specifies the units of measure for either an input file or an output file. If no units of measure is specified on a file then millimeters are assumed. All input files are converted to the output files unit of measure. 3dc -v -i src/test/resources/cube.stl -u millimeter -material pla -colour red -i src/test/resources/kwartzlab.stl -u meter -material abs -r 0:0:0 -i src/test/resources/rook.amf -material pla -u micron -t 10:10:10 -r 180:0:180 -i src/test/resources/rook.stl -material pla -colour yellow -o src/test/resources/result.amf -u millimeter

The above command combines four files (cube.stl, kwartzlab.stl, rook.amf and rook.stl) into a single file called result.amf. As the four files are combined the are converted into a common unit of measure (millimeter) translated and rotated in the 3d co-ord plane and each input file is assigned a material and a colour.

Clone this wiki locally