1. 程式人生 > 其它 >ug二次開發 vb.net UG8.5 用規則來得到面

ug二次開發 vb.net UG8.5 用規則來得到面

    Function GetFaceDiameter()

        Dim workPart As Part = theSession.Parts.Work

        Dim nullFeatures_AdmResizeFace As Features.AdmResizeFace = Nothing

        Dim admResizeFaceBuilder1 As Features.AdmResizeFaceBuilder
        admResizeFaceBuilder1 = workPart.Features.CreateAdmResizeFaceBuilder(nullFeatures_AdmResizeFace)

        
Dim face1 As Face = CType(NXOpen.Utilities.NXObjectManager.Get(face_select0.GetSelectedObjects(0).Tag), Face) '從面選擇框獲得Face Dim faces1(0) As Face faces1(0) = face1 Dim faceDumbRule1 As FaceDumbRule faceDumbRule1 = workPart.ScRuleFactory.CreateRuleFaceDumb(faces1)
Dim rules2(0) As SelectionIntentRule rules2(0) = faceDumbRule1 admResizeFaceBuilder1.FaceToResize.FaceCollector.ReplaceRules(rules2, False) admResizeFaceBuilder1.FaceToResize.RecognizeEqualDiameter(True) '指定規則(相同半徑) Dim objs = admResizeFaceBuilder1.FaceToResize.FaceCollector.GetObjects() face_select0.SetSelectedObjects(objs)
'把相同半徑的圓面賦給選擇框 End Function