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.
This journal is based on a gtac example.
its work ok the component is built but problem when
saving the parent part.
Thank you.
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