×
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

Need help in journal that identify assembly components that are "familly members components&quo

Need help in journal that identify assembly components that are "familly members components&quo

Need help in journal that identify assembly components that are "familly members components&quo

(OP)
Hi

Please can anyone help in nxopen vb functions that can scan an assembly and list all components
that are "familly members components"

Thanks in advanced

RE: Need help in journal that identify assembly components that are "familly members components&quo

1. Family members can be visually identified in the Assembly Navigator by displaying the column called "Info"
2. In a journal, use the old user function "UF_PART_is_family_instance"
3. As for scanning the assembly, there are a lot of code examples in the Siemens GTAC library

RE: Need help in journal that identify assembly components that are "familly members components&quo

(OP)
Hi daluigi

I'l try the "UF_PART_is_family_instance"

Thank you

RE: Need help in journal that identify assembly components that are "familly members components&quo

(OP)
Hi daluigi

maybe you can help in this

the "UF_PART_is_family_instance" function works good in NATIVE mode
but I need it in NXMANAGER mode but in this mode I get an error at this line

ufs.Part.IsFamilyInstance(myPart.Tag, is_family_instance)

the error is System.NullReferenceException: Object reference not set to an instance of an object

Thanks in advanced

heer the code that works good in Native mode

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Assemblies

Module list_all_family_members_components

Dim s As Session = Session.GetSession
Dim ufs As UFSession = UFSession.GetUFSession
Dim workPart As Part = s.Parts.Work
Dim dispPart As Part = s.Parts.Work
Dim lw As ListingWindow = s.ListingWindow

Sub Main()

Dim root As Component = dispPart.ComponentAssembly.RootComponent
Dim refComps As Component() = root.GetChildren()
Dim is_family_instance As Boolean
Dim cnt As Integer = 1
Dim len As Integer
Dim fmComponents(-1) As Component
lw.Open()

len = -1
For Each thisComp As Component In refComps

Dim myPart As Part = thisComp.Prototype.OwningPart
ufs.Part.IsFamilyInstance(myPart.Tag, is_family_instance)
If is_family_instance = TRUE Then

len = len + 1
ReDim Preserve fmComponents(len)
fmComponents(len) = thisComp

End If

Next

cnt = 1
For Each thisComp As Component In fmComponents

Dim selectedComps(0) As Assemblies.Component
lw.WriteLine(cnt.ToString & " " & thisComp.DisplayName & " ====>>> Is a family Member ")
cnt = cnt + 1

Next

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function

End Module

RE: Need help in journal that identify assembly components that are "familly members components&quo

I am not familiar with "thisComp.Prototype.OwningPart". I tried replacing myPart.Tag with dispPart.tag and it ran. You will need another way of defining how you get the tag from your components. I would probably open each component in the assembly and use workPart.tag. There should be a better way of doing this, but can't think of it off the top of my head.

RE: Need help in journal that identify assembly components that are "familly members components&quo

Quote (aluminum2)

I am not familiar with "thisComp.Prototype.OwningPart".

The syntax above will get a reference to the part file of the given component. It only works if the part file is open in session or if it can be found with the current load options.

Check to see if "myPart" is a valid reference before calling any of its properties or methods.

CODE

If IsNothing(myPart) Then
    'part is not loaded, attempt to load it
    'or skip processing this part
End If 

Fully loading the assembly or changing your TC load options may help.

www.nxjournaling.com

RE: Need help in journal that identify assembly components that are "familly members components&quo

(OP)
Hi

I'm very Thanks for the repllies

For thisComp.Prototype.OwningPart See NX journaling link
http://www.nxjournaling.com/content/component-name...
on the line ==>> Dim thePart As Part = theComponent.Prototype.OwningPart
and I see it also in some GTAC code examples

It only works if the part file is open in session but this journal is run ok in native mode
without opening any component part

Is NXMANAGER running mode is different from NATIVE running mode
Why NXMANAGER throw System.NullReferenceException and NATIVE not

I'm very thanks for any help to come

RE: Need help in journal that identify assembly components that are "familly members components&quo

Are your load options the same in native and TC?

www.nxjournaling.com

RE: Need help in journal that identify assembly components that are "familly members components&quo

(OP)
Hi cowski

Thank you for the response

When I am at work I'll check it

But what are the settings in load options that will allow the journal to work


I am grateful for any help

RE: Need help in journal that identify assembly components that are "familly members components&quo

Quote (a984928)

But what are the settings in load options that will allow the journal to work

The same settings that find and open the component part files successfully.

www.nxjournaling.com

RE: Need help in journal that identify assembly components that are "familly members components&quo

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