Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Journal work ok but error when saving the assembly part

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
Hi

This journal is based on a gtac example.
its work ok the component is built but problem when
saving the parent part.

Thank you.

Capture_rlrcrz.jpg


Code:
mports System

Imports NXOpen
Imports NXOpen.UI
Imports NXOpenUI
Imports NXOpen.Utilities
Imports NXOpen.UF

Module create_component_parts_from_bodies

  Dim s As Session = Session.GetSession()
  Dim ufs As UFSession = UFSession.GetUFSession()
  Dim lw As ListingWindow = s.ListingWindow

 Sub Main()

    Dim wp As Part = s.Parts.Work
    Dim units As Integer
    Dim layer As Integer = -1 ' Original Layer
    Dim origin() As Double = {0, 0, 0}
    Dim csys_matrix() As Double = {1, 0, 0, 0, 1, 0}
    Dim objects() As NXOpen.Tag = Nothing
    Dim comp_inst As NXOpen.Tag
    Dim comp_bodies() As Body
    Dim i As Integer

    lw.Open()
    ufs.Part.AskUnits(wp.Tag, units)  
    comp_bodies = wp.Bodies.ToArray()
    lw.WriteLine("comp_bodies.Length = " & comp_bodies.Length)
 
    For i = 0 To 31
      reDim Preserve objects(i)
      objects(i) = comp_bodies(i).Tag
      lw.WriteLine("comp_bodies(" & i.ToString & ").Tag = " & comp_bodies(i).Tag.ToString)
    Next

        ufs.Assem.CreateComponentPart(wp.Tag, _
                                     "comp_Part1", _
                                     Nothing, _
                                     Nothing, _
                                      units, _
                                      layer, _
                                      origin, _
                                      csys_matrix, _
                                      32, _
                                      objects, _
                                      comp_inst)


 End Sub

 Public Function GetUnloadOption(ByVal dummy As String) As Integer
    GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
 End Function

End Module
 
Replies continue below

Recommended for you


OK fullpath resolv the problem

ufs.Assem.CreateComponentPart(wp.Tag, _
"C:\_nx11_\journal\create_component_parts_from_bodies\comp_Part6.prt", _
Nothing, _
Nothing, _
units, _
layer, _
origin, _
csys_matrix, _
32, _
objects, _
comp_inst)
 
This journal move bodies to a component.

I look for a way to copy bodies to a
New part without impact the original
Bodies part.

If someone has any ideas.

Thank you.
 
The "CreateNewComponentBuilder" has an option to delete or keep the bodies. I suggest recording a journal while using the "create new component" command.

www.nxjournaling.com
 
Hi Cowski thank you.
I'll record and try this.
Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor