Avoid multiselection dialog when picking closed seam edge?


#1

Hi all,

When using RhinoGet to pick a surface edge:

msg="Pick a surface seam edge"
filter=Rhino.DocObjects.ObjectType.EdgeFilter
rc, objref = Rhino.Input.RhinoGet.GetOneObject(msg,False,filter)

Is there any way to further limit the choice to closed seam edges (like the seam on a cylinder or pipe) and avoid the multi-selection box that comes up?

I see ChooseOneQuestion (=False?) but I don’t know if that’s the way and how I should use it…

Thx,
–Mitch


#2

I also tried the following, but still get the multi-selection box…

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

def TestGetSeamEdge():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select seam edge of tube")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.EdgeFilter
    se_filter=Rhino.Input.Custom.GeometryAttributeFilter.SeamEdge
    go.GeometryAttributeFilter = se_filter
    go.ChooseOneQuestion=False
    go.Get()
    if go.CommandResult() != Rhino.Commands.Result.Success:
        return go.CommandResult()
    objGeo = go.Object(0).Geometry()
    print objGeo
    
TestGetSeamEdge()

(Dale Fugier) #3

If a pick is ambiguous, then you will always see the “choose one object” dialog.

Also, by default, if a call to GetObject is permitted to select different parts of the same object, like a polysurface and an edge of that polysurface, then the top-most object is automatically selected. If you want the choose-one-object mechanism to include pop up in these cases, then call ChooseOneQuestion = true before calling GetObjects.


#4

OK, thanks Dale, but then how does for example the DupEdge command manage to not have the popup come up when picking on joined surface edges like a box edge (or a seam edge for that matter)…? It is that type of functionality I am looking for.

–Mitch


(Dale Fugier) #5

This is somewhat equivalent to DupEdge:

import Rhino
import scriptcontext

def TestDupEdge():
    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select edges to duplicate")
    go.GeometryFilter = Rhino.DocObjects.ObjectType.Curve
    go.GeometryAttributeFilter = Rhino.Input.Custom.GeometryAttributeFilter.EdgeCurve
    go.GetMultiple(1,0)
    if (go.CommandResult() == Rhino.Commands.Result.Success):
        for i in range(0, go.ObjectCount):
            ref = go.Object(i)
            edge = ref.Edge()
            crv = edge.DuplicateCurve()
            scriptcontext.doc.Objects.AddCurve(crv)

#6

OK,

Rhino.DocObjects.ObjectType.Curve

instead of

Rhino.DocObjects.ObjectType.EdgeFilter

Eliminates the popup, thanks!

However,

go.GeometryAttributeFilter=Rhino.Input.Custom.GeometryAttributeFilter.SeamEdge

doesn’t seem (seam) to be able to restrict it to seam edges at that point…

Oh, well… thanks anyway!

–Mitch


(Dale Fugier) #7

Seems to work here on a Brep cylinder.


#8

Hi Dale,

Yes, it lets me pick the seam edge but it also lets me pick just about any other joined edge as well on a Brep object… I assume those are “manifold” edges as opposed to “seam” edges, it is not restricting the pick to seam edges… This seems like a bug (or a “limitation”) to me…

Added: oh, and using Rhino.DocObjects.ObjectType.Curve also allows me to pick curves, which I don’t want.

Thanks,

–Mitch


#9

Hi Mitch

Try this:

filter= Rhino.DocObjects.ObjectType.Curve
    rc, objrefs = Rhino.Input.RhinoGet.GetOneObject("Seleziona Curva o Edge", False, filter)
    if rc!=Rhino.Commands.Result.Success: return 
    brep_edge=objrefs.Curve()    
    curva=brep_edge.DuplicateCurve()

Ciao Vittorio


(Dale Fugier) #10

go.SubObjectSelect = False;


#11

Has the opposite effect that I want, with that you can only select curves, not edges. If set True, can still select other edges besides seam edges…

–Mitch