Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

XYZ spotweld points HELP

Status
Not open for further replies.

mnash60

Materials
Feb 21, 2012
29
I have been trying for weeks now to write a journal file that wille select all the spotweld points and input them into a txt file or a excel sheet, but having no luck. I there anyone out the that can help? I am using UGNX 8.
 
Replies continue below

Recommended for you

unfortnally nothing as i read on forums they all say i need a grips program. i don't have a clue where to start.
 
What is your "spotweld point"? An associative point feature? A dumb point object? A custom object?

If it is a point object/feature, what differentiates it as a spotweld? object name? some attribute? other?

Can you post a small sample file along with what you would want to see as output?

www.nxjournaling.com
 
It appears that the "retained" features have all the info added to them as attributes.

Perhaps the following code will get you started:

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

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession()
        Dim workPart As Part = theSession.Parts.Work

        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        For Each myFeature As Features.Feature In theSession.Parts.Work.Features.GetFeatures()

            If myFeature.FeatureType.ToUpper = "WELD_POINT" Then

                Dim weldID As String = ""
                Try
                    weldID = myFeature.GetStringAttribute("ID")
                Catch ex As NXException
                    Continue For
                End Try

                Dim weldX As Double
                Try
                    weldX = myFeature.GetRealAttribute("X_Pos")
                Catch ex As NXException
                    Continue For
                End Try

                Dim weldY As Double
                Try
                    weldY = myFeature.GetRealAttribute("Y_Pos")
                Catch ex As NXException
                    Continue For
                End Try

                Dim weldZ As Double
                Try
                    weldZ = myFeature.GetRealAttribute("Z_Pos")
                Catch ex As NXException
                    Continue For
                End Try

                lw.WriteLine("ID: " & weldID & ", " & weldX.ToString & ", " & weldY.ToString & ", " & weldZ.ToString)
                lw.WriteLine("")

            End If
        Next
        lw.Close()


    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

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

        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------

    End Function

End Module

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

Part and Inventory Search

Sponsor