Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX 9 Problem with Datum CSYS feature

Status
Not open for further replies.

petulf

Mechanical
Aug 12, 2009
210
Hi

We use a few thousand offset Datum CSYS features in our designs to primarily control hole positions of complex fluid networks, thus it is very important to us that we can quickly and accurately move them around.

Our standard method in NX 7.5 and NX 8.5 was to change the Datum CSYS feature type from offset CSYS to dynamic, move the CSYS to the new positon and then change it back to offset CSYS. This has worked very well especially compared to the work flow in I-deas where we first had to measure and then modify the offset values.

But in NX9 this method has stopped working as the selected reference CSYS is lost when changing the type of the Datum CSYS feature from offset to Dynamic. We have contacted GTAC about this issue (PR 8252994) but have heard nothing for 7 months. I suspect that this is a minor UI issue relating to the update method for the Datum CSYS dialog, but with major consequences for my design department.

My questions to eng-tips are;
[ul]
[li]Is this behavior present in NX 10?[/li]
[li]Anybody got ideas for a workaround?[/li]
[/ul]


Below follows a step by step example first of the desired behavior in NX8.5 and then the undesired behavior in NX9, I have also attached movies showcasing the same in NX7.5, 8.5 and 9.0.

NX 8.5 Step 01 - CSYS Feature that is offset from another Datum CSYS in ABS zero.
St5FduI.png


NX 8.5 Step 02 - Editing the datum CSYS feature and changing type from Offset to Dynamic to quickly move it.
T0ruFVK.png


NX 8.5 Step 03 - Moving the Datum CSYS with the dynamic CSYS tool.
k4zwI5y.png


NX 8.5 Step 04 - Changing the type back to offset keeps the reference to the ABS datum CSYS feature.
jmlC5EZ.png


NX 9 Step 01 - Same Setup as in NX 8.5 Step 01.
5WIotXc.png


NX 9 Step 02 - Editing the offset Datum CSYS feature.
lKpODIH.png


NX 9 Step 03 - Changing the type from offset to dynamic resets the Reference CSYS selection and it is not possible to quickly move the offset CSYS. Selecting a new reference CSYS and all offset values are lost.
Hdmi4kd.png


I have performed the same test in the following NX versions

NX 7.5.5.4 MP9 - No problem
NX 8.5.3.3 - No Problem
NX 9.0.3.4 MP6 - Problem is present in all N9 Releases
 
Replies continue below

Recommended for you

If this workflow is as critical as you make it appear from your presentation here, then it's possible that your PR was not given the proper priority. I checked and it's listed as 'Priority 2 (Serious)' rather than 'Priority 1 (critical)'. Since this is a regression, generally speaking, the only way this PR would have been given a 'Priority 2' rating is because someone must have stated that there was a workaround or that it was not critical with respect to doing your job. If this not the case, please contact GTAC and ask that they upgrade your PR to a 'Priority 1 (Critical)' rating.

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

To an Engineer, the glass is twice as big as it needs to be.
 
Did GTAC offer any kind of work-around?
If not, perhaps this journal will help. It will prompt you to select a datum csys feature. If the datum csys is associatively offset from another csys, it will convert the chosen datum csys to type 'dynamic' while preserving the parent offset csys.

You will then be able to move the datum csys with the manipulator handles before converting it back to an offset type datum csys.

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

Module Module1

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

    Dim lw As ListingWindow = theSession.ListingWindow

    Dim init_proc_ref As UFUi.SelInitFnT = AddressOf init_proc_body
    Dim filter_proc_ref As UFUi.SelFilterFnT = AddressOf datumCsys_feature_filter

    Sub Main()

        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "datum csys offset to dynamic"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim myDatumCsys As Features.Feature = SelectDatumCsysFeature("Select datum csys feature")

        Dim csysTag As Tag
        Dim originTag As Tag
        Dim daxesTags(2) As Tag
        Dim dplanesTags(2) As Tag
        theUfSession.Modl.AskDatumCsysComponents(myDatumCsys.Tag, csysTag, originTag, daxesTags, dplanesTags)
        Dim theCsys As CoordinateSystem = Utilities.NXObjectManager.Get(csysTag)

        Dim soParents As New List(Of SmartObject)
        GetSmartParents(theCsys, soParents)

        Dim dcOffset As Offset = GetOffset(soParents)
        If IsNothing(dcOffset) Then
            'datum csys does not have an associative offset
            Return
        End If

        Dim dcParentCsys As CartesianCoordinateSystem = GetCoordinateSystem(soParents)
        If IsNothing(dcParentCsys) Then
            'datum csys is not associated to another csys
            Return
        End If

        Dim markId2 As Session.UndoMarkId
        markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Redefine Feature")

        Dim datumCsysBuilder1 As Features.DatumCsysBuilder
        datumCsysBuilder1 = workPart.Features.CreateDatumCsysBuilder(myDatumCsys)

        Dim originOffset1 As Vector3d = GetOffsetVector(dcParentCsys, datumCsysBuilder1.Csys)
        Dim trasformMatrix1 As Matrix3x3 = GetTransformMatrix(dcParentCsys, datumCsysBuilder1.Csys)

        Dim xform1 As Xform
        xform1 = workPart.Xforms.CreateXformByDynamicOffset(dcParentCsys, originOffset1, trasformMatrix1, SmartObject.UpdateOption.WithinModeling, 1.0)

        Dim cartesianCoordinateSystem2 As CartesianCoordinateSystem
        cartesianCoordinateSystem2 = workPart.CoordinateSystems.CreateCoordinateSystem(xform1, SmartObject.UpdateOption.WithinModeling)

        datumCsysBuilder1.Csys = cartesianCoordinateSystem2

        Dim nXObject1 As NXObject
        nXObject1 = datumCsysBuilder1.Commit()

        datumCsysBuilder1.Destroy()

        Dim nErrs1 As Integer
        nErrs1 = theSession.UpdateManager.DoUpdate(markId2)

        theSession.UpdateManager.InterpartDelay = False

        theSession.DeleteUndoMark(markId2, Nothing)


        lw.Close()

    End Sub

    Function SelectDatumCsysFeature(ByRef prompt As String) As Features.Feature

        Dim response As Integer = 0
        Dim objs() As Tag = Nothing
        Dim user_data As System.IntPtr
        Dim selDCsys As Tag = Nothing
        Dim cursor(2) As Double
        Dim view As Tag = Nothing

        theUfSession.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)

        Try
            theUfSession.Ui.SelectWithSingleDialog("Select Datum Csys: ", prompt, _
                UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY, init_proc_ref, _
                user_data, response, selDCsys, cursor, view)
        Finally
            theUfSession.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
        End Try

        If Not selDCsys.Equals(Tag.Null) Then
            Dim myDatumCsys As Features.Feature
            theUfSession.Disp.SetHighlight(selDCsys, 0)
            myDatumCsys = Utilities.NXObjectManager.Get(selDCsys)
            Return myDatumCsys
        Else
            Return Nothing
        End If

    End Function

    Function init_proc_body(ByVal select_ As IntPtr, _
                              ByVal userdata As IntPtr) As Integer

        Dim num_triples As Integer = 1
        Dim mask_triples As UFUi.Mask() = New UFUi.Mask(0) {}
        mask_triples(0).object_type = UFConstants.UF_feature_type
        mask_triples(0).object_subtype = 0
        mask_triples(0).solid_type = 0

        theUfSession.Ui.SetSelMask(select_, _
                          UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, _
                          num_triples, mask_triples)

        theUfSession.Ui.SetSelProcs(select_, filter_proc_ref, Nothing, userdata)

        Return UFConstants.UF_UI_SEL_SUCCESS

    End Function

    Function datumCsys_feature_filter(ByVal _object As Tag, _
                                        ByVal type As Integer(), _
                                        ByVal user_data As IntPtr, _
                                        ByVal select_ As IntPtr) As Integer

        Dim myFeature As Features.Feature = Nothing
        myFeature = Utilities.NXObjectManager.Get(_object)
        If myFeature.FeatureType = "DATUM_CSYS" Then
            Return UFConstants.UF_UI_SEL_ACCEPT
        Else
            Return UFConstants.UF_UI_SEL_REJECT
        End If

    End Function

    Sub GetSmartParents(ByVal theSmartObject As SmartObject, ByRef theSmartObjectList As List(Of SmartObject))

        Dim numParents As Integer
        Dim theParentTags() As Tag = Nothing

        Try
            theUfSession.So.AskParents(theSmartObject.Tag, UFConstants.UF_SO_ASK_SO_PARENTS, numParents, theParentTags)

            For Each tempTag As Tag In theParentTags
                Dim objParent As TaggedObject = Utilities.NXObjectManager.Get(tempTag)

                theSmartObjectList.Add(objParent)
                GetSmartParents(objParent, theSmartObjectList)

            Next

        Catch ex As NXException
            lw.WriteLine("error: " & ex.ErrorCode)
            lw.WriteLine("  " & ex.Message)
        End Try


    End Sub

    Function GetOffset(ByVal theList As List(Of SmartObject)) As Offset

        For Each temp As SmartObject In theList
            If TypeOf (temp) Is Offset Then
                Return temp
            End If
        Next

        Return Nothing

    End Function

    Function GetCoordinateSystem(ByVal theList As List(Of SmartObject)) As CartesianCoordinateSystem

        For Each temp As SmartObject In theList
            If TypeOf (temp) Is CartesianCoordinateSystem Then
                Return temp
            End If
        Next

        Return Nothing

    End Function

    Function GetXform(ByVal theList As List(Of SmartObject)) As Xform

        For Each temp As SmartObject In theList
            If TypeOf (temp) Is Xform Then
                Return temp
            End If
        Next

        Return Nothing

    End Function

    Function GetTransformMatrix(ByVal fromCsys As CartesianCoordinateSystem, ByVal toCsys As CartesianCoordinateSystem) As Matrix3x3

        Dim fromOrigin() As Double = {fromCsys.Origin.X, fromCsys.Origin.Y, fromCsys.Origin.Z}
        Dim fromXAxis() As Double = {fromCsys.Orientation.Element.Xx, fromCsys.Orientation.Element.Xy, fromCsys.Orientation.Element.Xz}
        Dim fromYAxis() As Double = {fromCsys.Orientation.Element.Yx, fromCsys.Orientation.Element.Yy, fromCsys.Orientation.Element.Yz}

        Dim toOrigin() As Double = {toCsys.Origin.X, toCsys.Origin.Y, toCsys.Origin.Z}
        Dim toXAxis() As Double = {toCsys.Orientation.Element.Xx, toCsys.Orientation.Element.Xy, toCsys.Orientation.Element.Xz}
        Dim toYAxis() As Double = {toCsys.Orientation.Element.Yx, toCsys.Orientation.Element.Yy, toCsys.Orientation.Element.Yz}

        Dim mtx4Transform(15) As Double

        theUfSession.Mtx4.CsysToCsys(fromOrigin, fromXAxis, fromYAxis, toOrigin, toXAxis, toYAxis, mtx4Transform)

        Dim transformMatrix1 As Matrix3x3
        transformMatrix1.Xx = mtx4Transform(0)
        transformMatrix1.Xy = mtx4Transform(4)
        transformMatrix1.Xz = mtx4Transform(8)
        transformMatrix1.Yx = mtx4Transform(1)
        transformMatrix1.Yy = mtx4Transform(5)
        transformMatrix1.Yz = mtx4Transform(9)
        transformMatrix1.Zx = mtx4Transform(2)
        transformMatrix1.Zy = mtx4Transform(6)
        transformMatrix1.Zz = mtx4Transform(10)

        Return transformmatrix1

    End Function

    Function GetOffsetVector(ByVal fromCsys As CartesianCoordinateSystem, ByVal toCsys As CartesianCoordinateSystem) As Vector3d

        Dim fromOrigin() As Double = {fromCsys.Origin.X, fromCsys.Origin.Y, fromCsys.Origin.Z}
        Dim fromXAxis() As Double = {fromCsys.Orientation.Element.Xx, fromCsys.Orientation.Element.Xy, fromCsys.Orientation.Element.Xz}
        Dim fromYAxis() As Double = {fromCsys.Orientation.Element.Yx, fromCsys.Orientation.Element.Yy, fromCsys.Orientation.Element.Yz}

        Dim toOrigin() As Double = {toCsys.Origin.X, toCsys.Origin.Y, toCsys.Origin.Z}
        Dim toXAxis() As Double = {toCsys.Orientation.Element.Xx, toCsys.Orientation.Element.Xy, toCsys.Orientation.Element.Xz}
        Dim toYAxis() As Double = {toCsys.Orientation.Element.Yx, toCsys.Orientation.Element.Yy, toCsys.Orientation.Element.Yz}

        Dim mtx4Transform(15) As Double

        theUfSession.Mtx4.CsysToCsys(fromOrigin, fromXAxis, fromYAxis, toOrigin, toXAxis, toYAxis, mtx4Transform)

        Dim theOffset As Vector3d
        theOffset.X = mtx4Transform(3)
        theOffset.Y = mtx4Transform(7)
        theOffset.Z = mtx4Transform(11)

        Return theOffset

    End Function

    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
 
John: Thanks Did not even reflect on the Priority level, I have contacted our Siemens reseller that were the ones that opened the PR and have asked them to contact GTAC and request an upgrade of the priority.

Cowski: Thanks a lot! Very clever and simple approach.
 
OK, I've got an update on the status of this PR. It has been fixed and will be part of NX 10.0.3.x, which will be released later in the year.

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

To an Engineer, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor