cancel
Showing results for 
Search instead for 
Did you mean: 

Getting vertices of a suppressed Edge.

Builder
Builder

In the case of a block.

A block has a chamfer.

And that chamfer has an edge that was used to place the chamfer.

The edge is now suppressed.

Is there away to get the vertices corresponding to the edge even though it is suppressed?

1 REPLY

Re: Getting vertices of a suppressed Edge.

Honored Contributor
Honored Contributor

This should probably be a continuation of your previous thread rather than a new one.

 

To get the edge information, I'd suggest rolling back to the feature before the chamfer was applied to get the info.

 

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module2

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession
        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)

        Dim curFeature As Features.Feature = Nothing
        Dim curFeatTag As Tag = Tag.Null
        theUfSession.Modl.AskCurrentFeature(workPart.Tag, curFeatTag)
        curFeature = Utilities.NXObjectManager.Get(curFeatTag)
        Dim prevFeature As Features.Feature = Nothing

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

                prevFeature.MakeCurrentFeature()

                For Each tempEdge As Edge In chamferEdges
                    lw.WriteLine("input type: " & tempEdge.GetType.ToString)
                    lw.WriteLine("input tag: " & tempEdge.Tag.ToString)
                    Dim pt1 As Point3d
                    Dim pt2 As Point3d
                    tempEdge.GetVertices(pt1, pt2)
                    lw.WriteLine("point 1: " & pt1.ToString)
                    lw.WriteLine("point 2: " & pt2.ToString)
                    lw.WriteLine("")
                Next

                curFeature.MakeCurrentFeature()

            End If
            prevFeature = temp
        Next

        curFeature.MakeCurrentFeature()

        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