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
Creates a chain containing a single starting edge. Grow it with AddAllNeighbors(ChainDirection, SubDChainType) or AddOneNeighbor(ChainDirection, SubDChainType).
public SubDEdgeChain(
subd,
The SubD the chain runs through.
startEdge
The edge to start from.
)

SubDEdgeChain

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

Finalizer

~SubDEdgeChain

#
Finalizer.
~SubDEdgeChain()

Properties

EdgeCount

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

Edges

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

IsClosedLoop

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

ParentSubD

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

Methods

AddAllNeighbors

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

AddEdge

#Since v8.36
Adds an edge to whichever end of the chain it connects to.
[CLSCompliant(false)] public uint AddEdge(
edge
The edge to add.
)
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.
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
Extends the chain by one edge at one or both ends.
[CLSCompliant(false)] public uint AddOneNeighbor(
direction,
Which end or ends to extend.
chainType
Which edges and vertices the chain is allowed through.
)
The number of edges that were added.

Begin

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

Clear

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

Dispose

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

EdgeAt

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

IsConvexLoop

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

Reverse

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

SortEdgesIntoEdgeChains

#Since v8.36
Sorts a set of edges into chains.
public static SubDEdge[][] SortEdgesIntoEdgeChains(
subd,
The SubD the edges belong to.
edges
The edges to sort. Where three or more of them meet at one vertex, no chain passes through that vertex.
)
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.
One array of edges per chain, in chain order. Each returned edge carries the direction its chain traverses it with.

ToLoftCurve

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

ToNurbsCurve

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

TrimToRange

#Since v8.36
Trims the chain down to the run of edges between firstEdge and lastEdge, removing everything before firstEdge and everything after lastEdge.
[CLSCompliant(false)] public uint TrimToRange(
firstEdge,
The edge to keep as the new start of the chain. Pass null to keep the current start.
lastEdge
The edge to keep as the new end of the chain. Pass null to keep the current end.
)
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.
The number of edges that were removed.

VertexAt

#Since v8.36
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.
public SubDVertex VertexAt(
index
The position along the chain.
)
The vertex, or null if index is out of range.