Set Tags to edges

Hello everyone,

I need your help in a situation I'm struggling with.

I want to Tag the edges of holes in a component I have. I want to do this by a Journal because the number of edges its quite high (around 200) so I want to tag them via Journal.

Thank you.

I didn't mean to assign Tags, but to assign names (e.g. hole1, hole2, hole3, etc), Then I'll use this as Tags.

Thanks

Automative

You want to find all the hole features in the part and give the edges custom names, is this correct?

Here is a simple journal that will name the edges of hole features.




Option Strict Off
Imports System
Imports NXOpen

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Const holeNamePrefix As String = "hole"
Dim counter As Integer = 1

For Each tempFeat As Features.Feature In workPart.Features

If TypeOf (tempFeat) Is Features.HolePackage Then
Dim theHole As Features.HolePackage = tempFeat
For Each tempEdge As Edge In theHole.GetEdges
tempEdge.SetName(holeNamePrefix & counter.ToString)
Next
counter += 1
End If

Next

'turn on object names in the work view
workPart.Preferences.NamesBorderVisualization.ObjectNameDisplay = Preferences.PartVisualizationNamesBorders.NameDisplay.WorkView

End Sub

End Module

First of all thank you very much for responding.

Unfortunately the code didn't work. I used a MsgBox to display the counter and its always 1.

I didn't model the component. I think maybe the holes are not a hole feature. Its there a way to know this?

Thank you.

Automative

The journal worked perfect in another component. But it named the whole hole, i just want to name the edges or the arc.
I'll make some adjustments to the journal you posted and see what happens.

thank you.

Automative

Actually, the code only names the edges, but it will name every edge that belongs to the hole. It may appear to have named the hole itself, but it has not.