Class MeshLabLauncher

java.lang.Object
org.web3d.x3d.jsail.MeshLabLauncher

public class MeshLabLauncher extends Object
Utility class for invoking and launching MeshLab via local operating system to perform a variety of conversion tasks. Note use of static methods.

See Also:
  • Field Details

  • Constructor Details

    • MeshLabLauncher

      public MeshLabLauncher()
  • Method Details

    • getMeshLabServerExecutableName

      public static final String getMeshLabServerExecutableName()
      Get directory path for location of meshlabserver program: meshlabserver.exe on Windows, meshlabserver otherwise.
      Returns:
      name of meshlabserver program
      See Also:
    • setMeshLabServerExecutableName

      public static final void setMeshLabServerExecutableName(String newValue)
      Set meshLabServerExecutableName for alternate name of meshlabserver program.
      Parameters:
      newValue - is new value to assign `
    • getMeshLabPath

      public static final String getMeshLabPath()
      Get directory path for location of meshlabserver program.
      Returns:
      directory path for location of meshlabserver program
    • setMeshLabPath

      public static final void setMeshLabPath(String newValue)
      Set directory path for location of meshlabserver program.
      Parameters:
      newValue - is new value to assign
    • checkMeshLabPath

      public static void checkMeshLabPath()
      Check MeshLab local path and also executable name, reset to operating system defaults if necessary. Executable name: meshlabserver.exe on Windows, meshlabserver otherwise.
      See Also:
    • wasPriorCommandSuccessful

      public static boolean wasPriorCommandSuccessful()
      Report whether prior command execution was successful.
      Returns:
      whether prior command execution was successful. [warning] meshlabserver may popup an exception window while running headless (not very smart) which can cause exception to be lost following timeout.
      See Also:
    • executeCommand

      protected static String executeCommand(String command)
      Launch MeshLab in operating system and run command. [warning] meshlabserver may popup an exception window while running headless (not very smart) which can cause exception to be lost following timeout.
      Parameters:
      command - MeshLab invocation
      Returns:
      console results
      See Also:
    • convertModel

      public static boolean convertModel(String inputFileName, String outputFileName)
      Use meshLab to convert model from one file to another.
      Parameters:
      inputFileName - for input file
      outputFileName - for output file
      Returns:
      whether successful
      See Also:
    • convertModel

      public static boolean convertModel(String path, String inputFileName, String outputFileName)
      Use meshLab to convert model from one file to another.
      Parameters:
      path - directory path to file of interest
      inputFileName - for input file
      outputFileName - for output file
      Returns:
      whether successful
      See Also:
    • importModel

      public static X3D importModel(String fileName)
      Use meshLab to import model to X3D.
      Parameters:
      fileName - for input file
      Returns:
      result, null if unsuccessful
      See Also:
    • importModel

      public static X3D importModel(String path, String fileName)
      Use meshLab to import model to X3D.
      Parameters:
      path - directory path to file of interest
      fileName - for input file
      Returns:
      result, null if unsuccessful
      See Also:
    • importSTL

      public X3D importSTL(String path, String fileName)
      TODO: Use meshLab to import STL geometry as X3D model
      Parameters:
      path - directory path to file of interest
      fileName - for input file
      Returns:
      result, null if unsuccessful
      See Also:
    • exportModelToFile

      public static boolean exportModelToFile(X3D modelToExport, String path, String fileName)
      TODO: Use MeshLab to export geometry to STL
      Parameters:
      modelToExport - X3D model of interest
      path - directory path for X3D model of interest
      fileName - file name for X3D model of interest
      Returns:
      plain-text STL file
      See Also:
    • exportSTLtoFile

      public static boolean exportSTLtoFile(X3D modelToExport, String path, String fileName)
      TODO: Use MeshLab to export geometry to file
      Parameters:
      modelToExport - X3D model of interest
      path - directory path to file of interest
      fileName - for output file
      Returns:
      whether successful
      See Also:
    • getMeshLabAnalytics

      public static String getMeshLabAnalytics(X3D modelOfInterest)
      TODO: Get MeshLab metrics for X3D model of interest.
      Parameters:
      modelOfInterest - X3D model to analyze
      Returns:
      MeshLab output
      See Also:
    • getMeshLabAnalyticsX3dMetadataSet

      public static MetadataSet getMeshLabAnalyticsX3dMetadataSet(X3D modelOfInterest)
      TODO: Get MeshLab metrics as MetadataSet object.
      Parameters:
      modelOfInterest - X3D model to analyze
      Returns:
      MeshLab output
      See Also:
    • getMeshLabVersion

      public static String getMeshLabVersion()
      Get MeshLab version. Warning: ensure MESHLAB_HOME or local path is set correctly, especially if more than one version is installed.
      Returns:
      MeshLab version.
      See Also:
    • hasMeshLab

      public static boolean hasMeshLab()
      Determine if MeshLab is locally available. Warning: ensure MESHLAB_HOME or local path is set correctly, especially if more than one version is installed.
      Returns:
      whether MeshLab is found.
      See Also:
    • getMeshLabHelp

      public static String getMeshLabHelp()
      Get default MeshLab help message (from invocation without command-line parameters).
      Returns:
      MeshLab help message.
      See Also:
    • getPriorMeshLabTraceLogFilePath

      public static String getPriorMeshLabTraceLogFilePath()
      Get name of MeshLab trace log file produced during most recent MeshLab operation.
      Returns:
      name of most recent MeshLab trace log file
    • setPriorMeshLabTraceLogFilePath

      public static void setPriorMeshLabTraceLogFilePath(String value)
      Set name of MeshLab trace log file produced during most recent MeshLab operation.
      Parameters:
      value - new path and file name for meshLabTraceLogFilePath
    • getPriorMeshLabTraceLogContents

      public static String getPriorMeshLabTraceLogContents()
      Get contents of MeshLab trace log file produced during most recent MeshLab operation.
      Returns:
      contents of most recent MeshLab trace log file
    • initialize

      public static final void initialize()
      Initialize this MeshLabLauncher instance to default values.
    • main

      public static void main(String[] args)
      Default main() method provided for test and debugging purposes, invoking run() method.
      Parameters:
      args - the command line arguments
      See Also:
    • run

      public static void run(String singleStringArguments)
      Utility run() method provided for test and debugging purposes, allowing invocation with a single String (rather than a String[] array). When invoked without parameters then reports results of validate() self-checks to system output.
      Parameters:
      singleStringArguments - the command line arguments
      See Also:
    • run

      public static void run(String[] args)
      Default run() method provided for test and debugging purposes, first initializing ConfigurationProperties then reading properties file (if any) and processing arguments. When invoked without parameters then reports results of validate() self-checks to system output.
      Parameters:
      args - the command line arguments
      See Also:
    • launchMeshLabWebPage

      public static void launchMeshLabWebPage()
      Open MeshLab page
      See Also: