ENH: Expose geometry length units in the Python bindings

Đang mở
#1,845 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, python
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C++
Star
18
Fork
15
Merge trung bình
4 ngày 23 giờ
Pull request đã merge (30 ngày)
42

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của BlueQuartzSoftware/simplnx

Tất cả issue của BlueQuartzSoftware/simplnx

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.