Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cycle with selection of objects

Status
Not open for further replies.

Frank2288

Mechanical
Nov 20, 2015
38
0
0
IT
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:
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
















 
Status
Not open for further replies.
Back
Top