| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ery#167) CurveOnSurface returns a non-void Handle and reports its parameter range through Standard_Real& reference args, which are unreachable from Python (pybind11 cannot write back immutable types). The existing call-by-reference tuple mechanism only triggers for void-returning methods, so this case is missed. Add a targeted, non-breaking workaround via the rules mechanism: a new static method CurveOnSurface_r(E, F) that returns (pcurve, first, last). The original CurveOnSurface_s binding is left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
Summary
Fixes #167.
BRep_Tool::CurveOnSurface returns a non-void Handle(Geom2d_Curve) and reports the
edge's parameter range through reference arguments (Standard_Real& First, Standard_Real& Last).
Because Standard_Real maps to an immutable Python float, those outputs cannot be written
back to the caller, so the parameter range is unreachable from Python — which blocks the
parametric-space (UV) workflows described in the issue.
The existing call-by-reference → tuple mechanism (is_byref in pywrap) only triggers for
void-returning methods, so a non-void method like this one is missed.
Change
A targeted, non-breaking workaround via the rules mechanism (as suggested in the issue
thread — "add workaround method in the binding manually or via rules"). It adds a new static
method and leaves the original CurveOnSurface_s binding untouched:
Usage:
The _r suffix denotes "reference outputs returned as a tuple". Only the edge-on-face
overload is wrapped here.
Questions for the maintainers
@adam-urbanczyk
Does this targeted approach look acceptable? It mirrors the existing
additional_static_methods precedents and changes no existing signatures.
Would you prefer a more general implementation instead? The void call-by-reference
tuple handling could be generalized to also cover non-void methods whose outputs come
back through immutable-type references (Standard_Real/Standard_Integer/Standard_Boolean),
auto-generating these tuple variants — i.e. the same treatment void functions already get.
That would be a change in pywrap (relaxing the void-only gate in is_byref and
extending the byref lambda in template_sub.j2 to prepend the return value to the tuple),
not in this repo. Happy to open that as a separate pywrap PR if you'd rather solve it
generally.