Joining

public static class Joining

Methods

JoinSurfaces

#
public static object[] JoinSurfaces(object[] surfaces, bool retainCreases, bool joinSubdsToBrepsIfPossible, double tolerance, out int[] mapping, List<Message> messages = null)
Join surface-like objects into as few outputs as possible. Each input is resolved in the following order, most-specific first:
  1. Sphere, Box — closed primitives, always pass through unchanged. Already-solid inputs are never broken apart or re-joined.
  2. Tube, Triangle — GH2 shape types, joinable.
  3. SubD — joined among themselves via SubD.JoinSubDs, remain SubDs.
  4. Surface, Brep — RhinoCommon base types, joinable.
  5. SurfaceBroker.CastOrConvert — catch-all for any other registered surface type. The broker may yield a Surface, Brep, or SubD which is then bucketed accordingly.
Joinable types (Tube, Triangle, Surface, Brep, and broker results) are temporarily converted to Brep so that Brep.JoinBreps can find shared edges. Inputs that did not actually join with anything are restored to their original type, so a lone Tube stays a Tube, not a Brep. Only manifold joins are produced. If three surfaces meet at the same edge, only two will join along that edge; the third stays separate. The function never produces disjoint Breps (multiple disconnected shells in one Brep) or non-manifold geometry. Each output represents a single connected component. Output order follows the position of the earliest input in each group.
surfaces (object[])The surface-like objects to join. May contain any mix of Box, Sphere, SubD, Surface, Brep, Tube, Triangle, or any type with a registered SurfaceBroker assistant.
retainCreases (bool)If true, joined subds will retain sharp creases along their joins and joined surfaces retain edges between them.
joinSubdsToBrepsIfPossible (bool)When false, SubDs and Breps live in entirely separate worlds and a SubD will never end up in the same output as a Brep. When true, after the two separate join passes a third pass converts the joined SubD results to Breps and tries to merge them with the Brep results. SubDs that successfully merge become part of a Brep output; those that don't remain SubDs.
tolerance (double)3D distance tolerance for detecting shared edges.
mapping (out int[])One entry per input. mapping[i] is the index into the returned array where input i ended up. Inputs that joined together share the same mapping value. This can be used to transfer metadata from inputs to the appropriate outputs.
messages (List<Message> = null)Optional list to receive warnings when an input cannot be converted or is not a recognised surface type.
The joined outputs, one per connected component. Each element is either the original object (for pass-throughs and un-joined inputs) or a new Brep/SubD representing the joined result.