Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Journal (.NET) Remove Parameters Command

Status
Not open for further replies.

HynfiNX

Mechanical
Dec 4, 2009
24
Hello, would it be possible to modify the program below in order to remove parameters to any oject (solids, surfaces, curves and points) in the part file ?
Thank you


Sample NXOpen .NET Visual Basic program to remove parameters from all bodies in work part

Option Strict Off

Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities

Module remove_parameters_from_all_bodies_in_work_part

Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()

Sub Main()

Dim workPart As Part = s.Parts.Work
Dim myBodies As NXOpen.BodyCollection = workPart.Bodies
Dim bodytag(0) As NXOpen.Tag
Dim a_body As Body

For Each a_body In myBodies
bodytag(0) = a_body.Tag
ufs.Modl.DeleteObjectParms(bodytag)
Next

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function

End Module

Sandro Anderlini
Mould designer
Macerata - Italy
 
Replies continue below

Recommended for you

Yes, DeleteObjectParams() can do what you want. The GTAC example you posted will all ready remove parameters for sheets and solids so all thats missing is points and curves. A quick and dirty solution would be something like this,
Code:
Option Strict On

Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities

Module remove_parameters_from_all_bodies_in_work_part
    Dim s As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()

    Sub Main()
        Dim workPart As Part = s.Parts.Work
        Dim objectTag(0) As NXOpen.Tag

        Dim a_point As Point
        Dim a_curve As Curve
        Dim a_body As Body

        For Each a_point In workPart.Points
            objectTag(0) = a_point.Tag
            ufs.Modl.DeleteObjectParms(objectTag)
        Next

        For Each a_curve In workPart.Curves
            objectTag(0) = a_curve.Tag
            ufs.Modl.DeleteObjectParms(objectTag)
        Next

        For Each a_body In workPart.Bodies
            objectTag(0) = a_body.Tag
            ufs.Modl.DeleteObjectParms(objectTag)
        Next
    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
    End Function

End Module

// Petter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor