mcneel / rhino3dm

Libraries based on OpenNURBS with a RhinoCommon style
MIT License
613 stars 139 forks source link

Inconsistant PolylineCurve.TryGetPolyline() method #610

Open xarthurx opened 6 months ago

xarthurx commented 6 months ago

For the python lib, when trying to convert from PolylineCurve to Polyline, the actual function usage is

ply = plyCrv.TryGetPolyline()

However, the linting and code are all TryGetPolyline(polyline: Polyline) which seems to be inherited from .NET method, but not working in Python. image image

fraguada commented 6 months ago

I can imagine that the stubs are very out of date. That being said, there does exist a Curve.TryGetPolyline(out Polyline polyline) method in dotnet. It returns a bool on whether the attempt was successful. In python, the result is the curve or None: https://github.com/mcneel/rhino3dm/blob/main/src/bindings/bnd_curve.cpp#L61

I will see about getting the stubs updated to reflect this.

xarthurx commented 6 months ago

I can imagine that the stubs are very out of date. That being said, there does exist a Curve.TryGetPolyline(out Polyline polyline) method in dotnet. It returns a bool on whether the attempt was successful. In python, the result is the curve or None: https://github.com/mcneel/rhino3dm/blob/main/src/bindings/bnd_curve.cpp#L61

I will see about getting the stubs updated to reflect this.

There is.

The polyline is obtained with 'out'. The way dotNet and python works very differently.

fraguada commented 6 months ago

Indeed, but the stubs are generated from the dotnet source, so we have to update the way they are generated to reflect these differences. Similar issues arise for the javascript library d.ts file. For now I have to essentially hand craft that one to keep it up to date and accurate.