SubDEdgeChain

Since v8.36
public sealed class SubDEdgeChain : IDisposable
An ordered run of connected SubD edges.

Consecutive edges in a chain share a vertex, and each edge carries the direction it is traversed with, so the chain has a start and an end even when the individual edges do not agree on orientation. Chains are what commands like Bridge, Loft and edge sharpening operate on.

Remarks: A chain holds a reference to its SubD and does not keep it alive across edits that change the SubD topology; rebuild the chain after editing.

Constructors

SubDEdgeChain

#Since v8.36
public SubDEdgeChain(SubD subd, SubDEdge startEdge)
Creates a chain containing a single starting edge. Grow it with AddAllNeighbors(ChainDirection, SubDChainType) or AddOneNeighbor(ChainDirection, SubDChainType).
subd (SubD)The SubD the chain runs through.
startEdge (SubDEdge)The edge to start from.

SubDEdgeChain

#Since v8.36
public SubDEdgeChain(SubD subd)
Creates an empty chain in the given SubD.
subd (SubD)The SubD the chain will run through.

Finalizer

~SubDEdgeChain

#
~SubDEdgeChain()
Finalizer.

Properties

EdgeCount

#Since v8.36
[CLSCompliant(false)] public uint EdgeCount { get; }
The number of edges in this chain.

Edges

#Since v8.36
public SubDEdge[] Edges { get; }
The edges of this chain, in order.

IsClosedLoop

#Since v8.36
public bool IsClosedLoop { get; }
True when the chain closes back on itself.

ParentSubD

#Since v8.36
public SubD ParentSubD { get; }
The SubD this chain runs through.

Methods

AddAllNeighbors

#Since v8.36
[CLSCompliant(false)] public uint AddAllNeighbors(ChainDirection direction, SubDChainType chainType)
Extends the chain as far as it will go at one or both ends.
direction (ChainDirection)Which end or ends to extend.
chainType (SubDChainType)Which edges and vertices the chain is allowed through.
The number of edges that were added.

AddEdge

#Since v8.36
[CLSCompliant(false)] public uint AddEdge(SubDEdge edge)
Adds an edge to whichever end of the chain it connects to.
Remarks: This cannot start a chain: adding to an empty chain does nothing and returns 0. Use Begin(SubDEdge) or the SubDEdgeChain(SubD, SubDEdge) constructor for the first edge.
edge (SubDEdge)The edge to add.
The number of edges that were added, so 1 on success and 0 if the edge does not connect to either end, is already in the chain, or the chain is empty.

AddOneNeighbor

#Since v8.36
[CLSCompliant(false)] public uint AddOneNeighbor(ChainDirection direction, SubDChainType chainType)
Extends the chain by one edge at one or both ends.
direction (ChainDirection)Which end or ends to extend.
chainType (SubDChainType)Which edges and vertices the chain is allowed through.
The number of edges that were added.

Begin

#Since v8.36
[CLSCompliant(false)] public uint Begin(SubDEdge startEdge)
Clears the chain and restarts it from a single edge.
startEdge (SubDEdge)The edge to start from.
The number of edges in the chain, so 1 on success and 0 on failure.

Clear

#Since v8.36
public void Clear()
Removes every edge from the chain.

Dispose

#Since v8.36
public void Dispose()
Frees the unmanaged chain.

EdgeAt

#Since v8.36
public SubDEdge EdgeAt(int index)
Gets the edge at the given position in the chain. The returned edge carries the direction the chain traverses it with, in SubDComponent.ComponentDirection.
index (int)The position in the chain.
The edge, or null if index is out of range.

IsConvexLoop

#Since v8.36
public bool IsConvexLoop(bool strictlyConvex)
True when the chain is a closed loop that is convex.
strictlyConvex (bool)If true, a loop with three or more colinear points in a row is not convex.

Reverse

#Since v8.36
public void Reverse()
Reverses the direction of the chain.

SortEdgesIntoEdgeChains

#Since v8.36
public static SubDEdge[][] SortEdgesIntoEdgeChains(SubD subd, IEnumerable<SubDEdge> edges)
Sorts a set of edges into chains.
Remarks: This uses the mark bits on the edges and vertices involved, so it must not run on the same SubD from more than one thread at a time.
subd (SubD)The SubD the edges belong to.
edges (IEnumerable<SubDEdge>)The edges to sort. Where three or more of them meet at one vertex, no chain passes through that vertex.
One array of edges per chain, in chain order. Each returned edge carries the direction its chain traverses it with.

ToLoftCurve

#Since v8.36
public NurbsCurve ToLoftCurve()
Gets a NURBS curve suitable for lofting SubDs, following this chain.
The curve, or null if the chain is not valid.

ToNurbsCurve

#Since v8.36
public NurbsCurve ToNurbsCurve()
Gets a NURBS curve on the SubD surface following this chain.
The curve, or null if the chain is not valid.

TrimToRange

#Since v8.36
[CLSCompliant(false)] public uint TrimToRange(SubDEdge firstEdge, SubDEdge lastEdge)
Trims the chain down to the run of edges between firstEdge and lastEdge, removing everything before firstEdge and everything after lastEdge.
Remarks: This wraps ON_SubDEdgeChain::RemoveEdges, whose name reads as though the given range is what gets removed. It is the other way round: the range is what survives. Passing null for both edges therefore removes nothing and returns 0; use Clear() to empty the chain.
firstEdge (SubDEdge)The edge to keep as the new start of the chain. Pass null to keep the current start.
lastEdge (SubDEdge)The edge to keep as the new end of the chain. Pass null to keep the current end.
The number of edges that were removed.

VertexAt

#Since v8.36
public SubDVertex VertexAt(int index)
Gets the vertex at the given position along the chain. A chain of N edges has N+1 vertices, or N when it is a closed loop.
index (int)The position along the chain.
The vertex, or null if index is out of range.