You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Solution to functions that tries modifying immutable arguments passed by reference #167
Have you found any solution for handling functions that return values via output parameters passed by reference, especially when those parameters are of immutable types?
This becomes a problem with important functions like BRep_Tool::CurveOnSurface. In such cases, the function modifies the arguments passed by reference (e.g., to return the first and last parameters of the Geom2d_Curve), but when these are immutable types in the binding language, we can’t retrieve the modified values.
This effectively blocks access to important return data.
The solution is to add workaround method in the binding manually or via rules. What is your use case (not CQ I presume) case and why is this function so important?
In some data science workflows involving BRep geometry, we need to work directly in the parametric (UV) domain of surfaces to perform calculations on faces. For instance, we often need to construct 2D edges and wires that represent the boundaries of a face in this parametric space.
To do this, it's essential to retrieve the associated pcurve and its parameter range. This also applies to vertices—sometimes we need to extract their (u, v) coordinates on a given surface to carry out specific operations.
Since this information is already available within the BRep data structures, it would be ideal to access it directly using functions like BRep_Tool::CurveOnSurface, rather than having to recompute or approximate it manually.
I don't think that is going to fly, it would not mesh well with how CQ is using OCP. I assume you are working on some closed-source project, so I think your best bet for now is to write a custom extension to OCP that wraps the needed functions.
Activity
adam-urbanczyk commentedon Apr 11, 2025
The solution is to add workaround method in the binding manually or via rules. What is your use case (not CQ I presume) case and why is this function so important?
GabrielJMS commentedon Apr 17, 2025
Hello @adam-urbanczyk , thank you for your quick response.
In some data science workflows involving BRep geometry, we need to work directly in the parametric (UV) domain of surfaces to perform calculations on faces. For instance, we often need to construct 2D edges and wires that represent the boundaries of a face in this parametric space.
To do this, it's essential to retrieve the associated pcurve and its parameter range. This also applies to vertices—sometimes we need to extract their (u, v) coordinates on a given surface to carry out specific operations.
Since this information is already available within the BRep data structures, it would be ideal to access it directly using functions like BRep_Tool::CurveOnSurface, rather than having to recompute or approximate it manually.
Thanks again for your support!
GabrielJMS commentedon Apr 22, 2025
Hello @adam-urbanczyk here is another example of method that doesn't work: https://dev.opencascade.org/doc/refman/html/class_geom2d_a_p_i___extrema_curve_curve.html#aa07f00ee012faf025712a32fcf3e8f92
GabrielJMS commentedon Aug 6, 2025
Hello @adam-urbanczyk Do you think would be possible to expose the
Standard_Realobject, so we could use something like this to solve this issue:Thank you for your attention
adam-urbanczyk commentedon Aug 19, 2025
I don't think that is going to fly, it would not mesh well with how CQ is using OCP. I assume you are working on some closed-source project, so I think your best bet for now is to write a custom extension to OCP that wraps the needed functions.