Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Ralf_Krieg
in reply to: ivanildo.b

Hello

 

In such a case it would be much more helpful to upload the ipt file. I think there are some dimensions missing (please see picture).

Questions.jpg

 

Anyway, when your parts are always a revolve, there could be an alternative way we can try.

Dim oApp As Inventor.Application=ThisApplication
Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oUOM As UnitsOfMeasure = oPartDoc.UnitsOfMeasure
Dim oCompdef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oWorkSurface As WorkSurface = oCompdef.WorkSurfaces.Item(1)
Dim oSurfaceBody As SurfaceBody = oWorkSurface.SurfaceBodies.Item(1)
Dim oEdge As Edge = oSurfaceBody.Edges.Item(1)
Dim dLoopLength As Double=oApp.MeasureTools.GetLoopLength(oEdge)
Dim dRadius As Double = oUOM.ConvertUnits(dLoopLength / 2 / System.Math.PI,"cm",oUOM.LengthUnits)

Dim oParam As UserParameter
Try
	oCompdef.Parameters.UserParameters.Item("diam").Expression=dRadius & oUOM.LengthUnits	
Catch
	oCompdef.Parameters.UserParameters.AddByExpression("diam", dRadius, oUOM.LengthUnits )
End Try

 


R. Krieg
RKW Solutions
www.rkw-solutions.com