Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Get the Suppresion status of Dimension using nxopen in NX11 1

Status
Not open for further replies.

ckadam

Mechanical
Dec 10, 2012
30
Hello All,

I am working with dimensions where I need to change Dimensions Unit style by NXopen Code which it is perfectly doing. Also, tool is listing all converted dimensions in spreadsheet. But, it is also converting dimensions which are suppressed :( . I need to find Suppressed property of each dimension and skip dimension if they are supressed. I can see NX12 has that functionality, any work around for current NX11 Users?

Chetak Kadam
Siemens Energy
NX11.0.2.7
C#.NET

Chetak
Engineering Design / Knowledge Based Engineering
NX8.5, TC8.5.3.3, Win 7 Pro SP1
 
Replies continue below

Recommended for you

What exactly do you mean by a "suppressed dimension" (suppress drafting object)? Can you upload a simple example file with one or more of these dimensions?

www.nxjournaling.com
 
I found some old code I have that reports if a dimension is controlled by an expression for suppression.

Code:
'NXJournaling.com
'October 5, 2016

'Determine if there is an expression that controls a dimension (the controlling dimension determines if the dimension is suppressed or not).

'[URL unfurl="true"]http://nxjournaling.com/comment/3944#comment-3944[/URL]

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, "NXJ")

        lw.Open()

        'find dimensions that are controlled (suppress/unsuppress) by expression
        For Each temp As Annotations.Dimension In theSession.Parts.Work.Dimensions
            'Dim expTag As Tag = Tag.Null
            'theUfSession.Drf.AskAssocExp(temp.Tag, expTag)
            'If Not expTag = Tag.Null Then
            '    lw.WriteLine("dim: " & temp.Tag.ToString & " exp tag: " & expTag.ToString)
            'Else
            '    lw.WriteLine("dim: " & temp.Tag.ToString & " no associated expression")
            'End If

            Dim controllingExpTag As Tag = Tag.Null
            theUfSession.Drf.AskControllingExp(temp.Tag, controllingExpTag)
            If Not controllingExpTag = Tag.Null Then
                Dim controllingExp As Expression = Utilities.NXObjectManager.Get(controllingExpTag)
                lw.WriteLine("dimension tag: " & temp.Tag.ToString & " controlling expression tag: " & controllingExpTag.ToString)
                lw.WriteLine("  " & controllingExp.Name & " = " & controllingExp.RightHandSide)
                'expression value = 0: object suppressed
                'expression value = 1: object unsuppressed
            Else
                lw.WriteLine("dim: " & temp.Tag.ToString & " no controlling expression")
            End If

        Next

        'find drafting objects that are controlled by expression (suppress/unsuppress)
        For Each tempExp As Expression In theSession.Parts.Work.Expressions
            Dim numObjs As Integer
            Dim objTags() As Tag = Nothing
            theUfSession.Drf.AskObjectsControlledByExp(tempExp.Tag, numObjs, objTags)

            If numObjs > 0 Then
                lw.WriteLine("expression: " & tempExp.Name)
                For Each tempTag As Tag In objTags
                    lw.WriteLine("  controlled object tag: " & tempTag.ToString)
                Next
                lw.WriteLine("")
            End If
        Next


        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

        '----Other unload options-------
        'Unloads the image when the NX session terminates
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

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

    End Function

End Module

www.nxjournaling.com
 
Thanks cowski,
It solved my issue with Dimensions with Suppressed condition. Any leads on how to skip the Un-associated dimensions out of this loop?

Chetak
SIEMENS ENERGY / Knowledge Based Engineering
NX11.0.2.7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor