Skip to content

Version 0.2.0

Compare
Choose a tag to compare
@leonhard-s leonhard-s released this 05 Apr 21:58
· 70 commits to master since this release

Highlights

  • Rewrote file handling interface
  • Added optional C extension for increased performance
  • Both files read and the writer methods are now more thoroughly checking for nonsensical input and will raise specific errors
  • The py2dm.Writer class now supports writing a file in batches to reduce memory impact of writing large files
  • The documentation has been rewritten for better coverage

Compatibility

  • The py2dm.Reader class is largely compatible with the previous implementation despite significant internal changes. It is still recommended to treat it as a breaking change when adapting your code to use the new version.

  • The py2dm.Writer class' write_* methods have been replaced by an internal object cache that can be committed to disk via the flush_* methods.

    This change does not affect applications that relied on the context manager to write the file once all objects were added.

  • The new implementation of the py2dm.Reader class means that meshes with gaps or holes are no longer supported. The py2dm.utils module contains a converter method that renumbers a mesh to use one-indexed, consecutive IDs which are compatible with this new implementation.

Provisional features

The following are capabilities that are provided for testing purposes but are not part of the library's API. If you use these, be sure to specify the exact version of Py2DM your app requires to avoid issues with updates.

  • The flush_* methods of the py2dm.Writer class support anonymous keyword arguments that may be used to specify custom formatting options when writing meshes.

    Namely, passing compact=True will write the default Python float representation of any numbers, with minimal whitespace and decimal characters used.

    This can greatly reduce file size, but makes the resulting file harder to navigate and edit by hand.

  • To write a large number of node strings into a single line (as is required for use with BASEMENT), you can pass the fold_after=0 keyword argument to the py2dm.Writer.flush_node_strings() method.