cancel
Showing results for 
Search instead for 
Did you mean: 

Getting defining edge of a chamfer

Builder
Builder

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?

2 REPLIES

Re: Getting defining edge of a chamfer

Phenom
Phenom

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

Phenom
Phenom

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
            Return
        End If

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

        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
                lw.WriteLine(temp.GetFeatureName)
                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)

                chamferBuilder1.Destroy()

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

            End If
        Next

        lw.Close()

    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