Document — XCAF & API Completions
This page covers every public member declared from line 15061 to the end of Sources/OCCTSwift/Document.swift — a collection of extension completions added across versions 0.122.0–0.130.0, spanning WireFixer, ShapeFix_Edge, BRepTools/BRepLib statics, shape history, sewing, builder extensions, section operations, curve/surface queries, XCAF color/shape-tool completions, fillet/chamfer history queries, a standalone SectionBuilder, and the GeomEval/Geom2dEval analytical evaluators. See the main Document page for core load/save and assembly operations.
Topics
- WireFixer Extended · ShapeFix_Edge Statics · BRepTools Statics · BRepLib Extended Statics · Shape.History Extended · SewingBuilder Extended · ThruSectionsBuilder Extensions · CellsBuilder Extensions · PipeShellStatus · PipeShellBuilder Extensions · UnifySameDomainBuilder · Section Ops on Shape · Curve3D Extended Queries · Additional Shape Queries · XCAFDoc_ColorTool Completions on Document · XCAFDoc_ShapeTool Completions on Document · ColorTool Completions v0.127.0 · FilletBuilder History Queries · ChamferBuilder History & Extras · SectionBuilder · GeomEval Standalone Evaluators · Geom2dEval Standalone Evaluators
WireFixer Extended
Extensions on WireFixer added in v0.122.0.
WireFixer.fixGaps2d()
Fix 2D parametric gaps between edges on the wire.
@discardableResult public func fixGaps2d() -> Bool
- Returns:
trueif any gaps were fixed. - OCCT:
ShapeFix_Wire::FixGaps2d. - Example:
let fixer = WireFixer(wire: someWire, face: someFace, precision: 1e-6) fixer.fixGaps2d()
WireFixer.fixSeam(edgeIndex:)
Fix the seam edge at the given 1-based index within the wire.
@discardableResult public func fixSeam(edgeIndex: Int) -> Bool
- Parameters:
edgeIndex— 1-based index of the seam edge in the wire. - Returns:
trueif the seam was fixed. - OCCT:
ShapeFix_Wire::FixSeam. - Example:
fixer.fixSeam(edgeIndex: 1)
WireFixer.fixShifted()
Fix edges whose pcurves are shifted by a period.
@discardableResult public func fixShifted() -> Bool
- Returns:
trueif any edges were corrected. - OCCT:
ShapeFix_Wire::FixShifted. - Example:
fixer.fixShifted()
WireFixer.fixNotchedEdges()
Fix notched (overhanging) edges in the wire.
@discardableResult public func fixNotchedEdges() -> Bool
- Returns:
trueif notches were removed. - OCCT:
ShapeFix_Wire::FixNotchedEdges. - Example:
fixer.fixNotchedEdges()
WireFixer.fixTails()
Remove tail edges (degenerate end edges) from the wire.
@discardableResult public func fixTails() -> Bool
- Returns:
trueif tails were removed. - OCCT:
ShapeFix_Wire::FixTails. - Example:
fixer.fixTails()
WireFixer.setMaxTailAngle(_:)
Set the angular threshold (radians) below which an edge is considered a tail.
public func setMaxTailAngle(_ angle: Double)
- Parameters:
angle— maximum angle in radians. - OCCT:
ShapeFix_Wire::SetMaxTailAngle. - Example:
fixer.setMaxTailAngle(0.01)
WireFixer.setMaxTailWidth(_:)
Set the width threshold below which an edge is considered a tail.
public func setMaxTailWidth(_ width: Double)
- Parameters:
width— maximum width. - OCCT:
ShapeFix_Wire::SetMaxTailWidth. - Example:
fixer.setMaxTailWidth(1e-4)
ShapeFix_Edge Statics
Static helpers on Shape wrapping ShapeFix_Edge, added in v0.122.0.
Shape.fixEdgeAddCurve3d(_:)
Add a missing 3D curve to an edge.
public static func fixEdgeAddCurve3d(_ edge: Shape) -> Bool
- Parameters:
edge— an edge shape missing its 3D curve. - Returns:
trueif the 3D curve was successfully added. - OCCT:
ShapeFix_Edge::AddCurve3d. - Example:
if Shape.fixEdgeAddCurve3d(myEdge) { print("3D curve added") }
Shape.fixEdgeAddPCurve(_:face:isSeam:)
Add a missing PCurve (2D parametric curve) to an edge on a face.
public static func fixEdgeAddPCurve(_ edge: Shape, face: Shape, isSeam: Bool = false) -> Bool
- Parameters:
edge— the edge;face— the face to add the PCurve on;isSeam— whether the edge is a seam. - Returns:
trueif the PCurve was added. - OCCT:
ShapeFix_Edge::AddPCurve. - Example:
Shape.fixEdgeAddPCurve(edge, face: face, isSeam: false)
Shape.fixEdgeRemoveCurve3d(_:)
Remove the 3D curve from an edge.
public static func fixEdgeRemoveCurve3d(_ edge: Shape) -> Bool
- Parameters:
edge— edge whose 3D curve should be removed. - Returns:
trueon success. - OCCT:
ShapeFix_Edge::RemoveCurve3d. - Example:
Shape.fixEdgeRemoveCurve3d(myEdge)
Shape.fixEdgeRemovePCurve(_:face:)
Remove the PCurve from an edge on a face.
public static func fixEdgeRemovePCurve(_ edge: Shape, face: Shape) -> Bool
- Parameters:
edge— the edge;face— the face carrying the PCurve to remove. - Returns:
trueon success. - OCCT:
ShapeFix_Edge::RemovePCurve. - Example:
Shape.fixEdgeRemovePCurve(edge, face: face)
Shape.fixEdgeReversed2d(_:face:)
Fix a reversed 2D parametric curve on an edge/face pair.
public static func fixEdgeReversed2d(_ edge: Shape, face: Shape) -> Bool
- Parameters:
edge— the edge with the reversed PCurve;face— the owning face. - Returns:
trueif the reversal was fixed. - OCCT:
ShapeFix_Edge::FixReversed2d. - Example:
Shape.fixEdgeReversed2d(edge, face: face)
BRepTools Statics
Extensions on Shape wrapping BRepTools utilities, added in v0.122.0.
Shape.cleanTriangulation()
Remove all triangulation data from this shape (BRepTools::Clean).
public func cleanTriangulation()
- OCCT:
BRepTools::Clean. - Example:
shape.cleanTriangulation()
Shape.removeInternals()
Remove internal edges and vertices from this shape (BRepTools::RemoveInternals).
public func removeInternals()
- OCCT:
BRepTools::RemoveInternals. - Example:
shape.removeInternals()
Shape.detectClosedness()
Detect whether a face is closed in U and/or V.
public func detectClosedness() -> (isClosedU: Bool, isClosedV: Bool)
- Returns: A tuple
(isClosedU, isClosedV)—truewhere the face wraps around. - OCCT:
BRepTools::DetectClosedness. - Example:
let closed = face.detectClosedness() if closed.isClosedU { print("closed in U") }
Shape.evalAndUpdateTolerance(edge:face:)
Evaluate and update the tolerance of an edge on a face. Returns the new tolerance.
public static func evalAndUpdateTolerance(edge: Shape, face: Shape) -> Double
- Parameters:
edge— the edge;face— the face it lies on. - Returns: The updated tolerance value.
- OCCT:
BRepTools::EvalAndUpdateTol. - Example:
let tol = Shape.evalAndUpdateTolerance(edge: myEdge, face: myFace)
Shape.map3DEdgeCount
Count of distinct 3D edges in this shape.
public var map3DEdgeCount: Int
- OCCT:
BRepTools::Map3DEdges→ count. - Example:
print(shape.map3DEdgeCount)
Shape.updateFaceUVPoints()
Update the UV poles/points of all faces in this shape.
public func updateFaceUVPoints()
- OCCT:
BRepTools::UpdateFaceUVPoints. - Example:
shape.updateFaceUVPoints()
Shape.compareVertices(_:_:)
Compare two vertex shapes for geometric equality.
public static func compareVertices(_ v1: Shape, _ v2: Shape) -> Bool
- Returns:
trueif the vertices are geometrically equal. - OCCT:
BRepTools::Compare(vertex overload). - Example:
if Shape.compareVertices(v1, v2) { print("same vertex") }
Shape.compareEdges(_:_:)
Compare two edge shapes for geometric equality.
public static func compareEdges(_ e1: Shape, _ e2: Shape) -> Bool
- Returns:
trueif the edges are geometrically equal. - OCCT:
BRepTools::Compare(edge overload). - Example:
if Shape.compareEdges(e1, e2) { print("same edge") }
Shape.isReallyClosed(edge:face:)
Check whether an edge is truly closed on a face (seam check beyond topology flags).
public static func isReallyClosed(edge: Shape, face: Shape) -> Bool
- Returns:
trueif the edge is a genuine seam on the face. - OCCT:
BRepTools::IsReallyClosed. - Example:
if Shape.isReallyClosed(edge: e, face: f) { print("seam") }
Shape.updateTopology()
Update the internal topology state of this shape (BRepTools::Update).
public func updateTopology()
- OCCT:
BRepTools::Update. - Example:
shape.updateTopology()
BRepLib Extended Statics
Extensions on Shape wrapping BRepLib, added in v0.122.0.
Shape.ensureNormalConsistency(maxAngle:)
Ensure normal consistency of a triangulated shape, optionally clamping to maxAngle.
@discardableResult
public func ensureNormalConsistency(maxAngle: Double = 0.001) -> Bool
- Parameters:
maxAngle— maximum deviation angle in radians; defaults to 0.001. - Returns:
trueif normals were corrected. - OCCT:
BRepLib::EnsureNormalConsistency. - Example:
shape.ensureNormalConsistency()
Shape.updateDeflection()
Update the deflection information stored on this shape.
public func updateDeflection()
- OCCT:
BRepLib::UpdateDeflection. - Example:
shape.updateDeflection()
Shape.continuityOfFaces(edge:face1:face2:tolerance:)
Get the geometric continuity of the surface across an edge shared by two faces.
public static func continuityOfFaces(edge: Shape, face1: Shape, face2: Shape,
tolerance: Double = 1e-6) -> Int
- Parameters:
edge— the shared edge;face1,face2— the two faces;tolerance— comparison tolerance. - Returns:
GeomAbs_Shapeinteger: 0=C0, 1=G1, 2=C1, 3=G2, 4=C2, 5=CN, -1=error. - OCCT:
BRepLib::ContinuityOfFaces. - Example:
let c = Shape.continuityOfFaces(edge: e, face1: f1, face2: f2) // c == 2 means C1 continuity
Shape.buildCurves3dAll(tolerance:)
Build 3D curves for all edges in the shape.
@discardableResult
public func buildCurves3dAll(tolerance: Double = 1e-5) -> Bool
- Parameters:
tolerance— the desired tolerance for curve construction. - Returns:
trueif all curves were built successfully. - OCCT:
BRepLib::BuildCurves3d(shape overload). - Example:
shape.buildCurves3dAll()
Shape.sameParameterAll(tolerance:forced:)
Apply same-parameter correction to all edges in the shape.
public func sameParameterAll(tolerance: Double = 1e-5, forced: Bool = false)
- Parameters:
tolerance— target tolerance;forced— iftrue, forces reparametrization even when already same-parameter. - OCCT:
BRepLib::SameParameter(shape overload). - Example:
shape.sameParameterAll(tolerance: 1e-7, forced: true)
Shape.History Extended
Extensions on Shape.History added in v0.122.0.
Shape.History.merge(_:)
Merge another history into this one, combining all modified and generated mappings.
public func merge(_ other: Shape.History)
- Parameters:
other— the history to absorb. - OCCT:
BRepTools_History::Merge. - Example:
let combined = Shape.History() combined.merge(history1) combined.merge(history2)
Shape.History.replaceGenerated(initial:generated:)
Replace an existing generated-shape entry.
public func replaceGenerated(initial: Shape, generated: Shape)
- Parameters:
initial— the original shape;generated— the replacement generated shape. - OCCT:
BRepTools_History::ReplaceGenerated. - Example:
history.replaceGenerated(initial: oldEdge, generated: newFace)
Shape.History.replaceModified(initial:modified:)
Replace an existing modified-shape entry.
public func replaceModified(initial: Shape, modified: Shape)
- Parameters:
initial— the original shape;modified— the replacement modified shape. - OCCT:
BRepTools_History::ReplaceModified. - Example:
history.replaceModified(initial: oldFace, modified: newFace)
Shape.History.modifiedShapes(of:)
Get all shapes that the given initial shape was modified into.
public func modifiedShapes(of initial: Shape) -> [Shape]
- Parameters:
initial— the input shape to query. - Returns: Array of modified shapes (up to 64 results).
- OCCT:
BRepTools_History::Modified. - Example:
let mods = history.modifiedShapes(of: originalFace)
Shape.History.generatedShapes(of:)
Get all shapes generated from the given initial shape.
public func generatedShapes(of initial: Shape) -> [Shape]
- Parameters:
initial— the input shape to query. - Returns: Array of generated shapes (up to 64 results).
- OCCT:
BRepTools_History::Generated. - Example:
let gen = history.generatedShapes(of: originalEdge)
SewingBuilder Extended
Extensions on SewingBuilder added in v0.122.0.
SewingBuilder.nbDeletedFaces
Number of faces deleted during sewing.
public var nbDeletedFaces: Int
- OCCT:
BRepBuilderAPI_Sewing::NbDeletedFaces. - Example:
print(sewer.nbDeletedFaces)
SewingBuilder.deletedFace(at:)
Get a deleted face by 1-based index.
public func deletedFace(at index: Int) -> Shape?
- Parameters:
index— 1-based index. - Returns: The deleted face shape, or
nilif the index is out of range. - OCCT:
BRepBuilderAPI_Sewing::DeletedFace. - Example:
for i in 1...sewer.nbDeletedFaces { if let df = sewer.deletedFace(at: i) { print(df.typeName ?? "") } }
SewingBuilder.isModified(_:)
Check if a sub-shape was modified by the sewing operation.
public func isModified(_ shape: Shape) -> Bool
- Parameters:
shape— the sub-shape to query. - Returns:
trueif the shape was changed. - OCCT:
BRepBuilderAPI_Sewing::IsModified. - Example:
if sewer.isModified(myFace) { print("face was merged") }
SewingBuilder.modified(_:)
Get the sewed version of a shape.
public func modified(_ shape: Shape) -> Shape?
- Parameters:
shape— the original sub-shape. - Returns: The sewed replacement, or
nilif unmodified. - OCCT:
BRepBuilderAPI_Sewing::Modified. - Example:
if let sewn = sewer.modified(origFace) { ... }
SewingBuilder.isDegenerated(_:)
Check if a shape is degenerated after sewing.
public func isDegenerated(_ shape: Shape) -> Bool
- Returns:
trueif the shape collapsed to a degenerate form. - OCCT:
BRepBuilderAPI_Sewing::IsDegenerated. - Example:
if sewer.isDegenerated(edge) { print("degenerate") }
SewingBuilder.isSectionBound(_:)
Check if an edge is a section boundary after sewing.
public func isSectionBound(_ edge: Shape) -> Bool
- Returns:
trueif the edge is a boundary of a sewed section. - OCCT:
BRepBuilderAPI_Sewing::IsSectionBound. - Example:
sewer.isSectionBound(edge)
SewingBuilder.whichFace(_:)
Get the face that contains the given edge after sewing.
public func whichFace(_ edge: Shape) -> Shape?
- Parameters:
edge— an edge in the sewed result. - Returns: The enclosing face, or
nil. - OCCT:
BRepBuilderAPI_Sewing::WhichFace. - Example:
if let f = sewer.whichFace(edge) { print("edge belongs to face") }
SewingBuilder.load(_:)
Load a base shape as additional context for sewing (multi-part scenarios).
public func load(_ shape: Shape)
- Parameters:
shape— the shape to load as base context. - OCCT:
BRepBuilderAPI_Sewing::Load. - Example:
sewer.load(baseShape)
SewingBuilder.setNonManifoldMode(_:)
Enable or disable non-manifold sewing mode.
public func setNonManifoldMode(_ enabled: Bool)
- Parameters:
enabled—trueto allow non-manifold results. - OCCT:
BRepBuilderAPI_Sewing::SetNonManifoldMode. - Example:
sewer.setNonManifoldMode(true)
SewingBuilder.setFaceMode(_:)
Enable or disable face analysis mode.
public func setFaceMode(_ enabled: Bool)
- Parameters:
enabled—trueto analyse free faces. - OCCT:
BRepBuilderAPI_Sewing::SetFaceMode. - Example:
sewer.setFaceMode(true)
SewingBuilder.setFloatingEdgesMode(_:)
Enable or disable floating-edges mode.
public func setFloatingEdgesMode(_ enabled: Bool)
- Parameters:
enabled—trueto include floating edges in the result. - OCCT:
BRepBuilderAPI_Sewing::SetFloatingEdgesMode. - Example:
sewer.setFloatingEdgesMode(false)
SewingBuilder.setMinTolerance(_:)
Set the minimum tolerance for sewing.
public func setMinTolerance(_ tolerance: Double)
- Parameters:
tolerance— minimum sewing tolerance. - OCCT:
BRepBuilderAPI_Sewing::SetMinTolerance. - Example:
sewer.setMinTolerance(1e-7)
SewingBuilder.setMaxTolerance(_:)
Set the maximum tolerance for sewing.
public func setMaxTolerance(_ tolerance: Double)
- Parameters:
tolerance— maximum sewing tolerance. - OCCT:
BRepBuilderAPI_Sewing::SetMaxTolerance. - Example:
sewer.setMaxTolerance(0.1)
ThruSectionsBuilder Extensions
Extensions on ThruSectionsBuilder added in v0.123.0.
ThruSectionsBuilder.checkCompatibility(_:)
Enable or disable wire compatibility checking (reorders wires to avoid twists between sections).
public func checkCompatibility(_ check: Bool = true)
- Parameters:
check—trueto enable compatibility checking (default). - OCCT:
BRepOffsetAPI_ThruSections::CheckCompatibility. - Example:
let loft = ThruSectionsBuilder(isSolid: true) loft.checkCompatibility(true)
ThruSectionsBuilder.setParType(_:)
Set the parameterization type for the loft approximation.
public func setParType(_ type: Int)
- Parameters:
type— 0 = ChordLength, 1 = Centripetal, 2 = IsoParametric. - OCCT:
BRepOffsetAPI_ThruSections::SetParType. - Example:
loft.setParType(1) // centripetal
ThruSectionsBuilder.setCriteriumWeight(w1:w2:w3:)
Set the approximation criterion weights for the loft.
public func setCriteriumWeight(w1: Double, w2: Double, w3: Double)
- Parameters:
w1,w2,w3— weights for the three approximation criteria. - OCCT:
BRepOffsetAPI_ThruSections::SetCriteriumWeight. - Example:
loft.setCriteriumWeight(w1: 1.0, w2: 0.5, w3: 0.5)
ThruSectionsBuilder.generatedFace(from:)
Get the face generated from a profile edge after the loft is built.
public func generatedFace(from edge: Shape) -> Shape?
- Parameters:
edge— a profile edge from one of the input wires. - Returns: The generated face shape, or
nilif not found. - OCCT:
BRepOffsetAPI_ThruSections::GeneratedFace. - Example:
if let loftFace = loft.generatedFace(from: profileEdge) { ... }
CellsBuilder Extensions
Extensions on CellsBuilder added in v0.123.0.
CellsBuilder.addToResult(take:avoid:material:update:)
Add cells to the result: cells present in all take shapes but absent from all avoid shapes.
public func addToResult(take: [Shape], avoid: [Shape] = [], material: Int32 = 0, update: Bool = false)
- Parameters:
take— shapes whose cells to include;avoid— shapes whose cells to exclude;material— material tag;update— rebuild result immediately. - OCCT:
BOPAlgo_CellsBuilder::AddToResult. - Example:
cells.addToResult(take: [shapeA], avoid: [shapeB])
CellsBuilder.removeFromResult(take:avoid:)
Remove cells from the result: cells present in all take shapes but absent from all avoid shapes.
public func removeFromResult(take: [Shape], avoid: [Shape] = [])
- Parameters:
take— shapes identifying cells to remove;avoid— shapes to exclude from removal. - OCCT:
BOPAlgo_CellsBuilder::RemoveFromResult. - Example:
cells.removeFromResult(take: [shapeC])
CellsBuilder.allParts()
Get all split parts before any result composition.
public func allParts() -> Shape?
- Returns: A compound of all split cells, or
nilon failure. - OCCT:
BOPAlgo_CellsBuilder::GetAllParts. - Example:
if let parts = cells.allParts() { print(parts.nbFaces) }
CellsBuilder.makeContainers()
Convert accumulated parts into proper topology containers (wires from edges, shells from faces, etc.).
public func makeContainers()
- OCCT:
BOPAlgo_CellsBuilder::MakeContainers. - Example:
cells.makeContainers()
PipeShellStatus
Status code returned by PipeShellBuilder.status after a build attempt.
public enum PipeShellStatus: Int32, Sendable {
case ok = 0
case notOk = 1
case planeNotIntersectGuide = 2
case impossibleContact = 3
}
PipeShellBuilder Extensions
Extensions on PipeShellBuilder added in v0.123.0.
PipeShellBuilder.status
The current build status of the pipe shell.
public var status: PipeShellStatus
- Returns: A
PipeShellStatusvalue. - OCCT:
BRepOffsetAPI_MakePipeShell::GetStatus. - Example:
if pipe.status == .ok { print("success") }
PipeShellBuilder.simulate(numberOfSections:)
Simulate the pipe shell, generating intermediate cross-section wire shapes along the spine.
public func simulate(numberOfSections: Int) -> [Shape]
- Parameters:
numberOfSections— number of cross-section samples to generate. - Returns: An array of wire-shaped cross-sections along the spine; empty on failure.
- OCCT:
BRepOffsetAPI_MakePipeShell::Simulate. - Example:
let sections = pipe.simulate(numberOfSections: 10)
UnifySameDomain Builder
A builder that merges co-planar or co-cylindrical adjacent faces/edges in a shape.
UnifySameDomainBuilder.init(shape:unifyEdges:unifyFaces:concatBSplines:)
Create a UnifySameDomainBuilder for the given shape.
public init(shape: Shape, unifyEdges: Bool = true, unifyFaces: Bool = true, concatBSplines: Bool = false)
- Parameters:
shape— the input shape;unifyEdges— merge same-domain edges;unifyFaces— merge same-domain faces;concatBSplines— concatenate adjacent BSplines. - OCCT:
ShapeUpgrade_UnifySameDomain. - Example:
let unifier = UnifySameDomainBuilder(shape: myShape) unifier.build() if let result = unifier.shape { ... }
UnifySameDomainBuilder.allowInternalEdges(_:)
Allow or disallow internal edges in the unified result.
public func allowInternalEdges(_ allow: Bool)
- Parameters:
allow—trueto keep internal edges. - OCCT:
ShapeUpgrade_UnifySameDomain::AllowInternalEdges. - Example:
unifier.allowInternalEdges(false)
UnifySameDomainBuilder.keepShape(_:)
Prevent a specific sub-shape from being unified.
public func keepShape(_ shape: Shape)
- Parameters:
shape— the sub-shape to preserve unchanged. - OCCT:
ShapeUpgrade_UnifySameDomain::KeepShape. - Example:
unifier.keepShape(importantEdge)
UnifySameDomainBuilder.setSafeInputMode(_:)
Enable safe-input mode (copies the input shape before modification, preserving the original).
public func setSafeInputMode(_ safe: Bool)
- Parameters:
safe—trueto copy the input shape. - OCCT:
ShapeUpgrade_UnifySameDomain::SetSafeInputMode. - Example:
unifier.setSafeInputMode(true)
UnifySameDomainBuilder.setLinearTolerance(_:)
Set the linear tolerance for unification.
public func setLinearTolerance(_ tol: Double)
- Parameters:
tol— linear tolerance. - OCCT:
ShapeUpgrade_UnifySameDomain::SetLinearTolerance. - Example:
unifier.setLinearTolerance(1e-5)
UnifySameDomainBuilder.setAngularTolerance(_:)
Set the angular tolerance for unification.
public func setAngularTolerance(_ tol: Double)
- Parameters:
tol— angular tolerance in radians. - OCCT:
ShapeUpgrade_UnifySameDomain::SetAngularTolerance. - Example:
unifier.setAngularTolerance(1e-4)
UnifySameDomainBuilder.build()
Perform the unification (must call before accessing shape).
public func build()
- OCCT:
ShapeUpgrade_UnifySameDomain::Build. - Example:
unifier.build()
UnifySameDomainBuilder.shape
The unified result shape after build().
public var shape: Shape?
- Returns: The unified shape, or
nilif the build has not been called or failed. - OCCT:
ShapeUpgrade_UnifySameDomain::Shape. - Example:
unifier.build() if let result = unifier.shape { print(result.isValid) }
Section Ops on Shape
Static helpers on Shape for BRepAlgoAPI_Section, added in v0.123.0.
Shape.sectionWithOptions(_:_:approximation:computePCurve1:computePCurve2:)
Compute the section (intersection wireframe) between two shapes with explicit options.
public static func sectionWithOptions(_ shape1: Shape, _ shape2: Shape,
approximation: Bool = false,
computePCurve1: Bool = false,
computePCurve2: Bool = false) -> Shape?
- Parameters:
shape1,shape2— the two shapes to intersect;approximation— approximate result curves as BSplines;computePCurve1— compute PCurves onshape1;computePCurve2— compute PCurves onshape2. - Returns: A compound of intersection edges, or
nilon failure. - OCCT:
BRepAlgoAPI_Section. - Example:
if let section = Shape.sectionWithOptions(box, cylinder, approximation: true) { print(section.nbEdges) }
Shape.sectionAncestorFaceOn1(_:_:edge:approximation:computePCurve1:computePCurve2:)
Get the ancestor face from shape1 for a given section edge.
public static func sectionAncestorFaceOn1(_ shape1: Shape, _ shape2: Shape, edge: Shape,
approximation: Bool = false,
computePCurve1: Bool = false,
computePCurve2: Bool = false) -> Shape?
- Parameters:
shape1,shape2— the two intersection inputs;edge— a section result edge; remaining flags as insectionWithOptions. - Returns: The face on
shape1that generated the edge, ornil. - OCCT:
BRepAlgoAPI_Section::HasAncestorFaceOn1/AncestorFaceOn1. - Example:
if let face = Shape.sectionAncestorFaceOn1(box, cyl, edge: sectionEdge) { ... }
Shape.sectionAncestorFaceOn2(_:_:edge:approximation:computePCurve1:computePCurve2:)
Get the ancestor face from shape2 for a given section edge.
public static func sectionAncestorFaceOn2(_ shape1: Shape, _ shape2: Shape, edge: Shape,
approximation: Bool = false,
computePCurve1: Bool = false,
computePCurve2: Bool = false) -> Shape?
- Parameters:
shape1,shape2— the two intersection inputs;edge— a section result edge. - Returns: The face on
shape2that generated the edge, ornil. - OCCT:
BRepAlgoAPI_Section::HasAncestorFaceOn2/AncestorFaceOn2. - Example:
if let face = Shape.sectionAncestorFaceOn2(box, cyl, edge: sectionEdge) { ... }
Curve3D Extended Queries
Extensions on Curve3D added in v0.123.0.
Curve3D.firstParameter
The first (lower bound) parameter of the curve’s parametric domain.
public var firstParameter: Double
- OCCT:
Geom_Curve::FirstParameter. - Example:
let t0 = curve.firstParameter
Curve3D.lastParameter
The last (upper bound) parameter of the curve’s parametric domain.
public var lastParameter: Double
- OCCT:
Geom_Curve::LastParameter. - Example:
let t1 = curve.lastParameter
Additional Shape Queries
Extensions on Shape added in v0.123.0.
Shape.nullified
Return a null copy of this shape (a shape with the same type but no sub-shapes or geometry).
public var nullified: Shape?
- Returns: A nullified shape, or
nilon failure. - OCCT:
TopoDS_Shape::Nullify. - Example:
if let empty = shape.nullified { print(empty.isNull) }
Shape.typeName
The shape type as a human-readable string (e.g. "Solid", "Face", "Edge").
public var typeName: String?
- Returns: The shape type name, or
nilif the shape is null. - OCCT:
TopoDS_Shape::ShapeType→ string mapping. - Example:
print(shape.typeName ?? "null")
Shape.isNotEqual(to:)
Check whether this shape is NOT the same shape as other (by identity, not geometry).
public func isNotEqual(to other: Shape) -> Bool
- Returns:
trueif the two shapes are different. - OCCT:
TopoDS_Shape::IsNotEqual. - Example:
if shape.isNotEqual(to: otherShape) { print("different") }
Shape.emptied
Return a copy of this shape with all sub-shapes removed but the same location and orientation.
public var emptied: Shape?
- Returns: The emptied shell shape, or
nilon failure. - OCCT:
TopoDS_Shape::EmptyCopied. - Example:
if let shell = shape.emptied { ... }
Shape.moved(dx:dy:dz:)
Translate this shape by the given vector and return a new shape.
public func moved(dx: Double, dy: Double, dz: Double) -> Shape?
- Parameters:
dx,dy,dz— translation components. - Returns: The translated shape, or
nilon failure. - OCCT:
gp_Trsftranslation →BRepBuilderAPI_Transform. - Example:
if let shifted = box.moved(dx: 10, dy: 0, dz: 0) { ... }
Shape.orientationValue
The orientation of this shape as an integer: 0=FORWARD, 1=REVERSED, 2=INTERNAL, 3=EXTERNAL.
public var orientationValue: Int
- OCCT:
TopoDS_Shape::Orientation. - Example:
print(shape.orientationValue) // 0 = FORWARD
Shape.nbEdges
The number of edges in this shape.
public var nbEdges: Int
- OCCT:
TopExp_ExploreroverTopAbs_EDGE. - Example:
print(box.nbEdges) // 12
Shape.nbFaces
The number of faces in this shape.
public var nbFaces: Int
- OCCT:
TopExp_ExploreroverTopAbs_FACE. - Example:
print(box.nbFaces) // 6
Shape.nbVertices
The number of vertices in this shape.
public var nbVertices: Int
- OCCT:
TopExp_ExploreroverTopAbs_VERTEX. - Example:
print(box.nbVertices) // 8
XCAFDoc_ColorTool Completions on Document
Extensions on Document providing additional XCAFDoc_ColorTool operations, added in v0.126.0.
Document.colorToolAddColor(r:g:b:)
Add an RGB color to the document color table.
public func colorToolAddColor(r: Double, g: Double, b: Double) -> Int64
- Parameters:
r,g,b— red, green, blue components in [0, 1]. - Returns: The label tag of the new color entry, or -1 on failure.
- OCCT:
XCAFDoc_ColorTool::AddColor. - Example:
let redId = doc.colorToolAddColor(r: 1, g: 0, b: 0)
Document.colorToolRemoveColor(labelId:)
Remove a color from the document color table by label ID.
@discardableResult
public func colorToolRemoveColor(labelId: Int64) -> Bool
- Parameters:
labelId— the label tag of the color to remove. - Returns:
trueif removed. - OCCT:
XCAFDoc_ColorTool::RemoveColor. - Example:
doc.colorToolRemoveColor(labelId: redId)
Document.colorToolColorCount
The number of colors in the document color table.
public var colorToolColorCount: Int
- OCCT:
XCAFDoc_ColorTool::GetColors→ count. - Example:
print(doc.colorToolColorCount)
Document.colorToolUnSetColor(labelId:colorType:)
Remove the color of a specific type from a label.
@discardableResult
public func colorToolUnSetColor(labelId: Int64, colorType: Int) -> Bool
- Parameters:
labelId— the shape label;colorType— 0 = generic, 1 = surface, 2 = curve. - Returns:
trueon success. - OCCT:
XCAFDoc_ColorTool::UnSetColor. - Example:
doc.colorToolUnSetColor(labelId: partId, colorType: 1)
Document.colorToolIsVisible(labelId:)
Check whether a label is visible.
public func colorToolIsVisible(labelId: Int64) -> Bool
- Returns:
trueif visible. - OCCT:
XCAFDoc_ColorTool::IsVisible. - Example:
if doc.colorToolIsVisible(labelId: partId) { ... }
Document.colorToolSetVisibility(labelId:visible:)
Set the visibility of a label.
@discardableResult
public func colorToolSetVisibility(labelId: Int64, visible: Bool) -> Bool
- Parameters:
labelId— the label;visible—trueto show,falseto hide. - Returns:
trueon success. - OCCT:
XCAFDoc_ColorTool::SetVisibility. - Example:
doc.colorToolSetVisibility(labelId: partId, visible: false)
Document.colorToolIsColorByLayer(labelId:)
Check whether the color of a label is defined by its layer.
public func colorToolIsColorByLayer(labelId: Int64) -> Bool
- Returns:
trueif the color is inherited from the layer. - OCCT:
XCAFDoc_ColorTool::IsColorByLayer. - Example:
doc.colorToolIsColorByLayer(labelId: partId)
Document.colorToolSetColorByLayer(labelId:isByLayer:)
Set or unset the color-by-layer flag on a label.
@discardableResult
public func colorToolSetColorByLayer(labelId: Int64, isByLayer: Bool) -> Bool
- Parameters:
labelId— the label;isByLayer—trueto inherit color from layer. - Returns:
trueon success. - OCCT:
XCAFDoc_ColorTool::SetColorByLayer. - Example:
doc.colorToolSetColorByLayer(labelId: partId, isByLayer: true)
Document.colorToolFindColor(r:g:b:)
Search for a color in the color table by RGB value.
public func colorToolFindColor(r: Double, g: Double, b: Double) -> Int64
- Parameters:
r,g,b— red, green, blue components in [0, 1]. - Returns: The label tag if found, or -1.
- OCCT:
XCAFDoc_ColorTool::FindColor. - Example:
let existing = doc.colorToolFindColor(r: 1, g: 0, b: 0)
Document.colorToolSetInstanceColor(shape:colorType:r:g:b:)
Set the instance color of a shape component (overrides the referenced shape’s color for this instance).
@discardableResult
public func colorToolSetInstanceColor(shape: Shape, colorType: Int, r: Double, g: Double, b: Double) -> Bool
- Parameters:
shape— the component shape;colorType— 0/1/2;r,g,b— RGB. - Returns:
trueon success. - OCCT:
XCAFDoc_ColorTool::SetInstanceColor. - Example:
doc.colorToolSetInstanceColor(shape: component, colorType: 1, r: 0, g: 1, b: 0)
Document.colorToolGetInstanceColor(shape:colorType:)
Get the instance color of a shape component.
public func colorToolGetInstanceColor(shape: Shape, colorType: Int) -> (r: Double, g: Double, b: Double)?
- Parameters:
shape— the component;colorType— 0/1/2. - Returns: An
(r, g, b)tuple in [0, 1], ornilif no instance color is set. - OCCT:
XCAFDoc_ColorTool::GetInstanceColor. - Example:
if let color = doc.colorToolGetInstanceColor(shape: component, colorType: 1) { print(color.r, color.g, color.b) }
XCAFDoc_ShapeTool Completions on Document
Extensions on Document providing additional XCAFDoc_ShapeTool operations, added in v0.126.0.
Document.shapeToolIsFree(labelId:)
Check whether a label is a free shape (top-level, not referenced by other shapes).
public func shapeToolIsFree(labelId: Int64) -> Bool
- OCCT:
XCAFDoc_ShapeTool::IsFree. - Example:
if doc.shapeToolIsFree(labelId: id) { print("top-level") }
Document.shapeToolIsSimpleShape(labelId:)
Check whether a label is a simple shape (not an assembly, not a compound).
public func shapeToolIsSimpleShape(labelId: Int64) -> Bool
- OCCT:
XCAFDoc_ShapeTool::IsSimpleShape. - Example:
doc.shapeToolIsSimpleShape(labelId: id)
Document.shapeToolIsComponent(labelId:)
Check whether a label is a component (a reference to another shape label).
public func shapeToolIsComponent(labelId: Int64) -> Bool
- OCCT:
XCAFDoc_ShapeTool::IsComponent. - Example:
doc.shapeToolIsComponent(labelId: id)
Document.shapeToolIsCompound(labelId:)
Check whether a label is a compound shape.
public func shapeToolIsCompound(labelId: Int64) -> Bool
- OCCT:
XCAFDoc_ShapeTool::IsCompound. - Example:
doc.shapeToolIsCompound(labelId: id)
Document.shapeToolIsSubShape(labelId:)
Check whether a label represents a sub-shape of another label.
public func shapeToolIsSubShape(labelId: Int64) -> Bool
- OCCT:
XCAFDoc_ShapeTool::IsSubShape. - Example:
doc.shapeToolIsSubShape(labelId: id)
Document.shapeToolIsExternRef(labelId:)
Check whether a label is an external reference.
public func shapeToolIsExternRef(labelId: Int64) -> Bool
- OCCT:
XCAFDoc_ShapeTool::IsExternRef. - Example:
doc.shapeToolIsExternRef(labelId: id)
Document.shapeToolGetUsers(labelId:)
Get the number of users (references) of a shape label.
public func shapeToolGetUsers(labelId: Int64) -> Int
- Returns: The count of labels that reference this one.
- OCCT:
XCAFDoc_ShapeTool::GetUsers. - Example:
print(doc.shapeToolGetUsers(labelId: id))
Document.shapeToolComputeShapes(labelId:)
Trigger a shape computation/update on a label (refreshes cached shape data).
public func shapeToolComputeShapes(labelId: Int64)
- OCCT:
XCAFDoc_ShapeTool::ComputeShapes. - Example:
doc.shapeToolComputeShapes(labelId: id)
Document.shapeToolNbComponents(labelId:getSubChildren:)
Get the number of direct components of an assembly label.
public func shapeToolNbComponents(labelId: Int64, getSubChildren: Bool = false) -> Int
- Parameters:
labelId— the assembly label;getSubChildren— iftrue, recurse into sub-assemblies. - Returns: Component count.
- OCCT:
XCAFDoc_ShapeTool::NbComponents. - Example:
let count = doc.shapeToolNbComponents(labelId: assemblyId)
ColorTool Completions v0.127.0
Document.colorToolGetAllColors()
Get the label IDs of all colors defined in the document color table.
public func colorToolGetAllColors() -> [Int64]
- Returns: An array of label IDs; empty if no colors are defined.
- OCCT:
XCAFDoc_ColorTool::GetColors. - Example:
let colorIds = doc.colorToolGetAllColors() for id in colorIds { print(doc.colorToolIsVisible(labelId: id)) }
FilletBuilder History Queries
Extensions on FilletBuilder added in v0.127.0.
FilletBuilder.getBounds(contour:edge:)
Get the parameter bounds of a fillet on a contour edge.
public func getBounds(contour: Int, edge: Shape) -> (first: Double, last: Double)?
- Parameters:
contour— 1-based contour index;edge— the edge within the contour. - Returns:
(first, last)parameter range, ornilif not found. - OCCT:
BRepFilletAPI_MakeFillet::Bounds. - Example:
if let bounds = fillet.getBounds(contour: 1, edge: edge) { print(bounds.first, bounds.last) }
FilletBuilder.getLaw(contour:edge:)
Get the law function controlling the fillet radius on an edge within a contour.
public func getLaw(contour: Int, edge: Shape) -> LawFunction?
- Parameters:
contour— 1-based contour index;edge— the edge. - Returns: A
LawFunction, ornilif not available. - OCCT:
BRepFilletAPI_MakeFillet::GetLaw. - Example:
if let law = fillet.getLaw(contour: 1, edge: edge) { ... }
FilletBuilder.setLaw(contour:edge:law:)
Assign a law function to control the fillet radius along an edge.
@discardableResult
public func setLaw(contour: Int, edge: Edge, law: LawFunction) -> Bool
- Parameters:
contour— 1-based contour index;edge— the target edge;law— the radius law. - Returns:
trueif set successfully. - OCCT:
BRepFilletAPI_MakeFillet::SetLaw. - Example:
fillet.setLaw(contour: 1, edge: myEdge, law: radiusLaw)
FilletBuilder.generated(from:)
Get the shapes generated from an input shape by the fillet operation (call after build()).
public func generated(from shape: Shape) -> [Shape]
- Parameters:
shape— an input shape (typically an edge). - Returns: Array of generated shapes (fillet faces, etc.).
- OCCT:
BRepFilletAPI_MakeFillet::Generated. - Example:
let filletFaces = fillet.generated(from: myEdge)
FilletBuilder.modified(from:)
Get the shapes modified from an input shape by the fillet operation (call after build()).
public func modified(from shape: Shape) -> [Shape]
- Parameters:
shape— an input shape (typically a face). - Returns: Array of modified shapes.
- OCCT:
BRepFilletAPI_MakeFillet::Modified. - Example:
let modFaces = fillet.modified(from: originalFace)
FilletBuilder.isDeleted(_:)
Check whether an input shape was deleted by the fillet operation (call after build()).
public func isDeleted(_ shape: Shape) -> Bool
- Returns:
trueif the shape no longer exists in the result. - OCCT:
BRepFilletAPI_MakeFillet::IsDeleted. - Example:
if fillet.isDeleted(smallEdge) { print("edge was consumed") }
ChamferBuilder History & Extras
Extensions on ChamferBuilder added in v0.128.0.
ChamferBuilder.generated(from:)
Get the shapes generated from an input shape by the chamfer operation.
public func generated(from shape: Shape) -> [Shape]
- Parameters:
shape— an input edge or face. - Returns: Array of generated shapes.
- OCCT:
BRepFilletAPI_MakeChamfer::Generated. - Example:
let chamferFaces = chamfer.generated(from: myEdge)
ChamferBuilder.modified(from:)
Get the shapes modified from an input shape by the chamfer operation.
public func modified(from shape: Shape) -> [Shape]
- Parameters:
shape— an input face. - Returns: Array of modified shapes.
- OCCT:
BRepFilletAPI_MakeChamfer::Modified. - Example:
let modFaces = chamfer.modified(from: originalFace)
ChamferBuilder.isDeleted(_:)
Check whether an input shape was deleted by the chamfer operation.
public func isDeleted(_ shape: Shape) -> Bool
- Returns:
trueif deleted. - OCCT:
BRepFilletAPI_MakeChamfer::IsDeleted. - Example:
chamfer.isDeleted(myEdge)
ChamferBuilder.ChamferMode
The three available chamfer construction modes.
public enum ChamferMode: Int32, Sendable {
case classic = 0
case constThroat = 1
case constThroatWithPenetration = 2
}
classic— standard equal-distance chamfer.constThroat— constant throat width.constThroatWithPenetration— constant throat with surface penetration.
ChamferBuilder.setMode(_:)
Set the chamfer construction mode.
public func setMode(_ mode: ChamferMode)
- Parameters:
mode— the desiredChamferMode. - OCCT:
BRepFilletAPI_MakeChamfer::SetMode. - Example:
chamfer.setMode(.constThroat)
ChamferBuilder.simulate(contour:)
Simulate the chamfer on a contour (1-based) without building; populates surface count.
@discardableResult
public func simulate(contour: Int) -> Bool
- Parameters:
contour— 1-based contour index. - Returns:
trueif simulation succeeded. - OCCT:
BRepFilletAPI_MakeChamfer::Simulate. - Example:
if chamfer.simulate(contour: 1) { print(chamfer.simulatedSurfaceCount(contour: 1)) }
ChamferBuilder.simulatedSurfaceCount(contour:)
Get the number of simulated chamfer surfaces on a contour (after calling simulate).
public func simulatedSurfaceCount(contour: Int) -> Int
- Parameters:
contour— 1-based contour index. - Returns: Number of surfaces that would be generated.
- OCCT:
BRepFilletAPI_MakeChamfer::NbSurf. - Example:
let n = chamfer.simulatedSurfaceCount(contour: 1)
SectionBuilder
A fine-grained builder for intersecting shapes, planes, and surfaces. Wraps BRepAlgoAPI_Section with explicit argument-setting and PCurve controls. Added in v0.128.0.
SectionBuilder.init()
Create an empty section builder (arguments set via init1/init2).
public init?()
- Returns:
nilif internal allocation fails. - OCCT:
BRepAlgoAPI_Sectiondefault constructor. - Example:
guard let sb = SectionBuilder() else { return }
SectionBuilder.init(shape1:shape2:)
Create a section builder pre-loaded with two shapes.
public init?(shape1: Shape, shape2: Shape)
- Parameters:
shape1,shape2— the two shapes to section. - Returns:
nilon failure. - OCCT:
BRepAlgoAPI_Section(s1, s2). - Example:
if let sb = SectionBuilder(shape1: box, shape2: sphere) { if let result = sb.build() { print(result.nbEdges) } }
SectionBuilder.init1(shape:)
Set the first argument as a shape.
public func init1(shape: Shape)
- OCCT:
BRepAlgoAPI_Section::Init1(TopoDS_Shape). - Example:
sb.init1(shape: box)
SectionBuilder.init1(plane:_:_:_:)
Set the first argument as a plane defined by the equation ax + by + cz + d = 0.
public func init1(plane a: Double, _ b: Double, _ c: Double, _ d: Double)
- Parameters:
a,b,c,d— plane equation coefficients. - OCCT:
BRepAlgoAPI_Section::Init1(gp_Pln). - Example:
sb.init1(plane: 0, 0, 1, 0) // XY plane (z=0)
SectionBuilder.init1(surface:)
Set the first argument as a surface.
public func init1(surface: Surface)
- OCCT:
BRepAlgoAPI_Section::Init1(Geom_Surface). - Example:
sb.init1(surface: mySurface)
SectionBuilder.init2(shape:)
Set the second argument as a shape.
public func init2(shape: Shape)
- OCCT:
BRepAlgoAPI_Section::Init2(TopoDS_Shape). - Example:
sb.init2(shape: sphere)
SectionBuilder.init2(plane:_:_:_:)
Set the second argument as a plane defined by ax + by + cz + d = 0.
public func init2(plane a: Double, _ b: Double, _ c: Double, _ d: Double)
- OCCT:
BRepAlgoAPI_Section::Init2(gp_Pln). - Example:
sb.init2(plane: 0, 1, 0, -5) // y=5 plane
SectionBuilder.init2(surface:)
Set the second argument as a surface.
public func init2(surface: Surface)
- OCCT:
BRepAlgoAPI_Section::Init2(Geom_Surface). - Example:
sb.init2(surface: otherSurface)
SectionBuilder.setApproximation(_:)
Toggle approximation of result curves as BSplines (default: false).
public func setApproximation(_ enabled: Bool)
- OCCT:
BRepAlgoAPI_Section::Approximation. - Example:
sb.setApproximation(true)
SectionBuilder.computePCurveOn1(_:)
Toggle computation of PCurves on the first shape/surface (default: false).
public func computePCurveOn1(_ enabled: Bool)
- OCCT:
BRepAlgoAPI_Section::ComputePCurveOn1. - Example:
sb.computePCurveOn1(true)
SectionBuilder.computePCurveOn2(_:)
Toggle computation of PCurves on the second shape/surface (default: false).
public func computePCurveOn2(_ enabled: Bool)
- OCCT:
BRepAlgoAPI_Section::ComputePCurveOn2. - Example:
sb.computePCurveOn2(true)
SectionBuilder.build()
Execute the section computation and return the result.
public func build() -> Shape?
- Returns: A compound of intersection edges, or
nilon failure. - OCCT:
BRepAlgoAPI_Section::Build→Shape. - Example:
if let result = sb.build() { print(result.nbEdges) }
SectionBuilder.ancestorFaceOn1(edge:)
Get the ancestor face from the first argument for a section result edge.
public func ancestorFaceOn1(edge: Shape) -> Shape?
- Parameters:
edge— a section result edge. - Returns: The face on the first argument that produced the edge, or
nil. - OCCT:
BRepAlgoAPI_Section::HasAncestorFaceOn1/AncestorFaceOn1. - Example:
if let f = sb.ancestorFaceOn1(edge: e) { ... }
SectionBuilder.ancestorFaceOn2(edge:)
Get the ancestor face from the second argument for a section result edge.
public func ancestorFaceOn2(edge: Shape) -> Shape?
- Parameters:
edge— a section result edge. - Returns: The face on the second argument that produced the edge, or
nil. - OCCT:
BRepAlgoAPI_Section::HasAncestorFaceOn2/AncestorFaceOn2. - Example:
if let f = sb.ancestorFaceOn2(edge: e) { ... }
GeomEval Standalone Evaluators
A namespace of static mathematical evaluators for analytical 3D curves and surfaces that compute function values without creating persistent OCCT geometry objects. Added in v0.130.0.
3D Curves
GeomEval.circularHelixD0(radius:pitch:u:)
Evaluate a circular helix at parameter u: C(t) = R·cos(t)·X + R·sin(t)·Y + (P·t/(2π))·Z.
public static func circularHelixD0(radius: Double, pitch: Double, u: Double) -> SIMD3<Double>
- Parameters:
radius— helix radius;pitch— axial advance per full turn;u— parameter. - Returns: 3D point on the helix.
- OCCT: Custom bridge (
OCCTGeomEvalCircularHelixD0) — analytical evaluation. - Example:
let pt = GeomEval.circularHelixD0(radius: 5, pitch: 2, u: .pi)
GeomEval.circularHelixD1(radius:pitch:u:)
Evaluate a circular helix point and first derivative at u.
public static func circularHelixD1(radius: Double, pitch: Double, u: Double) -> (point: SIMD3<Double>, d1: SIMD3<Double>)
- Returns: Tuple of
(point, d1)— position and tangent vector. - OCCT:
OCCTGeomEvalCircularHelixD1. - Example:
let (pt, tangent) = GeomEval.circularHelixD1(radius: 5, pitch: 2, u: 0)
GeomEval.circularHelixD2(radius:pitch:u:)
Evaluate a circular helix point, first, and second derivatives at u.
public static func circularHelixD2(radius: Double, pitch: Double, u: Double) -> (point: SIMD3<Double>, d1: SIMD3<Double>, d2: SIMD3<Double>)
- Returns: Tuple of
(point, d1, d2). - OCCT:
OCCTGeomEvalCircularHelixD2. - Example:
let (pt, d1, d2) = GeomEval.circularHelixD2(radius: 5, pitch: 2, u: 0)
GeomEval.sineWaveD0(amplitude:omega:phase:u:)
Evaluate a 3D sine wave at parameter u: C(t) = t·X + A·sin(ω·t + φ)·Y.
public static func sineWaveD0(amplitude: Double, omega: Double, phase: Double, u: Double) -> SIMD3<Double>
- Parameters:
amplitude— wave amplitude;omega— angular frequency;phase— phase offset;u— parameter. - Returns: 3D point on the wave.
- OCCT:
OCCTGeomEvalSineWaveD0. - Example:
let pt = GeomEval.sineWaveD0(amplitude: 1, omega: 2 * .pi, phase: 0, u: 0.5)
GeomEval.sineWaveD1(amplitude:omega:phase:u:)
Evaluate a 3D sine wave point and first derivative at u.
public static func sineWaveD1(amplitude: Double, omega: Double, phase: Double, u: Double) -> (point: SIMD3<Double>, d1: SIMD3<Double>)
- Returns:
(point, d1)tuple. - OCCT:
OCCTGeomEvalSineWaveD1. - Example:
let (pt, d1) = GeomEval.sineWaveD1(amplitude: 1, omega: 2 * .pi, phase: 0, u: 0.25)
Surfaces
GeomEval.ellipsoidD0(a:b:c:u:v:)
Evaluate an ellipsoid at (u, v): P(u,v) = A·cos(v)·cos(u)·X + B·cos(v)·sin(u)·Y + C·sin(v)·Z.
public static func ellipsoidD0(a: Double, b: Double, c: Double, u: Double, v: Double) -> SIMD3<Double>
- Parameters:
a,b,c— semi-axes along X, Y, Z;u,v— longitude, latitude parameters. - Returns: 3D point on the ellipsoid.
- OCCT:
OCCTGeomEvalEllipsoidD0. - Example:
let pt = GeomEval.ellipsoidD0(a: 3, b: 2, c: 1, u: 0, v: 0)
GeomEval.hyperboloidD0(r1:r2:twoSheets:u:v:)
Evaluate a hyperboloid at (u, v).
public static func hyperboloidD0(r1: Double, r2: Double, twoSheets: Bool, u: Double, v: Double) -> SIMD3<Double>
- Parameters:
r1,r2— radii;twoSheets—false= one-sheet,true= two-sheet hyperboloid;u,v— parameters. - Returns: 3D point on the hyperboloid.
- OCCT:
OCCTGeomEvalHyperboloidD0. - Example:
let pt = GeomEval.hyperboloidD0(r1: 2, r2: 1, twoSheets: false, u: 0, v: 0)
GeomEval.paraboloidD0(focal:u:v:)
Evaluate a paraboloid at (u, v).
public static func paraboloidD0(focal: Double, u: Double, v: Double) -> SIMD3<Double>
- Parameters:
focal— focal distance;u,v— surface parameters. - Returns: 3D point on the paraboloid.
- OCCT:
OCCTGeomEvalParaboloidD0. - Example:
let pt = GeomEval.paraboloidD0(focal: 1.0, u: 0.5, v: 0.5)
GeomEval.circularHelicoidD0(pitch:u:v:)
Evaluate a circular helicoid (screw surface) at (u, v).
public static func circularHelicoidD0(pitch: Double, u: Double, v: Double) -> SIMD3<Double>
- Parameters:
pitch— axial advance per 2π radians;u— angular parameter;v— radial parameter. - Returns: 3D point on the helicoid.
- OCCT:
OCCTGeomEvalCircularHelicoidD0. - Example:
let pt = GeomEval.circularHelicoidD0(pitch: 1.0, u: .pi, v: 1.0)
GeomEval.hyperbolicParaboloidD0(a:b:u:v:)
Evaluate a hyperbolic paraboloid (saddle surface) at (u, v).
public static func hyperbolicParaboloidD0(a: Double, b: Double, u: Double, v: Double) -> SIMD3<Double>
- Parameters:
a,b— shape parameters;u,v— surface parameters. - Returns: 3D point on the saddle surface.
- OCCT:
OCCTGeomEvalHypParaboloidD0. - Example:
let pt = GeomEval.hyperbolicParaboloidD0(a: 1, b: 1, u: 0.5, v: -0.5)
Geom2dEval Standalone Evaluators
A namespace of static evaluators for analytical 2D curves. Added in v0.130.0.
Geom2dEval.archimedeanSpiralD0(initialRadius:growthRate:u:)
Evaluate an Archimedean spiral at u: C(t) = (a + b·t)·cos(t)·X + (a + b·t)·sin(t)·Y.
public static func archimedeanSpiralD0(initialRadius: Double, growthRate: Double, u: Double) -> SIMD2<Double>
- Parameters:
initialRadius—a, the starting radius;growthRate—b, expansion per radian;u— parameter. - Returns: 2D point on the spiral.
- OCCT:
OCCTGeom2dEvalArchimedeanSpiralD0. - Example:
let pt = Geom2dEval.archimedeanSpiralD0(initialRadius: 1, growthRate: 0.1, u: 2 * .pi)
Geom2dEval.archimedeanSpiralD1(initialRadius:growthRate:u:)
Evaluate an Archimedean spiral point and first derivative at u.
public static func archimedeanSpiralD1(initialRadius: Double, growthRate: Double, u: Double) -> (point: SIMD2<Double>, d1: SIMD2<Double>)
- Returns:
(point, d1)tuple. - OCCT:
OCCTGeom2dEvalArchimedeanSpiralD1. - Example:
let (pt, d1) = Geom2dEval.archimedeanSpiralD1(initialRadius: 1, growthRate: 0.1, u: .pi)
Geom2dEval.logarithmicSpiralD0(scale:growthExponent:u:)
Evaluate a logarithmic (equiangular) spiral at u: C(t) = a·exp(b·t)·cos(t)·X + a·exp(b·t)·sin(t)·Y.
public static func logarithmicSpiralD0(scale: Double, growthExponent: Double, u: Double) -> SIMD2<Double>
- Parameters:
scale—a, initial scale;growthExponent—b, exponential growth rate;u— parameter. - Returns: 2D point on the spiral.
- OCCT:
OCCTGeom2dEvalLogSpiralD0. - Example:
let pt = Geom2dEval.logarithmicSpiralD0(scale: 1, growthExponent: 0.2, u: 2 * .pi)
Geom2dEval.logarithmicSpiralD1(scale:growthExponent:u:)
Evaluate a logarithmic spiral point and first derivative at u.
public static func logarithmicSpiralD1(scale: Double, growthExponent: Double, u: Double) -> (point: SIMD2<Double>, d1: SIMD2<Double>)
- Returns:
(point, d1)tuple. - OCCT:
OCCTGeom2dEvalLogSpiralD1. - Example:
let (pt, d1) = Geom2dEval.logarithmicSpiralD1(scale: 1, growthExponent: 0.2, u: .pi)
Geom2dEval.circleInvoluteD0(radius:u:)
Evaluate a circle involute at u: C(t) = R·(cos(t) + t·sin(t))·X + R·(sin(t) − t·cos(t))·Y.
public static func circleInvoluteD0(radius: Double, u: Double) -> SIMD2<Double>
- Parameters:
radius— base circle radiusR;u— involute parameter. - Returns: 2D point on the involute.
- OCCT:
OCCTGeom2dEvalCircleInvoluteD0. - Note: The circle involute is the curve traced by the endpoint of a taut string unwinding from a circle — widely used for gear tooth profiles.
- Example:
let pt = Geom2dEval.circleInvoluteD0(radius: 10, u: 0.5)
Geom2dEval.circleInvoluteD1(radius:u:)
Evaluate a circle involute point and first derivative at u.
public static func circleInvoluteD1(radius: Double, u: Double) -> (point: SIMD2<Double>, d1: SIMD2<Double>)
- Returns:
(point, d1)tuple. - OCCT:
OCCTGeom2dEvalCircleInvoluteD1. - Example:
let (pt, d1) = Geom2dEval.circleInvoluteD1(radius: 10, u: 0.5)
Geom2dEval.sineWaveD0(amplitude:omega:phase:u:)
Evaluate a 2D sine wave at u: C(t) = t·X + A·sin(ω·t + φ)·Y.
public static func sineWaveD0(amplitude: Double, omega: Double, phase: Double, u: Double) -> SIMD2<Double>
- Parameters:
amplitude— wave amplitude;omega— angular frequency;phase— phase shift;u— parameter. - Returns: 2D point on the wave.
- OCCT:
OCCTGeom2dEvalSineWaveD0. - Example:
let pt = Geom2dEval.sineWaveD0(amplitude: 1, omega: 2 * .pi, phase: 0, u: 0.25)
Geom2dEval.sineWaveD1(amplitude:omega:phase:u:)
Evaluate a 2D sine wave point and first derivative at u.
public static func sineWaveD1(amplitude: Double, omega: Double, phase: Double, u: Double) -> (point: SIMD2<Double>, d1: SIMD2<Double>)
- Returns:
(point, d1)tuple. - OCCT:
OCCTGeom2dEvalSineWaveD1. - Example:
let (pt, d1) = Geom2dEval.sineWaveD1(amplitude: 1, omega: 2 * .pi, phase: 0, u: 0.25)