Skip to content
tpaviot edited this page Jan 25, 2012 · 3 revisions

About

The dev branch tp/TKCOLLADA hosts an experimental COLLADA exporter: "COLLADA is a royalty-free XML schema that enables digital asset exchange within the interactive 3D industry".

How to use?

The COLLADA exporter just works as the STL exporter. Here is an example that creates a sphere and exports the result to a DAE file:

BRepPrimAPI_MakeSphere my_sphere(50.);
my_sphere.Build();
ColladaAPI_Writer myColladaWriter;
myColladaWriter.Write(my_sphere.Shape(), "sphere.dae");

You can pass any TopoDS_Shape to the COLLADA exporter. This TopoDS_Shape can come for instance from a standard file (STEP, IGES) or any .brep OCC file. A test was conducted with a part named "cylinder_head", avaible from the OpenCascade.org website (see http://www.opencascade.org/showroom/shapegallery/gal4/).

In the following example, the .brep file is loaded as a TopoDS_Shape and passed to the COLLADA exporter. This generates a file named "15_cylinder_head.dae" which can be imported into Google Sketchup or viewed the the builtin OSX viewer (see screenshots below).

The code for this example is the following:

// import file
Standard_CString aFileName = (Standard_CString) "15_cylinder_head.brep";
BRep_Builder aBuilder;
TopoDS_Shape aShape;
Standard_Boolean result = BRepTools::Read(aShape,aFileName,aBuilder);
// export TopoDS to a DAE file
ColladaAPI_Writer myColladaWriter;
myColladaWriter.Write(aShape, "15_cylinder_head.dae");
}

text

text

Status

So far, the COLLADA exporter only exports a triangular mesh with normals for a single shape.

TODO/Plans

  • Use LDOM as an XML exporter
  • Add support for multiple shapes (TopoDS_Compound)
  • Update the CDL files
  • Enable passing an AIS_Shape
  • Add support for KMZ export
Clone this wiki locally