Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove TINY OBJECTS in NX UG? 1

Status
Not open for further replies.

pratyu

Aerospace
Oct 25, 2012
47
The part I'm working on is a Curve>Extract from bodies... I would like to delete the TINY OBJECTS (defined as dimension .025 inch) appearing on my window.

Please help!
 
They are lines, splines, arcs & curves (FymI)
 
before you extract curves from bodies perform a file->export ->heal geometrie
the distance can improve / optimze the extracted curves from body on the healed body
 
Here's a quick journal that will delete curves smaller than a value you specify.

Code:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim smallCurves As New List(Of Curve)

        '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        '%% curves less than or equal to the following length will be deleted
        '%% change this value to your requirement
        Const smallCurveCutoff As Double = 0.025
        '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        For Each tempCurve As Curve In workPart.Curves

            If tempCurve.GetLength <= smallCurveCutoff Then
                smallCurves.Add(tempCurve)
            End If

        Next

        If smallCurves.Count > 0 Then

            Dim markId1 As Session.UndoMarkId
            markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete small curves")

            Dim notifyOnDelete1 As Boolean
            notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete

            theSession.UpdateManager.ClearErrorList()

            Dim nErrs1 As Integer
            nErrs1 = theSession.UpdateManager.AddToDeleteList(smallCurves.ToArray)

            Dim notifyOnDelete2 As Boolean
            notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete

            Dim nErrs2 As Integer
            nErrs2 = theSession.UpdateManager.DoUpdate(markId1)

        End If


    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

        '----Other unload options-------
        'Unloads the image immediately after execution within NX
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------

    End Function

End Module

www.nxjournaling.com
 
Thanks a lot! It worked!! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor