Showing results for 
Search instead for 
Do you mean 

Getting defining edge of a chamfer

You have a Block "bl".

And you make a standard chamfer and one corner/edge.

Is there away to get the identity of the edge that made the chamfer?


Re: Getting defining edge of a chamfer

I'm pretty sure that you could get a reference to the edge from the chamfer feature's .GetSections method.

Re: Getting defining edge of a chamfer

Whoops, .GetSections was a bit off base. Use the .SmartCollector of the chamfer builder object instead.


Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow

        Const undoMarkName As String = "report chamfer edge"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        For Each temp As Features.Feature In workPart.Features
            If TypeOf (temp) Is NXOpen.Features.Chamfer Then
                Dim chamferBuilder1 As Features.ChamferBuilder
                chamferBuilder1 = workPart.Features.CreateChamferBuilder(temp)

                Dim scCollector1 As ScCollector
                scCollector1 = chamferBuilder1.SmartCollector

                Dim chamferEdges() As TaggedObject = scCollector1.GetObjects
                lw.WriteLine("objects: " & chamferEdges.Length.ToString)


                For Each tempEdge As TaggedObject In chamferEdges
                    lw.WriteLine("input type: " & tempEdge.GetType.ToString)
                    lw.WriteLine("input tag: " & tempEdge.Tag.ToString)

            End If


    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