Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX 7.5 Journal - Determine Solid Body Material 1

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
How do I determine the MATERIAL attribute assigned to a solid body using .NET Journal?

Thanks,
Jeff
 
Replies continue below

Recommended for you

I know this is not the exact answer that you're looking for, but starting with NX 8.0 it will be as simple as reading the Material Object Attribute assigned to the Body. Now technically you can do that today with NX 7.5, but until NX 8.0 there was no way to be sure that this attribute was actually reporting the true material assignment since prior to NX 8.0 there was no way of preventing someone from either deleting this attribute or worse yet, editing it manually giving you the impression that the material assignment was something different than what it actually is. Starting with NX 8.0 both the Material Part and Object attributes, once a material has been properly assigned, will be stored as 'Read-Only' meaning that they cannot be changed by using without actually reassigning a different material. What this will mean is that doing something as simple as reading an attribute will all that will be needed to determine what materials have been assigned to which bodies in your Part File.

Now with NX 7.5 you can still take this approach, just that there will be guarantee that the attribute that read will be correct. Now if you're pretty sure that people have NOT been messing with these Material attribute values, you can go ahead and use this approach now.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
jmarkus,

Here is one possible .Net implementation of John's suggested approach for NX7.5. It reports the MATERIAL attribute for the selected object(s).

HTH, Joe

Code:
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal

    Dim theSession As Session = Session.GetSession()

    Sub Echo(ByVal output As String)
        theSession.ListingWindow.Open()
        theSession.ListingWindow.WriteLine(output)
        theSession.LogFile.WriteLine(output)
    End Sub

    Sub ReportNXObjectAttributes(ByVal obj As NXObject)
        Dim mv As String = "unset"
        mv = obj.GetStringAttribute("MATERIAL")
        Echo ("Material = " + mv)

    End Sub

    Sub Main()

        Dim theSelection As Selection = UI.GetUI().SelectionManager
        For ii As Integer = 0 To theSelection.GetNumSelectedObjects() - 1
            ReportNXObjectAttributes(theSelection.GetSelectedTaggedObject(ii))
        Next

    End Sub
End Module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor