Skip to main content

Interactive canvas for editing 3D geometry, using matplotlib.pyplot

Project description

xyz_canvas

Interactive canvas for editing 3D geometry, using only matplotlib.pyplot

This is a demo of xyz_canvas (pre-release, V0.4.0), a Python library intended to support adding, editing, and connecting 3D wire-frame objects using only Matplotlib.

The idea is that this will be called by code that needs the user to define / edit these objects in 3D space.

The capability being demonstrated is being able to create and edit in 3D space using only Matplotlib. This is somewhat distinct from the demo program itself, which works as described below. The features of the demo that support this capability are:

  1. Using ax.format_coord(event.xdata, event.ydata) to create a '3D Mouse' class 'mouse_3D'
  2. Using the 3D mouse to position lines with end points pinned to the 'backplanes' of the 3D view
  3. Using a 3D frame visualisation, and temporarily fixing one coordinate's value, to provide a UI to move end points into general 3D space (away from backplanes)
  4. Using the backplane-pinned 3D coordinates of the 3D mouse at the time of line end selection to decide which coordinate to fix during the 3D move

Demo progam

The demo program demo.py is minimal, as is the object creation capability of the canvas.py 'engine', but these limitations don't detract from the core idea stated above.

Currently, objects consist only of lines, which may be disconnected. An object consists of one or more lines. Pressing 'save' fires the callback with the set of added lines as an argument. To add a line, click two points within the axis space. The view may be rotated at any time by clicking and dragging just oustide the axis space.

Known issues

As of now, there are no known issues with the capability being demonstrated; it is possible to use only the mouse (and only the main button) to create and move line ends in 3D. However, see below.

Next Steps

I intend to make the demonstration capabilty more useful, e.g. I will add a 'delete most recent' button alongside the 'clear' (all) button, so that this could be used as-is within other software. Also note that I need to work out if it's possible to disentangle the core capability from the supporting demonstration code, as the latter isn't fully contained in demo.py and infact exists within canvas.py.

One way to do this might be to combine steps 2 and 3 above, and rewriting the library so that its sole function is to get a true 3D point from the user.

Installation

Install with pip:

pip install xyz_canvas

Demo Screenshot

Capture

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xyz_canvas-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xyz_canvas-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file xyz_canvas-1.0.0.tar.gz.

File metadata

  • Download URL: xyz_canvas-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for xyz_canvas-1.0.0.tar.gz
Algorithm Hash digest
SHA256 46b7108f892325360ab11eb6740b18174acbd8bb8bc4be1c1c44e4be658341d5
MD5 5d43338b9af97e5c28927a964a4003ed
BLAKE2b-256 d444aa06fa62b96f1a3f25d47a065d67c8e4bc7de04c1935cd4317b7b0b127e1

See more details on using hashes here.

File details

Details for the file xyz_canvas-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: xyz_canvas-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for xyz_canvas-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a932d125ab7b503057d552a85e1aad0db71a22c35d2374924b980f954197968
MD5 b28ca286f471e1db69a4710514008ca0
BLAKE2b-256 ef97ff125f001367a4ff3ef26fb9086bb455dd24c3260c60e424b24311387529

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page