On Error Resume Next Dim oDoc As PartDocument oDoc = ThisDoc.Document 'oDoc = ThisApplication.ActiveDocument If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then 'Part or Sheet Metal File If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" = True Then 'Sheet Metal File Only Else Dim oParameter As Parameter For Each oParameter In oDoc.ComponentDefinition.Parameters If oParameter.Name = "Length" Then oParameter.Name = "PartLength" End If Next 'reference to this part document Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition Dim oFeatures As ExtrudeFeatures = oDef.Features.ExtrudeFeatures 'reference to the first extrusion Dim oExtr As ExtrudeFeature = oFeatures.Item(1) If oExtr.Definition.ExtentType = PartFeatureExtentEnum.kDistanceExtent Then 'extrusion length is controlled by model parameter Dim oPar As Inventor.Parameter = oExtr.Definition.Extent.Distance 'model parameter name Dim ParName As String = oPar.Name oDoc = ThisApplication.ActiveDocument ' Dim oParameter As Parameter For Each oParameter In oDoc.ComponentDefinition.Parameters If oParameter.Name = oPar.Name Then oParameter.Name = "PartLength" param =Parameter.Param(oPar.Name) param.ExposedAsProperty = True 'param.CustomPropertyFormat.Precision = kZeroDecimalPlacePrecision param.CustomPropertyFormat.ShowTrailingZeros = False param.CustomPropertyFormat.ShowLeadingZeros = False param.CustomPropertyFormat.ShowUnitsString = False param.CustomPropertyFormat.Units = "mm" End If Next 'iLogicVb.RunExternalRule("iProperties - Rev 1") 'Length = iProperties.Value("Custom", "PartLength") * iProperties.Value("Custom", "Qty Required") iProperties.Value("Custom", "Length") = iProperties.Value("Custom", "PartLength") * iProperties.Value("Custom", "Qty Required") Else iLogicVb.RunExternalRule("Length Sweep") 'MsgBox("Extrusion type is not Distance Extent") End If End If End If iLogicVb.UpdateWhenDone = True