NXOPEN - JAVA
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?
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:
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.
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?
"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?
Get the orientation of the components and compare the hole feature attributes for position based on the coordinate system of the components.
Production: NX10.0.3, VERICUT 8.1, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk Testing: NX12.0 Preparing: NX12.0
Employees of the customers, together we are strong
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide
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") lw.Open() Dim allOccFaces As New List(Of Face) Dim theFace As Face = Nothing If SelectFace("select face", theFace) = Selection.Response.Cancel Then Return End If Dim protoFace As Face = Nothing If theFace.IsOccurrence Then protoFace = theFace.Prototype Else 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 Try newObj = Utilities.NXObjectManager.Get(temp) If TypeOf (newObj) Is NXOpen.Face Then Dim newFace As Face = newObj allOccFaces.Add(newFace) newFace.Highlight() End If Catch ex As Exception 'lw.WriteLine(" error: " & ex.Message) End Try Next theUfSession.Disp.MakeDisplayUpToDate() MsgBox("other face occurrences highlighted") For Each temp As Face In allOccFaces temp.Unhighlight() Next lw.Close() 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 Else 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