×
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

Journal- Select all faces of a body

Journal- Select all faces of a body

Journal- Select all faces of a body

(OP)
I would like to set the color of a body black, and all the faces white.
I selected the body previously, so i have the body name (workpiece).
The current layout has a static wireframe 'TOP' view, and a shadew 'TFR-ISO'. When I export it to jpg, the ISO view is OK, but the Wireframe is very pale when printing it.
Any help would be appreciated.

----
kukelyk

RE: Journal- Select all faces of a body

Something like this?

CODE

'eng-tips thread561-335030: Journal- Select all faces of a body: Journal- Select all faces of a body
'change solid body color to black
'change faces of solid body color to white

Option Strict Off  
Imports System  
Imports NXOpen  
Imports NXOpen.UF  

Module Module1  

    Sub Main()  

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

        Dim mySolid As Body  
        If SelectSolid("Select a solid body", mySolid) = Selection.Response.Cancel Then  
            Exit Sub  
        End If  

        Dim markId3 As Session.UndoMarkId  
        markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Display")  

        Dim displayModification1 As DisplayModification  
        displayModification1 = theSession.DisplayManager.NewDisplayModification()  
        displayModification1.ApplyToAllFaces = False  
        displayModification1.ApplyToOwningParts = False  

        displayModification1.NewColor = 216  

        Dim objects1(0) As DisplayableObject  
        objects1(0) = mySolid  
        displayModification1.Apply(objects1)  


        Dim objects2() As DisplayableObject = mySolid.GetFaces  
        displayModification1.NewColor = 1  
        displayModification1.Apply(objects2)  

        displayModification1.Dispose()  

    End Sub  

    Function SelectSolid(ByVal prompt As String, ByRef selObj As NXObject) As Selection.Response  

        Dim theUI As UI = UI.GetUI  
        Dim title As String = "Select a solid"  
        Dim includeFeatures As Boolean = False  
        Dim keepHighlighted As Boolean = False  
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific  
        Dim cursor As Point3d  
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart  
        Dim selectionMask_array(0) As Selection.MaskTriple  

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

        Dim resp As Selection.Response = theUI.SelectionManager.SelectObject(prompt, _  
         title, scope, selAction, _  
         includeFeatures, keepHighlighted, selectionMask_array, _  
         selobj, cursor)  
        If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then  
            Return Selection.Response.Ok  
        Else  
            Return Selection.Response.Cancel  
        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: Journal- Select all faces of a body

(OP)
Many thanks, it is just what i want.

----
kukelyk

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