Showing results for 
Search instead for 
Did you mean: 

Features on different layers

Valued Contributor
Valued Contributor




I got two different orientations (layers) of the same part.

I run the "Find Features" option on each layer separately (STEP1HOLE only).

is there a way to tell for each STEP1HOLE feature on the first layer, who is the matching STEP1HOLE feature on the second layer?







Re: Features on different layers

Valued Contributor
Valued Contributor


You can check the important parameters of hole feature in 1st layer, 

Then you can run a for loop for hole feature in second layer; if the parameters of hole feature of 1st layer match with any of the hole feature of second layer, you found the match.


As an example,

1st hole feature important parameter:

1. Diameter

2. Depth of the hole


Now run for loop for second component, and in hole features array, search for a hole with same diameter and depth,

if both matches they are same.




Re: Features on different layers

Valued Contributor
Valued Contributor

Unfortenetaly this method won't work in case of identical holes.

I'm looking to achieve one to one match.

Re: Features on different layers

Valued Contributor
Valued Contributor

Is there a way maybe to add to each feature a new attributes with a uniques values?


Something like this:

Define 3 points on the part P1, P2, P3 and give to each feature the right value from those points.

If it will solve the problem, those anyone have a clue I can I do this?




Re: Features on different layers

Valued Contributor
Valued Contributor
May I know which feature you use to create "Identical holes"?

Re: Features on different layers

Valued Contributor
Valued Contributor

I just define holes with the same attributes: depth, diameter, roughness...

Re: Features on different layers


"I got two different orientations (layers) of the same part."


I take this to mean that you have modeled a part and now you have created an assembly and added this part as a component in two different locations (and layers). Is this correct?

Re: Features on different layers

Valued Contributor
Valued Contributor

Yes, this is correct.

Re: Features on different layers

Esteemed Contributor
Esteemed Contributor

Get the orientation of the components and compare the hole feature attributes for position based on the coordinate system of the components.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 ( | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Features on different layers


Below is a rough journal that will prompt you to select a face then it will highlight the corresponding faces in the other component instances.


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


        Dim allOccFaces As New List(Of Face)

        Dim theFace As Face = Nothing
        If SelectFace("select face", theFace) = Selection.Response.Cancel Then
        End If

        Dim protoFace As Face = Nothing
        If theFace.IsOccurrence Then
            protoFace = theFace.Prototype
            protoFace = theFace
        End If

        Dim faceOccs() As Tag = Nothing
        theUfSession.Assem.AskOccsOfEntity(protoFace.Tag, faceOccs)

        For Each temp As Tag In faceOccs

            If temp = Tag.Null Then
                Continue For
            End If

            Dim newObj As TaggedObject = Nothing
                newObj = Utilities.NXObjectManager.Get(temp)
                If TypeOf (newObj) Is NXOpen.Face Then
                    Dim newFace As Face = newObj
                End If
            Catch ex As Exception
                'lw.WriteLine("  error: " & ex.Message)

            End Try

        MsgBox("other face occurrences highlighted")
        For Each temp As Face In allOccFaces


    End Sub

    Function SelectFace(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select an object"
        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_ANY_FACE
        End With

        Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(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
            Return Selection.Response.Cancel
        End If

    End Function

    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