ENH: Expose geometry length units in the Python bindings

Abierto
#1,845 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 6 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp, python
Área
api, backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
18
Forks
15
Merge medio
4 d 23 h
PR fusionados (30 d)
42

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de BlueQuartzSoftware/simplnx

Todos los issues de BlueQuartzSoftware/simplnx

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.