×
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

Assign render materials using Journal ?

Assign render materials using Journal ?

Assign render materials using Journal ?

(OP)
I am posting this question on this forum also, hoping to find new readers... smile

Any tips on workarounds to assign , say "steel", to a body/all bodies in the work part using a journal ?
Note: Render materials. The "engineering materials" are no problem to assign using a journal.

The render materials palette (NX10) does not seem to register journal recording.
Any workarounds , other methods, to assign render materials are welcome.
The drag-drop from the materials palette does not record in the journal.
- Possible to import .lwa files ? Assign material from ?
- Cowski ?



Regards,
Tomas

RE: Assign render materials using Journal ?

Yes it seems to be possible, look into the User Function Display library (nxopen.uf.ufdisp),

To open an LWA material library use

CODE -->

Public Sub OpenLwaArchiveMaterialsLibrary(lwa_archive_library_name As String) 
where the input is the full path to the lwa library.

It is then possible to copy a material from the library to work part, which gives the material_tag

CODE -->

Public Sub CopyLwaArchiveMaterialToWorkPart (Byval material_name As String, ByRef material_tag As Tag) 

Then use the assign material function

CODE -->

NXOpen.UF.UFDisp.AssignMaterial(ByVal material_tag As tag, ByVal object_tag As tag) 
but make sure that the object_tag is of the type UF_solid_type, UF_solid_face_subtype or UF_faceted_model_type.

The only example for studio materials I could find on GTAC shows how one can use cycle objects to find all materials in a part.

CODE -->

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

Module report_studio_materials_in_part

    Dim theSession As Session = Session.GetSession()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim theUI As UI = UI.GetUI()
    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main

        Dim materials As New SortedList()
        get_part_materials(materials)
        lw.Open()
        If materials.Count = 0 Then
            lw.WriteLine("Part has no materials applied.")
        Else
            For Each material As DictionaryEntry in materials
                lw.WriteLine("Part Material " + material.Key.ToString() + " is " + material.Value)
            Next
        End If

    End Sub

    Function get_part_materials(ByRef materials As SortedList)

        Dim matTag As Tag = Tag.Null
        ufs.Obj.CycleObjsInPart ( theSession.Parts.Work.Tag, _
                          UFConstants.UF_material_type, _
                          matTag)
        While matTag <> Tag.Null
            Dim matName As String = Nothing
            ufs.Obj.AskName(matTag, matName)
            materials.Add(matTag, matName)
            ufs.Obj.CycleObjsInPart ( theSession.Parts.Work.Tag, _
                          UFConstants.UF_material_type, _
                          matTag)
        End While

    End Function

End Module 


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