×
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

NX 7.5 - Export assembly BOM with part COG's

NX 7.5 - Export assembly BOM with part COG's

NX 7.5 - Export assembly BOM with part COG's

(OP)
Hi there. I am trying to get a report (that I can put into excel) of all the parts in an assembly and each parts' mass and Centre of Gravity position in relation to the Assembly UCS. I have no problem getting a report with mass (>Information>Assemblies>List Components), but I can't seem to get it to include the CofG in the list. Alternatively, if I could add the x, y & z CofG positions to the columns in the assembly navigator, I could export this to spreadsheet, but have been unable to find a way to do so.

Any help you could provide would be appreciated.

Thanks

RE: NX 7.5 - Export assembly BOM with part COG's

This is something which would be better addressed with a simple NX Open program.

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.

RE: NX 7.5 - Export assembly BOM with part COG's

Here is a small journal that will allow you to select a component and will assign COG_X, COG_Y, and COG_Z attributes to the component (relative to the WCS of the assembly). You can add these attributes to your assembly navigator to allow export to a spreadsheet.

A couple of warnings:
  1. The measurements are not associative. When the part or its position within the assembly changes, you'll have to rerun the journal.
  2. The output units are pounds inches; this can easily be changed in the journal.
  3. COG coordinates are reported relative to the assembly's current WCS.
  4. The journal is a starting point, it currently has no error checking.

CODE

Option Strict Off  
Imports System  
Imports NXOpen  
Imports NXOpen.UF  

Module Module1  

    Dim theSession As Session = Session.GetSession()  
    Dim ufs As UFSession = UFSession.GetUFSession()  
    Dim workPart As Part = theSession.Parts.Work  
    Dim selObj As NXObject = Nothing  

    Enum AnalysisType As Integer  
        solidBody = 1  
        thinShellSheetBody = 2  
        boundedBySheetBodies = 3  
    End Enum  

    Enum AnalysisUnits As Integer  
        poundsInches = 1  
        poundsFeet = 2  
        gramsCm = 3  
        kilogramMeter = 4  
    End Enum  

    Enum AnalysisAccuracy As Integer  
        useAccuracy = 1  
        useRelativeTolerance = 2  
    End Enum  

    Sub Main()  

        Dim dblAcc_Value(11) As Double  
        Dim dblMass_Props(46) As Double  
        Dim dblStats(12) As Double  
        Dim strOutput As String = ""  

        If SelectAComponent("Select a component", selObj) = Selection.Response.Cancel Then  
            Exit Sub  
        End If  

        Dim tagList(0) As NXOpen.Tag  
        tagList(0) = selObj.Tag  
        dblAcc_Value(0) = 0.99  

        ufs.Modl.AskMassProps3d(tagList, 1, AnalysisType.solidBody, AnalysisUnits.poundsInches, 0.0375, AnalysisAccuracy.useAccuracy, dblAcc_Value, dblMass_Props, dblStats)  

 'strOutput = "Surface Area: " & dblMass_Props(0) & vbCrLf
 'strOutput = strOutput & "Volume: " & dblMass_Props(1) & vbCrLf
 'strOutput = strOutput & "Mass: " & dblMass_Props(2) & vbCrLf
 'strOutput = strOutput & "COG: " & dblMass_Props(3) & ", " & dblMass_Props(4) & ", " & dblMass_Props(5) & vbCrLf
 'strOutput = strOutput & "Density: " & dblMass_Props(46)
 'MsgBox(strOutput, vbOKOnly)

        selObj.OwningComponent.SetAttribute("COG_X", dblMass_Props(3))  
        selObj.OwningComponent.SetAttribute("COG_Y", dblMass_Props(4))  
        selObj.OwningComponent.SetAttribute("COG_Z", dblMass_Props(5))  

    End Sub  

    Function SelectAComponent(ByVal prompt As String, ByRef selObj As NXObject) As Selection.Response  

        Dim theUI As UI = UI.GetUI  
        Dim title As String = "Select a component"  
        Dim includeFeatures As Boolean = False  
        Dim keepHighlighted As Boolean = False  
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific  
        Dim cursor As Point3d  
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly  
        Dim selectionMask_array(0) As Selection.MaskTriple  

        With selectionMask_array(0)  
            .Type = UFConstants.UF_solid_type  
            .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY  
        End With  

        Dim resp As Selection.Response = theUI.SelectionManager.SelectObject(prompt, title, scope, selAction, includeFeatures, keepHighlighted, selectionMask_array, selObj, cursor)  
        If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then  
            Return Selection.Response.Ok  
        Else  
            Return Selection.Response.Cancel  
        End If  

    End Function  


    Public Function GetUnloadOption(ByVal dummy As String) As Integer  

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

    End Function  

End Module 

www.nxjournaling.com

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