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!

NXOpen - Dual Dimensions

Status
Not open for further replies.

EngProgrammer

Aerospace
Jan 14, 2015
150
Dear Forum,

How do I find out if a dimension is dual dimensioned with NXOpen?
 
Replies continue below

Recommended for you

That's great. But I am cycling through the dimensions in the workpart. How do I get the
annotations properties of the "dimension" object. Code Snippet Below:


For Each myDim As Dimension In workpart.dimension
Dim editSettingsBuilder1 As NXOpen.Annotations.EditSettingsBuilder
editSettingsBuilder1 = DrumMaterialDrawingPart.SettingsManager.CreateAnnotationEditSettingsBuilder({myDim})
If Me.rbMetricOnly.Checked Then
editSettingsBuilder1.AnnotationStyle.UnitsStyle.DualDimensionFormat = NXOpen.Annotations.DualDimensionPlacement.None
Else
editSettingsBuilder1.AnnotationStyle.UnitsStyle.DualDimensionFormat = NXOpen.Annotations.DualDimensionPlacement.Below
End If
editSettingsBuilder1.Commit()
editSettingsBuilder1.Destroy()
Next
 
EngProgrammer said:
How do I find out if a dimension is dual dimensioned with NXOpen?

Check the value of the .DualDimensionFormat; if it is set to "None", it is not dual dimensioned. If it is set to one of the other styles, it is dual dimensioned.

www.nxjournaling.com
 
Hi Cowski,

I don't see "DualDimensionFormat" as a property of the dimension object.

I am cycling through all the dimension in the workpart using the loop below. I am not seeing "DualDimensionFormat" as a property or method of mydim object of a dimension class.


For myDim as dimension in workpart.dimensions



next
 
Looks like you can also get it through the dimension preferences.

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

Module Module2

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

    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "report dims")

        lw.Open()

        For Each tempDim As Annotations.Dimension In theSession.Parts.Work.Dimensions
            lw.WriteLine("tag: " & tempDim.Tag)

            If tempDim.GetDimensionPreferences.GetUnitsFormatPreferences.DualDimensionPlacement = Annotations.DualDimensionPlacement.None Then
                lw.WriteLine("-- not a dual dimension")
            Else
                lw.WriteLine("++ dual dimension")
            End If
            lw.WriteLine("")
        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

    End Function

End Module

www.nxjournaling.com
 
Aha. A double get. Good find. I was looking at the first level of the dimension class property under the "getUnitsFormarPreferences" but I was only looking at the properties I didn't check out the methods.

I like using this one instead of getting it from the builder. It makes sense because both of these classes are in the Annotations namespace.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor