On Error Resume Next Dim oDoc as PartDocument oDoc = ThisApplication.ActiveDocument Dim oParameter As Parameter For Each oParameter In oDoc.ComponentDefinition.Parameters If oParameter.Name = "Length" Then oParameter.Name = "PartLength" End If Next 'Set a reference to the active part document Dim oDef As PartComponentDefinition oDef = oDoc.ComponentDefinition Dim opath As Path opath = oDef.Features.SweepFeatures.Item("Sweep1").Path Dim TotalLength As Double TotalLength = 0 Dim oCurve As Object Dim i As Integer For i = 1 To opath.Count oCurve = opath.Item(i).Curve Dim oCurveEval As CurveEvaluator oCurveEval = oCurve.Evaluator Dim MinParam As Double Dim MaxParam As Double Dim length As Double Call oCurveEval.GetParamExtents(MinParam, MaxParam) Call oCurveEval.GetLengthAtParam(MinParam, MaxParam, length) TotalLength = TotalLength + length Next i Dim oparams As Parameters Dim oparam As Parameter oparams = oDoc.ComponentDefinition.Parameters Dim exists As Boolean exists = False 'Find out if parameter exists For Each oparam In oparams If oparam.Name = "PartLength" Then exists = True Next oparam 'Change the value if the parameter exists otherwise add the parameter If exists Then oparams.Item("PartLength").Value = TotalLength Else oparams.UserParameters.AddByValue( "PartLength", TotalLength, 11266) End If oDoc.Update Dim oPara As Parameter Dim oFormat As CustomPropertyFormat oPara = Parameter.Param("PartLength") oPara.ExposedAsProperty = True oFormat=oPara.CustomPropertyFormat oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision oFormat.Units="mm" oFormat.ShowUnitsString=False 'set to show/not show the unit string (use True to show) oFormat.ShowUnitsString=False 'set to show/not show the trailing zeros (use True to show) oFormat.ShowTrailingZeros = False 'set to show/not show the leading zeros (use True to show) oFormat.ShowLeadingZeros = False iLogicVb.RunExternalRule("iProperties") iProperties.Value("Custom", "Length") = iProperties.Value("Custom", "PartLength") * iProperties.Value("Custom", "Qty Required") iLogicVb.UpdateWhenDone = True