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!

Journal to Select FlatSolid

Status
Not open for further replies.

BBow

Mechanical
Oct 5, 2015
28
0
0
US
I have an existing journal to work through an assembly and extract bounding box information for each component in the assembly for BOM purposes. This works well except for formed components, where we want to bound box only the FlatSolid of the component. Does somebody know the code to do this? Find and select the FlatSolid only.
 
Replies continue below

Recommended for you

The following journal shows one way to do it.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()

    Dim theUI As UI = UI.GetUI()
    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "find flat solid")

        lw.Open()

        Dim myFlatSolid As Body = Nothing

        For Each tempBody As Body In theSession.Parts.Work.Bodies

            Dim parentFeats() As Features.Feature = tempBody.GetFeatures
            For Each tempFeat As Features.Feature In parentFeats
                If TypeOf (tempFeat) Is Features.FlatSolid Then
                    myFlatSolid = tempBody
                End If
            Next
            lw.WriteLine("")
        Next

        lw.WriteLine("flat solid body tag: " & myFlatSolid.Tag.ToString)

        lw.Close()

    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module

www.nxjournaling.com
 
Status
Not open for further replies.
Back
Top