admin 发表于 2015-2-25 12:48:40

NX二次开发源码分享:使用.net 选择注释Note功能



其实主要是Note的类型的定义问题,参考代码如下:


Private Function selectNotes(ByVal prompt As String) As Annotations.Note()
      Dim mask(0) As Selection.MaskTriple
      With mask(0)
            .Type = UFConstants.UF_drafting_entity_type
            .Subtype = UFConstants.UF_draft_note_subtype
            .SolidBodySubtype = 0
      End With
      Dim cursor As Point3d = Nothing
      Dim theObjects() As TaggedObject = Nothing

      UI.GetUI().SelectionManager.SelectTaggedObjects("Select Notes", prompt, _
            Selection.SelectionScope.AnyInAssembly, _
            Selection.SelectionAction.ClearAndEnableSpecific, _
            False, False, mask, theObjects)

      Dim theNotes(theObjects.Length - 1) As Annotations.Note
      For ii As Integer = 0 To theObjects.Length - 1
            theNotes(ii) = CType(theObjects(ii), Annotations.Note)
      Next

      Return theNotes

    End Function

页: [1]
查看完整版本: NX二次开发源码分享:使用.net 选择注释Note功能