Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controling Layers / bodys

Status
Not open for further replies.

vegetagaru

Computer
Joined
Jan 14, 2015
Messages
134
Location
PT
Hello i wonder if anyone could help me or point some directions...

i have this code:
Code:
 For Each bodyItem As Body In CType(child.Prototype, Part).Bodies
                    Dim tmpNXObject As NXObject = child.FindOccurrence(bodyItem)
                    If Not tmpNXObject Is Nothing Then
                        componentTagList.Add(CType(tmpNXObject, Body).Tag)
                    End If
                Next
credits: petulf

and i would like to exclude the bodys on layers 50,90,250-255

could anyone point me something ? itryed to record a jounral hiding the layers then adding it to the code but no result :(

NX8.5 - NX9 - NX 10 - NX11
 
Once you have a reference to the body, you can check the .Layer property and take action based on the layer number.

www.nxjournaling.com
 
Use the layer property of the body object and check if the value is in a list of layers.
Code:
Dim exclusionLayers As New System.Collections.Generic.List(Of Integer)({50, 90, 250, 251, 252, 253, 254, 255})

For Each bodyItem As Body In CType(child.Prototype, Part).Bodies
  Dim tmpNXObject As NXObject = child.FindOccurrence(bodyItem)

  If Not tmpNXObject Is Nothing Then

    If Not exclusionLayers.Contains(bodyItem.Layer) Then
      componentTagList.Add(CType(tmpNXObject, Body).Tag)    
    End If

  End If
Next
 
Thanks both :D

i think it worked i will do some more tests if i ecounter problems i will reach u :)


NX8.5 - NX9 - NX 10 - NX11
 
yes its woking :D thank you

in some prts its not doing what its suposed to but i think its because he dont find the linked body prt example:

i have
TOP_PRT
-PRT1 (CONTENTS: SOLID BODY + LINKED garbadge_subprt SOLID BODY)
--garbadge_subprt(CONTENTS: SOLID BODY )
-PRT2 (CONTENTS: SOLID BODY + LINKED garbadge_subprt SOLID BODY)
--garbadge_subprt(CONTENTS: SOLID BODY )


when the code runs if im missing the garbadge_subprt its returning NXopen error. i will explore it and say something :)

NX8.5 - NX9 - NX 10 - NX11
 
petulf i had to comment a line from ur export code
Code:
tagsList.AddRange(GetBodyTagsInAsm(currentPart.ComponentAssembly.RootComponent))
it was in conflit with what im trying to do.

anyone knows if its possible or could point me something to export a parasolid with another WCS from another file?

example:
TOP_PRT
-PRT1 (CONTENTS: SOLID BODY + LINKED garbadge_subprt SOLID BODY)
--garbadge_subprt(CONTENTS: SOLID BODY )
-PRT2 (CONTENTS: SOLID BODY + LINKED garbadge_subprt SOLID BODY)
--garbadge_subprt(CONTENTS: SOLID BODY )

when i export it will export PRT1/prt2/garbage (separately) with WCS from TOP_PRT


NX8.5 - NX9 - NX 10 - NX11
 
cowski since you are more experienced could you point me something on that matter ?

NX8.5 - NX9 - NX 10 - NX11
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top