×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Show and hide. Separate buttons

Show and hide. Separate buttons

Show and hide. Separate buttons

(OP)
Hi all,

In the menu Show and hide i use most of the time only sketch, assembly constrains and coordinate systems.
Is there a way to make separate buttons in an toolbar to show and hide directly all sketches or the assembly constrains? I don't like it to open the menu first every time.
I've searched for it but i can't find single commands for it.

Thanks in advance,
Tjeerd

Using NX 8.0 on Windows 7 (64)

RE: Show and hide. Separate buttons

Will a CTRL+W work for you?

RE: Show and hide. Separate buttons

(OP)
Thank you for your answer thumbsup2, but no, i would like separate buttons.

Using NX 8.0 on Windows 7 (64)

RE: Show and hide. Separate buttons

I have separate hide/show (blank/unblank) buttons on all my toolbars in NX7.5, they are very handy.

Please don't tell me we will now have to hunt for them in some stinking ribbon menu..! Bah humbug..

Proud Member of the Reality-Based Community..

To the Toolmaker, your nice little cartoon drawing of your glass looks cool, but your solid model sucks. Do you want me to fix it, or are you going to take all week to get it back to me so I can get some work done?

RE: Show and hide. Separate buttons

Well, as for Assembly Constraints, they can be toggled ON/OFF by selecting the 'Constraints' item in the Assembly Navigator and pressing MB3. As for the others, you can create a few Journals covering the specific object types, and then add icons to a toolbar which will execute the journals when selected.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Show and hide. Separate buttons

(OP)
Thanks for the answers.
But the disadvantage of making journals is that I get two buttons, one to turn sketches off, and one to turn sketches on again.
There is no way to have one button to turn it off and on again?

From Capnhook i understand that he has it working, but that i can't ask how it works.

Using NX 8.0 on Windows 7 (64)

RE: Show and hide. Separate buttons

If you want to 'toggle' the Hide/Show status of some class of objects, you'll have to create an NX Open program to do that since there are NO interactive functions which does anything like that so it would have to be user-written. And trust me, if anyone else says they've accomplished this without writing some 'program', don't believe it. Certainly there is NOTHING in what capnhook stated that would leave one with the impression that he has somehow accomplished this feat. And his comment about about not being able to have in NX 9.0 whatever he CLAIMS to have in NX 7.5 is just not true.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: Show and hide. Separate buttons

Here's some code that should toggle sketch visibility (hidden vs. shown). It uses a part attribute to save what happened the last time it was run. If the attribute is not found, it is created and it will show all available sketches; subsequent runs will toggle the sketch visibility. The journal does not change layer state: if a sketch is on an invisible layer, it will not make the layer visible, but it will alter the sketch hidden status.

CODE

Option Strict Off  
Imports System  
Imports NXOpen  

Module Module2  

    Dim theSession As Session = Session.GetSession()  
    Dim workPart As Part = theSession.Parts.Work  
    Dim sketchAttribute As String = "SketchVisibility"  

    Sub Main()  

        Dim sketchesVisible As Boolean = False  

        Try  
            sketchesVisible = workPart.GetBooleanUserAttribute(sketchAttribute, 0)  

        Catch ex As NXException  
            If ex.ErrorCode = 512008 Then  
           'attribute not found
                workPart.SetBooleanUserAttribute(sketchAttribute, 0, False, Update.Option.Later)  
            Else  
           'unexpected error
                MsgBox(ex.ErrorCode & " : " & ex.Message)  
                Return  
            End If  
        End Try  

        If sketchesVisible Then  
            HideSketches()  
        Else  
            ShowSketches()  
        End If  

    End Sub  

    Sub ShowSketches()  

        For Each theSketch As Sketch In workPart.Sketches  
            theSketch.Unblank()  
        Next  

        workPart.SetBooleanUserAttribute(sketchAttribute, 0, True, Update.Option.Later)  

    End Sub  

    Sub HideSketches()  

        For Each theSketch As Sketch In workPart.Sketches  
            theSketch.Blank()  
        Next  

        workPart.SetBooleanUserAttribute(sketchAttribute, 0, False, Update.Option.Later)  

    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

RE: Show and hide. Separate buttons

(OP)
Thank you for the answers.

I've never used code like this, so i don't know what to do with it. If it's simple i will give it a try.
Can i put this code in a journal file and create a button that runs that journal file?

(Till now i only made a few macro's and an toolbar .tbr file)

Using NX 8.0 on Windows 7 (64)

RE: Show and hide. Separate buttons

Quote (VW181)

Can i put this code in a journal file and create a button that runs that journal file?

Open a plain text editor, such as notepad, copy and paste the code into the editor. Save the file with a meaningful name and change the extension from .txt to .vb. You now have a journal file that you can use in NX. You can then add a custom button to run the journal.

www.nxjournaling.com

RE: Show and hide. Separate buttons

(OP)
Ok, tanks Cowski.
So it's a similar way like a macro. Then the rest should be easy.
Gonna test this tomorrow.

Using NX 8.0 on Windows 7 (64)

RE: Show and hide. Separate buttons

In conclusion, there are no separate show/hide buttons. A user has to create an NX Open program to do that. An enhancement to NX is not planned.

Proud Member of the Reality-Based Community..

To the Toolmaker, your nice little cartoon drawing of your glass looks cool, but your solid model sucks. Do you want me to fix it, or are you going to take all week to get it back to me so I can get some work done?

RE: Show and hide. Separate buttons

(OP)
The journal is working fine, sadly only in a single part. In an assembly it doesn't toggle on/off the sketches. (it also does nothing the first time you click the button, i think the attribute is created then.)
So I think I keep using Ctrl+W again.

Thanks for all the help. thumbsup2

Using NX 8.0 on Windows 7 (64)

RE: Show and hide. Separate buttons

In conclusion, VW181, the journal you refer to is NOT working fine.

Proud Member of the Reality-Based Community..

To the Toolmaker, your nice little cartoon drawing of your glass looks cool, but your solid model sucks. Do you want me to fix it, or are you going to take all week to get it back to me so I can get some work done?

RE: Show and hide. Separate buttons

Quote (VW181)


So I think I keep using Ctrl+W again.

Excellent, since that is excatly how this is SUPPOSED to work in NX!

Having individual 'icons' which would toggle ON/OFF (Show/Hide) ONE SINGLE type of object would only save you a couple of gestures (keyboard entries) while wasting space by requiring you to have icons for each object type that you might possibly want to toggle ON/OFF. Besides, there would be NO way of knowing whether any objects of the type that you were interested in are even in your part file so pushing one or more of this multitude of icons may NOT do anything at all. However, when you use the 'Ctrl+W' approach, the dialog that comes-up will show ONLY those classes of objects which actually exist in your part file so you'll know EXACTLY what objects types are available for having their display status changed.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources