NX二次开发源码分享:测量两个对象之间最短距离
NX二次开发源码分享:测量两个对象之间最短距离
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim object1 As DisplayableObject = SelectAnObject("First Object")
Dim object2 As DisplayableObject = SelectAnObject("Second Object")
Dim unitMM As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
Dim nullUnit As Unit = Nothing
Dim measureDistance1 As MeasureDistance
measureDistance1 = workPart.MeasureManager.NewDistance(nullUnit,
MeasureManager.MeasureType.Maximum, object1, object2)
Dim theLW As ListingWindow = theSession.ListingWindow
theLW.Open()
theLW.WriteLine("Maximum distance = " & measureDistance1.Value.ToString("F6"))
measureDistance1.Dispose()
页:
[1]