×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Cycle with selection of objects

Cycle with selection of objects

Cycle with selection of objects

(OP)
Hi all!

I have another question for you: I am currently trying to write a piece of code in NX open VB that performs these operations: (once again, I am a beginner)

- Open a part (DONE)
- get the collection of the STLs of a part (DONE)
- cycle through every single STL and ask the user to select a corresponding surface
- store in two separates array or in some other kind of structure the corresponding STL/surfaces (I am interested in the coupling of STL/surfaces)

I am trying to build it using the SNAP blocks, as in this example, but I have serious doubts that is the most efficient way. Any suggestions?


Thanks.

CODE --> VB

Public Class MyProgram
'missing the IMPORT/OPENING OF CAD PART

    Public Shared Sub Main()

Dim facetbody_collection As NXOpen.Facet.FacetedBodyCollection
        facetbody_collection = workPart.FacetedBodies

        Dim single_STL As NXOpen.Facet.FacetedBody

        Dim block_selection As New deviazione_STL

        Dim list_STL As NXOpen.Facet.FacetedBody()
        Dim list_SURF As NXOpen.Features.Feature()
        Dim counter As Integer = 0

        'inizia il ciclo di selection STL e SURF abbinate
        For Each single_STL In facetbody_collection

            single_STL.Highlight()

            block_selection.Show()

            'list_SURF(counter) = 

            single_STL.Unhighlight()

            counter = counter + 1


        Next

    End Sub

    Public Class deviazione_STL : Inherits Snap.UI.BlockForm

        Dim selectionblockSURF As Snap.UI.Block.SelectObject

        Public Sub New()

            Me.Title = "Abbina STL evidenziato alla SURFe di interesse"    ' Text to be shown in title bar of dialog
            Me.Cue = "Seleziona la SURFe del modello CAD abbinata all'STL evidenziato"            ' Text to be shown in the cue line


            selectionblockSURF = New Snap.UI.Block.SelectObject("Seleziona la SURFe abbinata", "Seleziona STL2")
            selectionblockSURF.SetFilter(Snap.NX.ObjectTypes.Type.Feature)

            selectionblockSURF.AllowMultiple = False



            Me.AddBlocks(selectionblockSURF)


        End Sub

        Public Shared Sub OnOK()

            Dim selection As NXOpen.Features.Feature
            selection = 

        End Sub

        Public Sub OnApply()

        End Sub

        Public Sub OnUpdate(changedBlock As Snap.UI.Block.General)

        End Sub


    End Class

End Class 
















Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources