GetMaxProjDistance
From scripting
Function GetMaxProjDistance(CrvObj1 As Variant, Obj2 As Variant, IntervalDist As Double, ConstSet As HybridBody) As Double Dim Floater As HybridShapePointOnCurve Set Floater = MyHSFactory.AddNewPointOnCurveFromDistance(CrvObj1, 0, True) ConstSet.AppendHybridShape Floater If IsUpdatable(Floater) = False Then GetMaxProjDistance = -1 MyHSFactory.DeleteObjectForDatum Floater Exit Function End If Dim LargestVal As Double LargestVal = 0 Dim CMeas Set CMeas = TheSPAWorkbench.GetMeasurable(CrvObj1) Dim CLength As Double CLength = CMeas.Length Dim LCounter As Double LCounter = 0 While LCounter < CLength Floater.Offset.Value = LCounter MyPart.UpdateObject Floater If CheckProjection(Floater, Obj2) Then Dim TempProj As HybridShapeProject Set TempProj = MyHSFactory.AddNewProject(Floater, Obj2) ConstSet.AppendHybridShape TempProj MyPart.UpdateObject TempProj Dim TempMeas Set TempMeas = TheSPAWorkbench.GetMeasurable(TempProj) Dim CurDist As Double CurDist = TempMeas.GetMinimumDistance(Floater) If CurDist > LargestVal Then LargestVal = CurDist End If MyHSFactory.DeleteObjectForDatum TempProj End If LCounter = LCounter + IntervalDist Wend MyHSFactory.DeleteObjectForDatum Floater GetMaxProjDistance = LargestVal End Function