Search in sources :

Example 6 with IndentingPrintWriter

use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.

the class FemMeshComp method writeMesh.

/**
 * Writes the mesh for this FemMeshComp out to a named file,
 * using the format described for
 * {@link #writeMesh(PrintWriter)}.
 *
 * @param fileName Name of file to write the mesh to
 * @return <code>true</code> if the mesh is a polygonal mesh and was written,
 * and <code>false</code> otherwise.
 */
public boolean writeMesh(String fileName) {
    IndentingPrintWriter pw = null;
    boolean status = false;
    try {
        pw = ArtisynthIO.newIndentingPrintWriter(fileName);
        status = writeMesh(pw);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (pw != null) {
            pw.close();
        }
    }
    return status;
}
Also used : IOException(java.io.IOException) IndentingPrintWriter(maspack.util.IndentingPrintWriter)

Example 7 with IndentingPrintWriter

use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.

the class MFreeMeshComp method writeMesh.

/**
 * Writes the mesh for this FemMeshComp out to a named file,
 * using the format described for
 * {@link #writeMesh(PrintWriter)}.
 *
 * @param fileName Name of file to write the mesh to
 * @return <code>true</code> if the mesh is a polygonal mesh and was written,
 * and <code>false</code> otherwise.
 */
public boolean writeMesh(String fileName) {
    IndentingPrintWriter pw = null;
    boolean status = false;
    try {
        pw = ArtisynthIO.newIndentingPrintWriter(fileName);
        status = writeMesh(pw);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (pw != null) {
            pw.close();
        }
    }
    return status;
}
Also used : IOException(java.io.IOException) IndentingPrintWriter(maspack.util.IndentingPrintWriter)

Example 8 with IndentingPrintWriter

use of maspack.util.IndentingPrintWriter in project artisynth_core by artisynth.

the class NURBSCurve2dTest method writeCurve.

public void writeCurve(String fileName, NURBSCurve2d curve) {
    try {
        PrintWriter pw = new IndentingPrintWriter(new PrintWriter(new BufferedWriter(new FileWriter(fileName))));
        curve.write(pw);
        pw.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : FileWriter(java.io.FileWriter) IndentingPrintWriter(maspack.util.IndentingPrintWriter) IndentingPrintWriter(maspack.util.IndentingPrintWriter) PrintWriter(java.io.PrintWriter) BufferedWriter(java.io.BufferedWriter)

Aggregations

IndentingPrintWriter (maspack.util.IndentingPrintWriter)8 IOException (java.io.IOException)5 FileWriter (java.io.FileWriter)3 BufferedWriter (java.io.BufferedWriter)2 PrintWriter (java.io.PrintWriter)2 RootModel (artisynth.core.workspace.RootModel)1 NumberFormat (maspack.util.NumberFormat)1