Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Delete locked attribute

Status
Not open for further replies.

Martin898989

Mechanical
Sep 27, 2016
14
0
0
DE
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
 
Status
Not open for further replies.
Back
Top