×
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

Display Properties Journal Needed

Display Properties Journal Needed

Display Properties Journal Needed

(OP)
I'm looking for something to get me going in the right direction

I frequently change the properties of selected solids.
Layer, Color, Line type, Translucency

They're used on alternate ref sets to subtract from other bodies.

Anyone have anything for this?

I can make one, but it doesn't let me select the objects I want.
Doing that is water over my head!

TIA

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

RE: Display Properties Journal Needed

What type of objects are you trying to select? Will these objects be selected interactively by the user, or automatically by the journal?

www.nxjournaling.com

RE: Display Properties Journal Needed

(OP)
Only solid bodies with user interaction.
They could be picked from model space or a selected browser feature, but that's not important.

Just that multiples can be selected if required. Once you hit OK it should process.

Wouldn't hurt if it were to move it to the correct REF set too. lol
If that were done I would probably prefer it be selected with interaction from the ref set dialogue.

This journal thing is great but I'm clueless on the user interaction stuff.
I never have enough time to sit an really figure it out.

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

RE: Display Properties Journal Needed

This should get you started:

CODE

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module Module2

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession
        Dim theUi As UI = UI.GetUI
        If IsNothing(theSession.Parts.Work) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "NXJ body display properties"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim theBodies As New List(Of Body)
        If SelectBodies("select bodies", theBodies) = Selection.Response.Cancel Then
            'user pressed cancel
            lw.WriteLine("cancel")
            Return
        End If

        Dim displayModification1 As DisplayModification = theSession.DisplayManager.NewDisplayModification()

        'specify new layer (1 - 256)
        displayModification1.NewLayer = 1
        'specify new color (CDF palette entry 1 - 216)
        displayModification1.NewColor = 6
        'specify line font
        '  DisplayableObject.ObjectFont.Centerline
        '  DisplayableObject.ObjectFont.Dashed
        '  DisplayableObject.ObjectFont.Dotted
        '  DisplayableObject.ObjectFont.DottedDashed
        '  DisplayableObject.ObjectFont.LongDashed
        '  DisplayableObject.ObjectFont.Phantom
        '  DisplayableObject.ObjectFont.Solid
        displayModification1.NewFont = DisplayableObject.ObjectFont.Dashed
        'specify translucency %
        displayModification1.NewTranslucency = 50

        displayModification1.ApplyToAllFaces = True
        displayModification1.ApplyToOwningParts = False

        displayModification1.Apply(theBodies.ToArray)

        displayModification1.Dispose()

        lw.Close()

    End Sub

    Function SelectBodies(ByVal prompt As String, ByRef selBodies As List(Of Body)) As Selection.Response

        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select a body"
        Dim includeFeatures As Boolean = False
        Dim keepHighlighted As Boolean = False
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
        Dim selectionMask_array(0) As Selection.MaskTriple
        Dim selObjs() As TaggedObject

        With selectionMask_array(0)
            .Type = UFConstants.UF_solid_type
            .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_BODY
        End With

        Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObjects(prompt,
         title, scope, selAction,
         includeFeatures, keepHighlighted, selectionMask_array,
         selObjs)
        If resp = Selection.Response.Back OrElse resp = Selection.Response.Cancel Then
            Return Selection.Response.Cancel
        Else
            For Each tempObj As TaggedObject In selObjs
                selBodies.Add(tempObj)
            Next
            Return Selection.Response.Ok
        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.AtTermination

    End Function

End Module 

www.nxjournaling.com

RE: Display Properties Journal Needed

(OP)
Wow, that works beautifully.

Thanks Cowski. U da man!

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

RE: Display Properties Journal Needed

Hi Cowski

I'm interesting in this journal but with a reset
to the original setting.

Is it possible to save the settings in somewhere
on the part so later after saving I can read theme back.

Thank you in advanced

RE: Display Properties Journal Needed

One way to do this would be to save the current property values in the object's attributes; your code could then read the attributes to restore the previous values or fall back on the current object display defaults.

www.nxjournaling.com

RE: Display Properties Journal Needed

Cowski Thank you
I'll take a thought of this.

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