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!

Delete locked attribute

Status
Not open for further replies.

Martin898989

Mechanical
Sep 27, 2016
14
Hi,

I have created this attribute. Any chance to delete it? Thank you

Screenshot_2022-10-08_074202_c22gqx.png
 
Replies continue below

Recommended for you

Hello,

Only with journaling you will unlock.
Folow a sample code I use to do it.

Code:
Option Strict On
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI

Module Unlock

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

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim displayPart As Part = theSession.Parts.Display

        If workPart Is Nothing Then Return

        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Unlock")
        ' ----------------------------------------------
        Dim p As BasePart = workPart

        If Not SelectText() Then
            Return
        End If

        Try
            p.SetUserAttributeLock(text, NXObject.AttributeType.Any, False)
        Catch ex As Exception
        End Try


    End Sub

    Function SelectText() As Boolean

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim theUISession As UI = UI.GetUI
        Dim answer As String = ""

        SelectText = False

        text = InputBox("Digite a Propriedade para Unlock", "UNLOCK Properties", "")
        'text = NXInputBox.GetInputString("prompt", "title bar caption", "initial text")

        If text.Length <> 0 Then
            SelectText = True
        End If

    End Function

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
    End Function

End Module

Gelson Z. Nicoletto
V.18-NX1980
 
Hi I was creating your text in a .cs file and added it in journal. it was not working. i am very new to journal :/

Thank you
Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor