Package org.web3d.x3d.jsail
Class MeshLabLauncher
java.lang.Object
org.web3d.x3d.jsail.MeshLabLauncher
public class MeshLabLauncher
extends java.lang.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:
- STL (file format), MeshLab, Wikipedia: MeshLab, SourceForge: meshlab in command-line?, SourceForge: Automating Meshlab conversion , GitHub: meshlabserver.txt command-line help, GitHub: TheNerdJedi/MeshlabAuto, Mr. P. MeshLab Tutorials: MeshLab Basics, Mr. P. MeshLab Tutorials: 3D Scanning pipeline, Mr. P. MeshLab Tutorials: Features, Mr. P. MeshLab Tutorials: Cleaning, StackOverflow: MeshLab, GitHub: MeshlabAuto, GitHub: issues, MeshLab References, Java Tutorials: Understanding (Static) Class Members, X3D Scene Authoring Hints
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMESHLAB_PATH_DEFAULT_LINUXDefault MeshLab path default for Linux operating system, possibly unneeded ifmeshlabserveris in path already.static java.lang.StringMESHLAB_PATH_DEFAULT_MACOSDefault MeshLab path default for macOS operating system, possibly unneeded ifmeshlabserveris in path already.static java.lang.StringMESHLAB_PATH_DEFAULT_WINDOWSDefault MeshLab path default for Windows 7 or 10 operating system, possibly unneeded ifmeshlabserveris in path already.static java.lang.StringMESHLAB_URLMeshLab website URLstatic java.lang.StringUSAGEUsage:java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.MeshLabLauncher sourceFile [-convert [resultFile]] [-home | -help | -properties fileName.properties | -MESHLAB_PATH directoryPath] -
Constructor Summary
Constructors Constructor Description MeshLabLauncher() -
Method Summary
Modifier and Type Method Description static voidcheckMeshLabPath()Check MeshLab local path and also executable name, reset to operating system defaults if necessary.static booleanconvertModel(java.lang.String inputFileName, java.lang.String outputFileName)Use meshLab to convert model from one file to another.static booleanconvertModel(java.lang.String path, java.lang.String inputFileName, java.lang.String outputFileName)Use meshLab to convert model from one file to another.protected static java.lang.StringexecuteCommand(java.lang.String command)Launch MeshLab in operating system and run command.static booleanexportModelToFile(X3DObject modelToExport, java.lang.String path, java.lang.String fileName)TODO: Use MeshLab to export geometry to STLstatic booleanexportSTLtoFile(X3DObject modelToExport, java.lang.String path, java.lang.String fileName)TODO: Use MeshLab to export geometry to filestatic java.lang.StringgetMeshLabAnalytics(X3DObject modelOfInterest)TODO: Get MeshLab metrics for X3D model of interest.static MetadataSetObjectgetMeshLabAnalyticsX3dMetadataSet(X3DObject modelOfInterest)TODO: Get MeshLab metrics as MetadataSet object.static java.lang.StringgetMeshLabHelp()Get default MeshLab help message (from invocation without command-line parameters).static java.lang.StringgetMeshLabPath()Get directory path for location ofmeshlabserverprogram.static java.lang.StringgetMeshLabServerExecutableName()Get directory path for location ofmeshlabserverprogram:meshlabserver.exeon Windows,meshlabserverotherwise.static java.lang.StringgetMeshLabVersion()Get MeshLab version.static java.lang.StringgetPriorMeshLabTraceLogContents()Get contents of MeshLab trace log file produced during most recent MeshLab operation.static java.lang.StringgetPriorMeshLabTraceLogFilePath()Get name of MeshLab trace log file produced during most recent MeshLab operation.static booleanhasMeshLab()Determine if MeshLab is locally available.static X3DObjectimportModel(java.lang.String fileName)Use meshLab to import model to X3D.static X3DObjectimportModel(java.lang.String path, java.lang.String fileName)Use meshLab to import model to X3D.X3DObjectimportSTL(java.lang.String path, java.lang.String fileName)TODO: Use meshLab to import STL geometry as X3D modelstatic voidinitialize()Initialize this MeshLabLauncher instance to default values.static voidlaunchMeshLabWebPage()Open MeshLab pagestatic voidmain(java.lang.String[] args)Default main() method provided for test and debugging purposes, invoking run() method.static voidrun(java.lang.String singleStringArguments)Utility run() method provided for test and debugging purposes, allowing invocation with a single String (rather than a String[] array).static voidrun(java.lang.String[] args)Default run() method provided for test and debugging purposes, first initializing ConfigurationProperties then reading properties file (if any) and processing arguments.static voidsetMeshLabPath(java.lang.String newValue)Set directory path for location ofmeshlabserverprogram.static voidsetMeshLabServerExecutableName(java.lang.String newValue)Set meshLabServerExecutableName for alternate name ofmeshlabserverprogram.static voidsetPriorMeshLabTraceLogFilePath(java.lang.String value)Set name of MeshLab trace log file produced during most recent MeshLab operation.static booleanwasPriorCommandSuccessful()Report whether prior command execution was successful.
-
Field Details
-
MESHLAB_URL
public static final java.lang.String MESHLAB_URLMeshLab website URL- See Also:
launchMeshLabWebPage(), Constant Field Values
-
MESHLAB_PATH_DEFAULT_WINDOWS
public static final java.lang.String MESHLAB_PATH_DEFAULT_WINDOWSDefault MeshLab path default for Windows 7 or 10 operating system, possibly unneeded ifmeshlabserveris in path already. Warning: local settings vary, configure path if necessary. -
MESHLAB_PATH_DEFAULT_MACOS
public static final java.lang.String MESHLAB_PATH_DEFAULT_MACOSDefault MeshLab path default for macOS operating system, possibly unneeded ifmeshlabserveris in path already. Warning: local settings vary, configure path if necessary. -
MESHLAB_PATH_DEFAULT_LINUX
public static final java.lang.String MESHLAB_PATH_DEFAULT_LINUXDefault MeshLab path default for Linux operating system, possibly unneeded ifmeshlabserveris in path already. Warning: local settings vary, configure path if necessary. -
USAGE
public static final java.lang.String USAGEUsage:java [-classpath X3DJSAIL.*.jar] org.web3d.x3d.jsail.MeshLabLauncher sourceFile [-convert [resultFile]] [-home | -help | -properties fileName.properties | -MESHLAB_PATH directoryPath]- See Also:
- Constant Field Values
-
-
Constructor Details
-
MeshLabLauncher
public MeshLabLauncher()
-
-
Method Details
-
getMeshLabServerExecutableName
public static final java.lang.String getMeshLabServerExecutableName()Get directory path for location ofmeshlabserverprogram:meshlabserver.exeon Windows,meshlabserverotherwise.- Returns:
- name of meshlabserver program
- See Also:
checkMeshLabPath(),setMeshLabPath(String)
-
setMeshLabServerExecutableName
public static final void setMeshLabServerExecutableName(java.lang.String newValue)Set meshLabServerExecutableName for alternate name ofmeshlabserverprogram.- Parameters:
newValue- is new value to assign `
-
getMeshLabPath
public static final java.lang.String getMeshLabPath()Get directory path for location ofmeshlabserverprogram.- Returns:
- directory path for location of meshlabserver program
-
setMeshLabPath
public static final void setMeshLabPath(java.lang.String newValue)Set directory path for location ofmeshlabserverprogram.- 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.exeon Windows,meshlabserverotherwise. -
wasPriorCommandSuccessful
public static boolean wasPriorCommandSuccessful()Report whether prior command execution was successful.- Returns:
- whether prior command execution was successful.
Warning:
meshlabservermay popup an exception window while running headless (not very smart) which can cause exception to be lost following timeout. - See Also:
- StackOverflow: possible to capture pop-up message box?
-
executeCommand
protected static java.lang.String executeCommand(java.lang.String command)Launch MeshLab in operating system and run command. Warning:meshlabservermay 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:
- MeshLab, Wikipedia: MeshLab, StackOverflow: possible to capture pop-up message box?, Why does Runtime.exec(String) work for some but not all commands?, StackOverflow: Runtime.getRuntime().exec(cmd) hanging, StackOverflow: Executing another application from Java, java.lang.Runtime, java.lang.ProcessBuilder
-
convertModel
public static boolean convertModel(java.lang.String inputFileName, java.lang.String outputFileName)Use meshLab to convert model from one file to another.- Parameters:
inputFileName- for input fileoutputFileName- for output file- Returns:
- whether successful
- See Also:
- MeshLab, Wikipedia: MeshLab
-
convertModel
public static boolean convertModel(java.lang.String path, java.lang.String inputFileName, java.lang.String outputFileName)Use meshLab to convert model from one file to another.- Parameters:
path- directory path to file of interestinputFileName- for input fileoutputFileName- for output file- Returns:
- whether successful
- See Also:
- MeshLab, Wikipedia: MeshLab
-
importModel
Use meshLab to import model to X3D.- Parameters:
fileName- for input file- Returns:
- result, null if unsuccessful
- See Also:
- MeshLab, Wikipedia: MeshLab
-
importModel
Use meshLab to import model to X3D.- Parameters:
path- directory path to file of interestfileName- for input file- Returns:
- result, null if unsuccessful
- See Also:
- MeshLab, Wikipedia: MeshLab
-
importSTL
TODO: Use meshLab to import STL geometry as X3D model- Parameters:
path- directory path to file of interestfileName- for input file- Returns:
- result, null if unsuccessful
- See Also:
- MeshLab, Wikipedia: MeshLab
-
exportModelToFile
public static boolean exportModelToFile(X3DObject modelToExport, java.lang.String path, java.lang.String fileName)TODO: Use MeshLab to export geometry to STL- Parameters:
modelToExport- X3D model of interestpath- directory path for X3D model of interestfileName- file name for X3D model of interest- Returns:
- plain-text STL file
- See Also:
- STL (file format), MeshLab, Wikipedia: MeshLab
-
exportSTLtoFile
public static boolean exportSTLtoFile(X3DObject modelToExport, java.lang.String path, java.lang.String fileName)TODO: Use MeshLab to export geometry to file- Parameters:
modelToExport- X3D model of interestpath- directory path to file of interestfileName- for output file- Returns:
- whether successful
- See Also:
- STL (file format), MeshLab, Wikipedia: MeshLab
-
getMeshLabAnalytics
TODO: Get MeshLab metrics for X3D model of interest.- Parameters:
modelOfInterest- X3D model to analyze- Returns:
- MeshLab output
- See Also:
- STL (file format), MeshLab, Wikipedia: MeshLab
-
getMeshLabAnalyticsX3dMetadataSet
TODO: Get MeshLab metrics as MetadataSet object.- Parameters:
modelOfInterest- X3D model to analyze- Returns:
- MeshLab output
- See Also:
- MeshLab, Wikipedia: MeshLab
-
getMeshLabVersion
public static java.lang.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:
- MeshLab, Wikipedia: MeshLab
-
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:
- MeshLab, Wikipedia: MeshLab
-
getMeshLabHelp
public static java.lang.String getMeshLabHelp()Get default MeshLab help message (from invocation without command-line parameters).- Returns:
- MeshLab help message.
- See Also:
- MeshLab, Wikipedia: MeshLab
-
getPriorMeshLabTraceLogFilePath
public static java.lang.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(java.lang.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 java.lang.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(java.lang.String[] args)Default main() method provided for test and debugging purposes, invoking run() method.- Parameters:
args- the command line arguments- See Also:
run(String[]),X3DObject.handleArguments(String[])
-
run
public static void run(java.lang.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(String[])
-
run
public static void run(java.lang.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:
main(String[]),ConfigurationProperties,X3DObject.handleArguments(String[])
-
launchMeshLabWebPage
public static void launchMeshLabWebPage()Open MeshLab page- See Also:
- https://www.MeshLab.net,
MESHLAB_URL
-