Message 1 of 8
GetMinimumDistance returning wrong value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello together,
I try to get the minimaldistance with this code:
m_invApp = GetObject(, "Inventor.Application") Dim oFaceProxy As FaceProxy oFaceProxy = m_invApp.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Face") If oFaceProxy Is Nothing Then Exit Sub End If On Error GoTo 0 Dim oAssyDoc As AssemblyDocument oAssyDoc = m_invApp.ActiveDocument ' Set a reference to the mass properties object. Dim oMassProps As MassProperties oMassProps = oAssyDoc.ComponentDefinition.MassProperties 'Check if mass property results are already available 'at a high accuracy level or better. If so, simply 'print out the results, else, set a flag to not cache 'the results in the document. If oMassProps.AvailableAccuracy = MassPropertiesAccuracyEnum.k_High And oMassProps.AvailableAccuracy = MassPropertiesAccuracyEnum.k_VeryHigh Then ' Set the accuracy to high. oMassProps.Accuracy = MassPropertiesAccuracyEnum.k_High 'Set CacheResultsOnCompute property to False 'so that results are not saved with the document 'and hence the document is not 'dirtied'. oMassProps.CacheResultsOnCompute = False End If Dim oMeasureTools As MeasureTools oMeasureTools = m_invApp.MeasureTools Dim oDistance As Double = oMeasureTools.GetMinimumDistance(oMassProps.CenterOfMass, oFaceProxy.PointOnFace) oDistance = oAssyDoc.UnitsOfMeasure.ConvertUnits(oDistance, "cm", "mm") MsgBox(oDistance)
But the result is wrong.
What I am doing wrong?
Thank you
Georg