Posts

Showing posts from April, 2026

Using PyMeshLab

Image
This document summarizes some of the usage of the pymeshlab library. Unfortunately, the library has been through severe changes over time, so some methods are renamed and filter calling conventions are shifting too, which makes AI and humans mad :-) Core Concepts The MeshSet The MeshSet is the primary container for handling multiple mesh layers and applying filters. ms = pymeshlab.MeshSet() Mesh Objects Individual meshes within a MeshSet . They contain the geometry and attribute data. mesh = ms.current_mesh() Basic Operations Loading and Saving # Load a new mesh into the MeshSet ms.load_new_mesh("input.stl") # Save the currently selected mesh ms.save_current_mesh("output.stl", colormode=False) Layer Management # Get total number of meshes in the MeshSet count = ms.mesh_number() # Select a specific mesh by index ms.set_current_mesh(1) # Delete the currently active mesh ms.delete_current_mesh() # Control visibility (often used for merging) ms.set_cu...

The Problem: Why Batch Files Fail

  I recently encountered an unusual error when trying to pass certain filenames to a Python app as inputs. After a moment, I realized the troubled ones had a comma in their filename, which should be totally valid, isn't it? It turns out Windows Batch ( cmd.exe ) is built on legacy rules where the comma ( , ) , semicolon ( ; ) , and equals sign ( = ) are treated as delimiters, exactly like a space . When you drag a file named Data,Project.txt onto a .bat file: Explorer sends the raw string to the command processor. CMD sees the comma and splits the filename into two arguments: %1 becomes  Data  and %2 becomes Project.txt . The comma is deleted from the stream entirely ( 🤦 ). The Solutions: From Hack to Hero Method The "Ugly Hack" (Batch) The "Robust" Way (Shortcut) The "Pro" Way (PyInstaller) Setup Create a .bat file with %* Right-click .py > Create Shortcut Compile script to a standalone .exe The Trick python script.py "%*" Edit ...