ENH: Expose geometry length units in the Python bindings

Aperta
#1,845 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, python
Ambito
api, backend

Direzione di ricerca

Read src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp and compare its bindings for CreateImageGeometryAction and CreateVertexGeometryAction with the C++ constructors described in the issue. Check how geometry classes and enums are exposed in the Python module, then add the requested unit access and action arguments while preserving the stated defaults. Done when Python can read and set geometry units and pass units to both creation actions; the issue leaves broader action coverage open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Summary

Python code that builds geometries cannot set or read their length unit. Filters written in Python, or scripts that call the geometry actions directly, always get the C++ default unit, and they cannot tell what unit an existing geometry has.

What is requested: make geometry length units available in the Python bindings:

  • the IGeometry::LengthUnit enum (Nanometer, Micrometer, Millimeter, Meter, …, Unspecified);
  • reading and setting the unit of a geometry (IGeometry::getUnits() and setUnits());
  • the units argument of the geometry creation actions, starting with CreateImageGeometryAction and CreateVertexGeometryAction.

Why it is needed: several filters now set the unit on purpose. For example, #1838 creates orientation-space and pole-figure geometries with the unit Unspecified, because their coordinates are not lengths. A Python filter cannot do the same, and a Python script cannot check the unit of a geometry that a C++ filter created. Open issues such as #1782, #1784, #1792, #1796 and #1813 are about geometries losing their unit. Code written in Python has no way to avoid or detect the same problem.

How it works now (src/Plugins/SimplnxCore/wrapping/python/simplnxpy.cpp on develop at 2eb6b878f6ff408d1454754d4c0e63edd676d7e0):

  • CreateImageGeometryAction is bound with five arguments (path, dims, origin, spacing, cell_attribute_matrix_name). The C++ constructor also takes units, which defaults to Micrometer; Python always gets that default.
  • CreateVertexGeometryAction is bound with its two four-argument constructors. #1838 adds a units argument (default Meter) to both C++ constructors; the bindings do not pass it.
  • IGeometry::LengthUnit is not bound, and the geometry classes do not expose getUnits() or setUnits() to Python.

Where it applies: the SimplnxCore Python module (simplnxpy.cpp), and any Python filter or script that creates or inspects geometries.

Still open: whether the other geometry creation actions (Rectilinear Grid, Edge, Triangle, Quad, Tetrahedral, Hexahedral) should also take a unit. They take none in C++ today.

Existing Python calls should keep their current defaults: Micrometer for image geometries and Meter for vertex geometries.

Lingua principale
C++
Stelle
18
Fork
15
Merge medio
4g 23h
PR unite (30g)
42

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di BlueQuartzSoftware/simplnx

Tutte le issue di BlueQuartzSoftware/simplnx

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.