Unable to convert...into curve geometry - possible bug

Hello all,

I’m trying to develop a script in Python that offsets a curve and joins a “wart” onto it. However I’m plagued by rhinoscriptsyntax being unable to recognize a curve as a curve. For example, in the below picture the trim command works on a curve, and then fails on the same curve on the very next line! Is there something I’m missing here about how to consistently give these functions good inputs?
python%20trouble

If it helps I’m attaching my script here - but be warned, I’m a beginner and it’s a work in progress. python trouble.gh (11.0 KB)

I realise this probably isn’t going to be immediately super helpful:

But this is a good example of why not to use rhinoscriptsyntax for geometry modelling in GHPython. One issue is that jumping back and forth between guids and RhinoCommon types is confusing and needlessly complex. Another (arguably larger) issue is that it becomes really difficult to debug, because errors aren’t super explicit to their function (this is a good example of this). I’d advice trying to implement your algorithm directly in RhinoCommon. You can look up the rhinoscriptsyntax source code to identify the methods you’re currently using:

I’d say @AndersDeleuran, sorry, rhinoscriptsyntax is fine for this. This is just a newby error.

The problem here is due to TrimCurve having the default of deleting inputs:
https://developer.rhino3d.com/api/RhinoScriptSyntax/#curve-TrimCurve
Therefore, line 44 deletes the curve. Then, line 45 does not find it.

To fix it, you can add a third input, False.

1 Like

Agree to disagree then :wink:

You are free to disagree about how you, an expert user, uses anything. But you don’t need to start this in every RhinoScript help request.

In this case, this was just an oversight on the function implementation and can happen with any library.

I don’t do that :roll_eyes: But in this case, it is IMO warranted (and useful information). Especially if one is a newcomer (i.e. one can avoid many headaches by going directly to RhinoCommon).

Edit: I’ve advised against using rhinoscriptsyntax five times (including this thread), out of a total 25 times I’ve mentioned rhinoscriptsyntax, out of 500+ topics dealing with rhinoscriptsyntax. So maybe cool it with the accusations.

Giulio,

Thank you! That is exactly the missing piece I was looking for. I had the default backwards in my head.

Anders,

Thanks for you input, and I’ll keep that in mind. I think at my level reading the source code is more of a computer science dive than my project warrants. To my understanding rhinoscriptsyntax works just like grasshopper - I trade some control and specificity for ease of use, which makes computational processes accessible to people without a CS background. That being said some day I’d like to learn what’s going on behind the curtain, so I’ll keep your technique in mind.

2 Likes