Why does Join behave differently with preselection and postselection?

The annotated log below shows creating a cube and exploding it into six surfaces.

With SelAll → Join, Rhino joins the surfaces into one closed solid.
With Join → SelAll, it first selects the surfaces, then discards them and fails.

My question isn’t about how to accomplish the operation, it’s about understanding Rhino’s selection philosophy. I figured out the distinction after a few minutes, but it wasn’t intuitive to me: preselection accepts a selection, while postselection rejects the same selection.

Is this a consistent pattern across Rhino commands? Am I setting my expectations incorrectly when I expect preselection and postselection to behave alike?

create a cube                Command: box
                             First corner of base ( Diagonal 3Point Vertical Center ): w0
                             Other corner of base or length ( 3Point ): w1,1
                             Height. Press Enter to use width ( BothSides=No ): w0,0,1
select it                    Command: sellast
                             1 extrusion added to selection.
                             Creating meshes... Press Esc to cancel
and explode it               Command: explode
we have now 6 surfaces       Exploded an extrusion into 6 surfaces.
                             Creating meshes... Press Esc to cancel
                             Command: selnone
select them all              Command: selall
                             6 surfaces added to selection.
run the join command         Command: join
                             Surface join in progress... Press Esc to cancel
and we have a solid          6 surfaces or polysurfaces joined into one closed polysurface.
                             Command: selnone
                             Creating meshes... Press Esc to cancel
                             Command: selall
this is the solid            1 polysurface added to selection.
go back to 6 surfaces        Command: explode
                             Exploded a polysurface into 6 surfaces.
                             Command: selnone
run the join command first   Command: join
then select all              Select object for join. Curves, surfaces, polysurfaces, and SubDs must be open ( JoinDisjointMeshes=No SubDJoinedEdges=Smooth SubDSymmetry=Preserve ): selall
                             6 surfaces added to selection.
fails to create the solid    Cannot use these objects. Removing them from selection.

Here is the macro used for this quick test:

;
;create a cube and explode it in 6 surfaces
;
box w0 w1,1 w0,0,1
sellast
explode
selnone
;
;join and select all -> it works
;
selall
join
selnone
selall
; -> 1 polysurface added to selection.
;
;join and select all -> it fails
;
explode
selnone
join
selall

It’s specific to how Join handles postselection, not a general Rhino rule.

When objects are preselected, Join takes them all and joins them at once. When you run Join first, the first prompt accepts exactly one object. That first pick sets the kind of join (curves, surfaces/polysurfaces, meshes or SubDs), and Join then asks you to pick more objects of that kind one at a time. Typing SelAll at that prompt returns 6 objects to a prompt that accepts only 1, so Rhino rejects the whole set. That’s the “Cannot use these objects” message.

Most commands that accept multiple objects behave the same either way. The difference comes from commands like Join, whose first postselect prompt accepts only one object. In a macro, select first: _SelAll _Join.

– Dale

@dale Is there a known explanation for this difference, or is it lost in the mists of time?

Thank you for the explanation. It makes sense now.

Understanding this distinction will also be useful as I become familiar with more Rhino commands, and especially as I create commands for my own plugins and try to reproduce a consistent Rhino-like user experience.

It would be interesting to know.

Here is my guess at the archaeology: perhaps originally “Join” only supported postselection, with the current behavior where the first single pick determines the type of objects accepted afterward.

Then preselection was added later. Since there is no “first pick” in a preselected set, it had to be made more permissive and determine what to do from the selection as a whole.

The original postselection behavior may then have been preserved for backward compatibility and to avoid regressions.

Pure speculation, of course.

Do I win a lollipop? :slightly_smiling_face:

That first pick sets the kind of join

This is the explanation.