Select subcurve in a curve

Hello,

I need to select subcurve within a curve with python

the curve from which I need to select a subcurve is consisted of several segments, so it has subcurves

from help files I created a script:

    object = rs.GetObject("Pick a curve",filter=4,subobjects=True)
    print object.GeometryComponentIndex.Index

it works ok for solid, it returns different index for edges, but for closed curve it always returns -1

further I use the following to get and create subcurve, but it works only with solid edges

    curve = object.Curve()
    sc.doc.Objects.AddCurve(curve)

Thanks in advance
Aleksandar

Hi @AleksandarSM,

Sub-objects, as it relates to curve picking, is about picking edge curves of a Brep, not sub-segments of a curve.

To pick subsegments of a curve, hold CtrlShift while clicking.

Does this help?

– Dale

Hello Dale,

Your explanation solves the “mystery” why one case is working and other is not in my tests…

but using the keyboard as selection modifier is not what I had in mind. ( I have read that in forum already somewhere )

Idea was to click and select the subcurve directly.

I have managed to make a “workaround” in the meanwhile:

I used python GetCurveObject to receive both curve and the selection point, then I exploded the copy of the curve and found which curve segment is the closest to the selection point…

it works as intended but there is no subcurve highlighting while making a selection…

I’m now in process of ‘translating’ the procedure into python rhinocommon so I can deal with the curve geometry and not with curve objects

I’m curious if there is some other, more user friendly “workaround” that would include also subcurve highlighting while picking?

BR
Aleksandar

Hi @AleksandarSM,

You could do something like the ExtractSubCrv command, which draws the subcurve closest to the cursor in a highlight color, in a display conduit.

– Dale

Thanks Dale,

Conduits are something I did not try yet. but obviously powerful “concept”.
I have read some other topics here regarding conduits, -a lot of possible applications. I will look into it as soon as I get some free time…

BR
Aleksandar