Adding a dialog to an existing command (e.g. RemapCplane)

Is there any way to modify existing Rhino commands to add a graphical prompt, a dialog to them (like in SelLayer command) that would prompt you to select named items in Rhino document. My use case is to modify the RemapCplane command as most of my Cplanes have very long names (or contain spaces), so to make it more convenient to select them.

Unless there is any other workaround already (e.g. adding autocompletion for such items in the command prompt)?

Hi Daniel - see if double-cliking on one in NamedCPlanes gets you anything.

-Pascal

Thanks, that works too, but I hoped that it might be possible to do it from the keyboard.

Hi Daniel - what would a dialog show you to speed things up?

-Pascal

For example, I am getting stuck at step 4:

  1. image

  2. image

  3. image

  4. image

it seems like typing a full name of a Cplane works, but these can get lengthy on larger projects (e.g. 83475-Section-B-2). It would be helpful if a graphical dialog (or some autocompletion) could appear then.

But, sorry, if I am being dense - then would you pick in there from a list? I understood you do not want to use the mouse.

I do get autocomplete…

-Pascal

Oh sorry, in ChangeLayer command for example the dialog is so that you can type the first few letters of the name to select it or navigate to it with arrow keys - effectively hands can stay on the keyboard.

I’ve checked that there is no ChangeCplane command in rhinoscriptsyntax, but perhaps there may be some more general way of creating this type of dialogs? Maybe something in Eto?

image

Ideally autocompletion of course.

I see, so autocomplete is the goal in any case - got it. That makes sense.
@Daniel_Krajnik , chatting with the developer, it seems most likely, given how Rhino works internally, that this would take the form of a “List” command line option when Rhino is asking for the plane name which would then pop up a searchable list box that could be made to follow ytour typing. A full on autocomplete at the command line for the names is a much bigger deal and is not likely to happen in the V8 time frame though having something like that that could be used sort of ‘generically’ here and there in Rhino wiould be a nice thing.

RH-71011 Named CPlanes: Autocomplete

-Pascal

1 Like

Dear @Daniel_Krajnik
workarround - rough concept:

you can query the named cplanes by rhinoscript or phyton

import rhinoscriptsyntax as rs
cplanes = rs.NamedCPlanes()

with cplanes you can build some simple GUI to select the target cplane.
build a commandString with the target cplane and the remapcplane command
don t forget to double quote the cplane name (because of spaces)
then script the _remapcplane command

python
Command(commandString, echo=True)

… a bit of bricolage but should do the job…

1 Like

Thanks, you are right that the “List” option makes sense here. I think that it would be good to have it also in:

  • RemapCplane... (as shown above)
  • -NamedView Restore
  • -Snapshots Restore
  • -SelGroup or -NamedSelections Select
  • -NamedPosition Restore
  • -Properties (for named objects)

Looking forward to autocompletion at the command line some day, as well :slight_smile:

this link seems to 404 ?

Thanks, I’d love to try that, but I’m not quite sure how to

is there an example that you could point me to, so I could see how to feed the output of the rs.NamedCPlanes() call into a rs.GetLayers()-like list to select a target CPlane?

Fixed…

@Daniel_Krajnik see if this gets you there -

import rhinoscriptsyntax as rs
import scriptcontext as sc


def test():
    
    
    planes = sc.doc.NamedConstructionPlanes
    if planes.Count > 0:
        planeNames = [plane.Name for plane in planes]

        x = rs.ListBox(planeNames)
    
        if x is not None:
            rs.Command("RemapCPlane Pause CPlane " + chr(34) + x + chr(34) + " Enter")
   
test()

-Pascal

1 Like

amazing, thank you! I think that’s really powerful.