ENH: Expose geometry length units in the Python bindings

未关闭
#1,845 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp, python
领域
api, backend

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C++
星标
18
派生
15
平均合并
4 天 23 小时
30 天内合并 PR
42

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

BlueQuartzSoftware/simplnx 的其他 Issue

查看 BlueQuartzSoftware/simplnx 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。