Skip to content

Releases: leonhard-s/Py2DM

Version 0.2.2

12 Sep 12:04
Compare
Choose a tag to compare

Additions

  • Added the py2dm.utils submodule containing utilities related to 2DM development, such as converters for malformed 2DM files, a utility for merging meshes along adjacent edges (work-in-progress, see #6), and converting Triangle result files to 2DM for automated testing and benchmarking.
  • Introduced the py2dm.implementation global to allow introspection of which parser is loaded (will be set to "c" or "python" respectively).

Fixes

  • Fixed a build error that would cause the C extension build to fail when building from source when using MSVC. Installations using the prebuilt wheel are unaffected.
  • Fixed an issue that caused the first line of node indices to be ignored for multiline node string definitions in some formats.
  • Fixed an issue that would cause the parser to seek to the beginning of the file if no node strings were provided, leading to reduced reader performance for large meshes without node strings.

Changes

  • Py2DM will no longer emit a UserWarning when loaded without C extension on CPython. Instead, the user may test for the currently used implementation using the py2dm.implementation global mentioned above.
  • All file paths may now also allow pathlib.Path arguments, in addition to strings.

Version 0.2.1

13 Jul 19:44
Compare
Choose a tag to compare

Fixes

  • Resolved an issue that could cause some type checkers to not properly detect the types of entity attributes
  • Corrected the type hint for py2dm.Element.nodes which used to report tuple[int, int, int] instead of tuple[int, ...]

Changes

  • The py2dm.Entity base class is now part of the external API
  • The py2dm.Writer class will now raise an exception when attempting to commit nodes or elements with negative IDs to disk

Documentation

  • Updated function signatures to include overloads
  • Improved type reporting for attributes and classes
  • Most objects in the documentation should now properly link to their definitions, especially in function signatures

Version 0.2.0

05 Apr 21:58
Compare
Choose a tag to compare

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.

Version 0.1.1

28 Oct 18:04
Compare
Choose a tag to compare

Add support for MESHNAME <name> tag

Version 0.1.0

25 Jun 12:00
Compare
Choose a tag to compare

Initial public release for testing and troubleshooting purposes.

This version supports all 2DM geometry tags and provides reasonably fast write speeds, but should not be considered final or ready for production.