How to find curves with points number?

Hi!
I have imported dxf drawings to Rhino. Many of curves are good ones but then there is also curves with many points. I think it is because of bending in sheet metal…

It will take a lot of time to pick each “bad” curve and then “Rebuild curve” . Is there any command to find/pick curves with point quantity I want. I mean like tool “select short curves” it shows me curves which are shorter like the length I enter.

For example, I would like to find all curves which has more/less like 5 points…

BR:Wagner

Pretty simple with a little Grasshopper.


ControlPointCountFinder.gh (12.8 KB)

Thanks!

Sorry but I use Rhino5 and I think they will not let me to update to R6.
They are trying to kick Rhino out of me, because they are Autodesk fans :smiley:
But I love Rhino!!!

BR: Wagner

Here’s a quickie script - should run OK in Rhino 5.

import rhinoscriptsyntax as rs

def SelCrvsCpCount():
    crvIDs=rs.ObjectsByType(4,state=1)
    if crvIDs:
        msg="Minimum number of points to select curve?"
        user_count=rs.GetInteger(msg,5,2)
        if user_count is None: return
        rs.EnableRedraw(False)
        rs.UnselectAllObjects()
        for crvID in crvIDs:
            crv_pt_count=rs.CurvePointCount(crvID)
            if crv_pt_count >= user_count:
                rs.SelectObject(crvID)
SelCrvsCpCount()
1 Like

Wow, great help!

Sorry, but how to use it?
Used only “RunPythonScripts” earlier…
I used “EditScript” and pasted your text there and saved (rvb) but it does not work…
error
it says: End of the sentence needed.

BR: Wagner

HI,
Try _EditPythonScript :slight_smile:

Hi!
Thank You everybody! Saves a lot of our time…
Great to see faces, they said it will take half an hour to fix all bad ones.
Rhino makes it in 10 seconds :smiley:

What a great day…

BR: Wagner

Sorry but I use Rhino5 and I think they will not let me to update to R6.

You know Grasshopper is available for Rhino 5 right? The example I sent you is for Rhino 5.
https://www.rhino3d.com/download/grasshopper/1.0/wip/rc