×
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

Export STEP journal

Export STEP journal

Export STEP journal

(OP)
Hello everyone,

I have created journal to export step203 from selected bodies, but I receive error:

Quote:

*** ERROR ***
3600002 : Symbol not found in library

The same journal, but used step214creator work perfect. What I'm doing wrong?
Below Is my code.

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports Microsoft.VisualBasic
 
Module NXJournal
    Sub Main()
 
       Dim theSession As Session = Session.GetSession()
       Dim ufs As UFSession = UFSession.GetUFSession()
       Dim workPart As Part = theSession.Parts.Work
       Dim displayPart As Part = theSession.Parts.Display
       Dim lw As ListingWindow = theSession.ListingWindow
       Dim mySelectedObjects() As NXObject
       Dim myResponse As Selection.Response
 
       Dim tagList() As NXOpen.Tag
       Dim exportFileName As String = Nothing
       Dim exportFileName1 As String = Nothing
       Dim nazwa as string
       Dim path As String 

       Dim step203File As String
       Dim STEP203UG_DIR As String = theSession.GetEnvironmentVariableValue("STEP203UG_DIR")  
       step203File = IO.Path.Combine(STEP203UG_DIR, "ugstep203.def")

	lw.Open()

        If Not IO.File.Exists(step203File) Then  
            MsgBox("The step203 settings file (ugstep203.def) was not found." & vbCrLf & _  
                "This journal will now exit.", vbOKOnly + vbCritical)  
            Exit Sub  
        Else  
 		'lw.WriteLine("STEP203 definition file found at: " & step203File)
        End If 

	
       Dim i As Integer = 0
 
       
       myResponse = SelectObjects(mySelectedObjects)
       If (myResponse = Selection.Response.Cancel) OrElse (myResponse = Selection.Response.Back) Then
           'user canceled selection, exit journal
           Exit Sub
       End If
 
       ReDim tagList(mySelectedObjects.GetUpperBound(0))
       For i = 0 To mySelectedObjects.GetUpperBound(0)
           tagList(i) = mySelectedObjects(i).Tag
       Next
 
       'return the full path of the work part

       exportFileName = workPart.FullPath
       nazwa = workPart.Leaf
      
       path = IO.Path.Combine(IO.Path.GetDirectoryName(workPart.FullPath), "step")


	If(Not System.IO.Directory.Exists(Path)) Then
    		System.IO.Directory.CreateDirectory(Path)
	End If

	exportFileName = IO.Path.Combine(path, nazwa & ".stp") 
	

       'if this file already exists, delete it
       If My.Computer.FileSystem.FileExists(exportFileName) Then
           My.Computer.FileSystem.DeleteFile(exportFileName)
       End If
 
        Dim numUnexported As Integer


       Try

      ' ufs.Ps.ExportLinkedData(Taglist, Taglist.Length, exportFileName, PSversion, Nothing, numUnexported, 

Nothing)


        Dim step203Creator1 As Step203Creator  
        step203Creator1 = theSession.DexManager.CreateStep203Creator()  

        step203Creator1.SettingsFile = step203File  
        step203Creator1.ObjectTypes.Solids = True  
        step203Creator1.LayerMask = "1-256"  
        step203Creator1.InputFile = workPart.FullPath  
        step203Creator1.OutputFile = exportfilename
        step203Creator1.FileSaveFlag = False  
	step203Creator1.BsplineTol = 0.0001
	Step203Creator1.ColorAndLayers = 1
        step203Creator1.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.SelectedObjects 


        Dim nXObject1 As NXObject  
        nXObject1 = step203Creator1.Commit()  

        step203Creator1.Destroy()  
        lw.Close() 


       Catch ex As NXException
           lw.WriteLine("*** ERROR ***")
           lw.WriteLine(ex.ErrorCode.ToString & " : " & ex.Message)
       End Try
 
       lw.Close()
 
    End Sub
 
   Function SelectObjects(ByRef selobj() As NXObject) As Selection.Response
 
       Dim theUI As UI = UI.GetUI
       Dim prompt as String = "Select Solid Bodies"
       Dim title As String = "Selection"
       Dim includeFeatures As Boolean = False
       Dim keepHighlighted As Boolean = False
       Dim selAction As Selection.SelectionAction = _
           Selection.SelectionAction.ClearAndEnableSpecific
 
       Dim scope As Selection.SelectionScope = _
           Selection.SelectionScope.AnyInAssembly
       Dim selectionMask_array(0) As Selection.MaskTriple
 
       With selectionMask_array(0)
           .Type = UFConstants.UF_solid_type
           .Subtype = 0
           .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY
       End With
 
       Dim resp As Selection.Response = _
           theUI.SelectionManager.SelectObjects( _
           prompt, title, scope, selAction, _
            includeFeatures, keepHighlighted, _
            selectionMask_array, selobj)
 
       Return resp
 
   End Function
 
End Module 

With best regards
Michael

RE: Export STEP journal

Which line of code tells the exporter object what to export?

www.nxjournaling.com

RE: Export STEP journal

(OP)
Hello Cowski, It doesn't display number of line. I think that the error is from listing window.

With best regards
Michael

RE: Export STEP journal

I'm not asking for the line of code that throws the error (which is a bit unusual for me glasses). Rather, I'm asking you which line of code do you think tells the step203 exporter object to use the objects that you are interested in?

www.nxjournaling.com

RE: Export STEP journal

(OP)
This line:

CODE

step203Creator1.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.SelectedObjects 

With best regards
Michael

RE: Export STEP journal

(OP)
One more thing - I closed NX and after restart I tried one more time and it's start working. Then I tried step214 and I receive the same error like in post 1. So the problem is with NX.

With best regards
Michael

RE: Export STEP journal

That line simply tells it to use the "selected objects" option rather than the "entire part" option. It does NOT tell the exporter object which objects in particular that you are going to export.

In other words, that option sets the scope of what is going to be exported. It is analogous to changing the export option in the GUI to "selected objects"; your next step in the GUI version is to select object(s) to tell it what to export. Now that you have set the scope, you need to use the .ExportSelectionBlock.SelectionComp.Add() method to pass it the solids that you selected previously.

www.nxjournaling.com

RE: Export STEP journal

(OP)
There is function to select bodies:

CODE

Function SelectObjects(ByRef selobj() As NXObject) As Selection.Response
 
       Dim theUI As UI = UI.GetUI
       Dim prompt as String = "Select Solid Bodies"
       Dim title As String = "Selection"
       Dim includeFeatures As Boolean = False
       Dim keepHighlighted As Boolean = False
       Dim selAction As Selection.SelectionAction = _
           Selection.SelectionAction.ClearAndEnableSpecific
 
       Dim scope As Selection.SelectionScope = _
           Selection.SelectionScope.AnyInAssembly
       Dim selectionMask_array(0) As Selection.MaskTriple
 
       With selectionMask_array(0)
           .Type = UFConstants.UF_solid_type
           .Subtype = 0
           .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY
       End With
 
       Dim resp As Selection.Response = _
           theUI.SelectionManager.SelectObjects( _
           prompt, title, scope, selAction, _
            includeFeatures, keepHighlighted, _
            selectionMask_array, selobj)
 
       Return resp
 
   End Function 

With best regards
Michael

RE: Export STEP journal

Yes; and now you need to tell the exporter object which solids were previously selected.

www.nxjournaling.com

RE: Export STEP journal

(OP)
Ok, below is my latest code:

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports Microsoft.VisualBasic
 
Module NXJournal
    Sub Main()
 
       Dim theSession As Session = Session.GetSession()
       Dim ufs As UFSession = UFSession.GetUFSession()
       Dim workPart As Part = theSession.Parts.Work
       Dim displayPart As Part = theSession.Parts.Display
       Dim lw As ListingWindow = theSession.ListingWindow
       Dim mySelectedObjects() As NXObject
       Dim myResponse As Selection.Response
 
       Dim tagList() As NXOpen.Tag
       Dim exportFileName As String = Nothing
       Dim exportFileName1 As String = Nothing
       Dim nazwa as string
       Dim path As String 

       Dim step203File As String
       Dim STEP203UG_DIR As String = theSession.GetEnvironmentVariableValue("STEP203UG_DIR")  
       step203File = IO.Path.Combine(STEP203UG_DIR, "ugstep203.def")

	lw.Open()

        If Not IO.File.Exists(step203File) Then  
            MsgBox("The step203 settings file (ugstep203.def) was not found." & vbCrLf & _  
                "This journal will now exit.", vbOKOnly + vbCritical)  
            Exit Sub  
        Else  
 		'lw.WriteLine("STEP203 definition file found at: " & step203File)
        End If 

	
       Dim i As Integer = 0
 
       
       myResponse = SelectObjects(mySelectedObjects)
       If (myResponse = Selection.Response.Cancel) OrElse (myResponse = Selection.Response.Back) Then
           'user canceled selection, exit journal
           Exit Sub
       End If
 
       ReDim tagList(mySelectedObjects.GetUpperBound(0))
       For i = 0 To mySelectedObjects.GetUpperBound(0)
           tagList(i) = mySelectedObjects(i).Tag
       Next
 
       'return the full path of the work part

       exportFileName = workPart.FullPath
       nazwa = workPart.Leaf
      
       path = IO.Path.Combine(IO.Path.GetDirectoryName(workPart.FullPath), "step")


	If(Not System.IO.Directory.Exists(Path)) Then
    		System.IO.Directory.CreateDirectory(Path)
	End If

	exportFileName = IO.Path.Combine(path, nazwa & ".stp") 
	

       'if this file already exists, delete it
       If My.Computer.FileSystem.FileExists(exportFileName) Then
           My.Computer.FileSystem.DeleteFile(exportFileName)
       End If
 
        Dim numUnexported As Integer


       Try


        Dim step203Creator1 As Step203Creator  
        step203Creator1 = theSession.DexManager.CreateStep203Creator()  

        step203Creator1.SettingsFile = step203File  
        step203Creator1.ObjectTypes.Solids = True  
        step203Creator1.LayerMask = "1-256"  
        step203Creator1.InputFile = workPart.FullPath  
        step203Creator1.OutputFile = exportfilename
        step203Creator1.FileSaveFlag = False  
	step203Creator1.BsplineTol = 0.0001
	Step203Creator1.ColorAndLayers = 1
        step203Creator1.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.SelectedObjects 

        Dim added1 As Boolean  
        added1 = step203Creator1.ExportSelectionBlock.SelectionComp.Add(mySelectedObjects.ToArray)  

        Dim nXObject1 As NXObject  
        nXObject1 = step203Creator1.Commit()  

        step203Creator1.Destroy()  
        lw.Close() 


       Catch ex As NXException
           lw.WriteLine("*** ERROR ***")
           lw.WriteLine(ex.ErrorCode.ToString & " : " & ex.Message)
       End Try
 
       lw.Close()
 
    End Sub
 
   Function SelectObjects(ByRef selobj() As NXObject) As Selection.Response
 
       Dim theUI As UI = UI.GetUI
       Dim prompt as String = "Select Solid Bodies"
       Dim title As String = "Selection"
       Dim includeFeatures As Boolean = False
       Dim keepHighlighted As Boolean = False
       Dim selAction As Selection.SelectionAction = _
           Selection.SelectionAction.ClearAndEnableSpecific
 
       Dim scope As Selection.SelectionScope = _
           Selection.SelectionScope.AnyInAssembly
       Dim selectionMask_array(0) As Selection.MaskTriple
 
       With selectionMask_array(0)
           .Type = UFConstants.UF_solid_type
           .Subtype = 0
           .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY
       End With
 
       Dim resp As Selection.Response = _
           theUI.SelectionManager.SelectObjects( _
           prompt, title, scope, selAction, _
            includeFeatures, keepHighlighted, _
            selectionMask_array, selobj)
 
       Return resp
 
   End Function

'**********************************************************
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return Session.LibraryUnloadOption.Immediately
    End Function
'**********************************************************
 
End Module 
I added this

CODE

Dim added1 As Boolean  
        added1 = step203Creator1.ExportSelectionBlock.SelectionComp.Add(mySelectedObjects.ToArray) 

And I've got an error: "Element "ToArray" is not a member of element "system.array" ".

Any suggestions?

With best regards
Michael

RE: Export STEP journal

The mySelectedObjects variable is already an array; there is no need to try to convert it to an array.

CODE

added1 = step203Creator1.ExportSelectionBlock.SelectionComp.Add(mySelectedObjects) 

www.nxjournaling.com

RE: Export STEP journal

(OP)
Thanks Cowski, now it's working. What I'm gonna do is create journal to process whole assembly and for each part create step file. Below is my journal, byt I have problem with SelectionScope.

CODE

Option Strict Off
 
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Imports System.Collections.Generic
 
Module NXJournal
 
    Public theSession As Session = Session.GetSession()
    Public ufs As UFSession = UFSession.GetUFSession()
    Public lw As ListingWindow = theSession.ListingWindow
    Dim filename as string	
    Dim poz as string

    Sub Main()


    Dim workPart As Part = theSession.Parts.Work
    Dim dispPart As Part = theSession.Parts.Display

	
 
    lw.Open


    Try
        Dim c As ComponentAssembly = dispPart.ComponentAssembly

	if not IsNothing(c.RootComponent) then

            ReportComponentChildren(c.RootComponent, 0)
        else

            lw.WriteLine("Part has no components")

        end if
    Catch e As Exception
        theSession.ListingWindow.WriteLine("Failed: " & e.ToString)
    End Try
    lw.Close
 
    End Sub
 
'**********************************************************
    Sub reportComponentChildren( ByVal comp As Component, _
        ByVal indent As Integer)

	Dim dispPart As Part = theSession.Parts.Display
        Dim lw As ListingWindow = theSession.ListingWindow

       Dim tagList() As NXOpen.Tag
       Dim exportFileName As String = Nothing
       Dim exportFileName1 As String = Nothing
       Dim nazwa as string
       Dim path As String 
       Dim PSversion as integer = 240
       Dim layerNumber as Integer = 1	
       Dim i As Integer = 0
       Dim theBodies As New List(Of Body) 
 
       Dim theBodyTags as New List(Of Tag)
 
       Dim step214File As String
       Dim STEP214UG_DIR As String = theSession.GetEnvironmentVariableValue("STEP214UG_DIR")  
       step214File = IO.Path.Combine(STEP214UG_DIR, "ugstep214.def")

       lw.open

	If Not IO.File.Exists(step214File) Then  
            MsgBox("The step214 settings file (ugstep214.def) was not found." & vbCrLf & _  
                "This journal will now exit.", vbOKOnly + vbCritical)  
            Exit Sub  
        Else  
 		'lw.WriteLine("STEP214 definition file found at: " & step214File)
        End If 


        For Each child As Component In comp.GetChildren()
	
             If LoadComponent(child) Then

		Dim MyPart As Part = child.Prototype.OwningPart 

	        filename = child.DisplayName()

			'Msgbox(filename)

	lw.open

	theBodyTags.clear()

	For each tempBody as Body in mypart.Bodies
 	  if tempBody.Layer = 1 then
 	       theBodies.Add(tempBody)
	   end if
	Next 

 

'	lw.WriteLine("number of bodies found: " & theBodyTags.Count.ToString)


	if theBodyTags.Count = 0 then
	    lw.writeline("no bodies to export")
	    return
	end if 

     
	exportFileName = myPart.FullPath
        nazwa = myPart.Leaf
      
       path = IO.Path.Combine(IO.Path.GetDirectoryName(myPart.FullPath), "step")


	If(Not System.IO.Directory.Exists(Path)) Then
    		System.IO.Directory.CreateDirectory(Path)
	End If

	exportFileName = IO.Path.Combine(path, nazwa & ".stp") 
	

       'if this file already exists, delete it
       If My.Computer.FileSystem.FileExists(exportFileName) Then
           My.Computer.FileSystem.DeleteFile(exportFileName)
       End If
 
       Dim numUnexported As Integer

       Try

        Dim step214Creator1 As Step214Creator  
        step214Creator1 = theSession.DexManager.CreateStep214Creator()  

        step214Creator1.SettingsFile = step214File  
        step214Creator1.ObjectTypes.Solids = True  
        step214Creator1.LayerMask = "1"  
        step214Creator1.InputFile = myPart.FullPath  
        step214Creator1.OutputFile = exportfilename  
        step214Creator1.FileSaveFlag = False  
        step214Creator1.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.thebodies 

        Dim added1 As Boolean  
        added1 = step214Creator1.ExportSelectionBlock.SelectionComp.Add(thebodies)  

        Dim nXObject1 As NXObject  
        nXObject1 = step214Creator1.Commit()  

        step214Creator1.Destroy()  
        lw.Close()  

       Catch ex As NXException
           lw.WriteLine("*** ERROR ***")
           lw.WriteLine(ex.ErrorCode.ToString & " : " & ex.Message)
       End Try
 
       lw.Close()
 	 		
		end if 
  	' end if

         '   Else

                'component could not be loaded

       '     End If

            reportComponentChildren(child, indent + 1)
        Next
    End Sub

    Private Function LoadComponent(ByVal theComponent As Component) As Boolean
 
        Dim thePart As Part = theComponent.Prototype.OwningPart
 
        Dim partName As String = ""
        Dim refsetName As String = ""
        Dim instanceName As String = ""
        Dim origin(2) As Double
        Dim csysMatrix(8) As Double
        Dim transform(3, 3) As Double
 
        Try
            If thePart.IsFullyLoaded Then
                'component is fully loaded
            Else
                'component is partially loaded
            End If
            Return True
        Catch ex As NullReferenceException
            'component is not loaded
            Try
                ufs.Assem.AskComponentData(theComponent.Tag, partName, refsetName, instanceName, origin, 

csysMatrix, transform)
 
                Dim theLoadStatus As PartLoadStatus
                theSession.Parts.Open(partName, theLoadStatus)
 
                If theLoadStatus.NumberUnloadedParts > 0 Then
 
                    Dim allReadOnly As Boolean = True
                    For i As Integer = 0 To theLoadStatus.NumberUnloadedParts - 1
                        If theLoadStatus.GetStatus(i) = 641058 Then
                            'read-only warning, file loaded ok
                        Else
                            '641044: file not found
                            lw.WriteLine("file not found")
                            allReadOnly = False
                        End If
                    Next
                    If allReadOnly Then
                        Return True
                    Else
                        'warnings other than read-only...
                        Return False
                    End If
                Else
                    Return True
                End If
 
            Catch ex2 As NXException
                lw.WriteLine("error: " & ex2.Message)
                Return False
            End Try
        Catch ex As NXException
            'unexpected error
            lw.WriteLine("error: " & ex.Message)
            Return False
        End Try
 
    End Function

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

I get an error "Element "thebodies" is not member of "NXopen.ObjectSelector.scope".
When I used function selectobject, the journal works, but in each exported stp file I have solid bodies from each files. So I try similar method which I used in "export parasolid" journal some time ago.

With best regards
Michael

RE: Export STEP journal

For the selection scope, use .SelectedObjects. In this code, the variable theBodies is declared as a list object; this time you will have to convert it to an array.

CODE

step214Creator1.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.SelectedObjects

Dim added1 As Boolean  
added1 = step214Creator1.ExportSelectionBlock.SelectionComp.Add(theBodies.ToArray) 

www.nxjournaling.com

RE: Export STEP journal

(OP)
Thanks Cowski You are The best. Below is my final code, maybe it will be useful for someone in the future.

CODE

Option Strict Off
 
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Imports System.Collections.Generic
 
Module NXJournal
 
    Public theSession As Session = Session.GetSession()
    Public ufs As UFSession = UFSession.GetUFSession()
    Public lw As ListingWindow = theSession.ListingWindow
    Dim filename as string	
    Dim poz as string

    Sub Main()


    Dim workPart As Part = theSession.Parts.Work
    Dim dispPart As Part = theSession.Parts.Display

	
 
    lw.Open


    Try
        Dim c As ComponentAssembly = dispPart.ComponentAssembly

	if not IsNothing(c.RootComponent) then

            ReportComponentChildren(c.RootComponent, 0)
        else

            lw.WriteLine("Part has no components")

        end if
    Catch e As Exception
        theSession.ListingWindow.WriteLine("Failed: " & e.ToString)
    End Try
    lw.Close
 
    End Sub
 
'**********************************************************
    Sub reportComponentChildren( ByVal comp As Component, _
        ByVal indent As Integer)

	Dim dispPart As Part = theSession.Parts.Display
        Dim lw As ListingWindow = theSession.ListingWindow

       Dim tagList() As NXOpen.Tag
       Dim exportFileName As String = Nothing
       Dim exportFileName1 As String = Nothing
       Dim nazwa as string
       Dim path As String 
       Dim PSversion as integer = 240
       Dim layerNumber as Integer = 1	
       Dim i As Integer = 0
       Dim theBodies As New List(Of Body) 
 
       Dim step214File As String
       Dim STEP214UG_DIR As String = theSession.GetEnvironmentVariableValue("STEP214UG_DIR")  
       step214File = IO.Path.Combine(STEP214UG_DIR, "ugstep214.def")

       lw.open

	If Not IO.File.Exists(step214File) Then  
            MsgBox("The step214 settings file (ugstep214.def) was not found." & vbCrLf & _  
                "This journal will now exit.", vbOKOnly + vbCritical)  
            Exit Sub  
        Else  
 		'lw.WriteLine("STEP214 definition file found at: " & step214File)
        End If 


        For Each child As Component In comp.GetChildren()
	
             If LoadComponent(child) Then

		Dim MyPart As Part = child.Prototype.OwningPart 

	        filename = child.DisplayName()

			'Msgbox(filename)

	lw.open

	theBodies.clear()

	For each tempBody as Body in mypart.Bodies
 	  if tempBody.Layer = 1 then
 	       theBodies.Add(tempBody)
	   end if
	Next 

 

'	lw.WriteLine("number of bodies found: " & theBodies.Count.ToString)


	if theBodies.Count = 0 then
	    lw.writeline("no bodies to export in " & mypart.fullpath)
	    'return
	end if 

     
	exportFileName = myPart.FullPath
        nazwa = myPart.Leaf
      
       path = IO.Path.Combine(IO.Path.GetDirectoryName(myPart.FullPath), "step")


	If(Not System.IO.Directory.Exists(Path)) Then
    		System.IO.Directory.CreateDirectory(Path)
	End If

	exportFileName = IO.Path.Combine(path, nazwa & ".stp") 
	

       'if this file already exists, delete it
       If My.Computer.FileSystem.FileExists(exportFileName) Then
           My.Computer.FileSystem.DeleteFile(exportFileName)
       End If
 
       Dim numUnexported As Integer

       Try

        Dim step214Creator1 As Step214Creator  
        step214Creator1 = theSession.DexManager.CreateStep214Creator()  

	'step214Creator1.ExportSelectionBlock.SelectionComp.clear
        step214Creator1.SettingsFile = step214File  
        step214Creator1.ObjectTypes.Solids = True  
        step214Creator1.LayerMask = "1"  
        step214Creator1.InputFile = myPart.FullPath 
        step214Creator1.OutputFile = exportfilename  
        step214Creator1.FileSaveFlag = False  
	step214Creator1.BsplineTol = 0.0001
        step214Creator1.ExportSelectionBlock.SelectionScope = ObjectSelector.Scope.SelectedObjects
       

        Dim added1 As Boolean  
	added1 = step214Creator1.ExportSelectionBlock.SelectionComp.add(thebodies.toarray)  

        Dim nXObject1 As NXObject  
        nXObject1 = step214Creator1.Commit()  

        step214Creator1.Destroy()  
        lw.Close()  

       Catch ex As NXException
           lw.WriteLine("*** ERROR ***")
           lw.WriteLine(ex.ErrorCode.ToString & " : " & ex.Message)
       End Try
 
       lw.Close()
 	 		
		end if 
  	' end if

         '   Else

                'component could not be loaded

       '     End If

            reportComponentChildren(child, indent + 1)
        Next
    End Sub

    Private Function LoadComponent(ByVal theComponent As Component) As Boolean
 
        Dim thePart As Part = theComponent.Prototype.OwningPart
 
        Dim partName As String = ""
        Dim refsetName As String = ""
        Dim instanceName As String = ""
        Dim origin(2) As Double
        Dim csysMatrix(8) As Double
        Dim transform(3, 3) As Double
 
        Try
            If thePart.IsFullyLoaded Then
                'component is fully loaded
            Else
                'component is partially loaded
            End If
            Return True
        Catch ex As NullReferenceException
            'component is not loaded
            Try
                ufs.Assem.AskComponentData(theComponent.Tag, partName, refsetName, instanceName, origin, 

csysMatrix, transform)
 
                Dim theLoadStatus As PartLoadStatus
                theSession.Parts.Open(partName, theLoadStatus)
 
                If theLoadStatus.NumberUnloadedParts > 0 Then
 
                    Dim allReadOnly As Boolean = True
                    For i As Integer = 0 To theLoadStatus.NumberUnloadedParts - 1
                        If theLoadStatus.GetStatus(i) = 641058 Then
                            'read-only warning, file loaded ok
                        Else
                            '641044: file not found
                            lw.WriteLine("file not found")
                            allReadOnly = False
                        End If
                    Next
                    If allReadOnly Then
                        Return True
                    Else
                        'warnings other than read-only...
                        Return False
                    End If
                Else
                    Return True
                End If
 
            Catch ex2 As NXException
                lw.WriteLine("error: " & ex2.Message)
                Return False
            End Try
        Catch ex As NXException
            'unexpected error
            lw.WriteLine("error: " & ex.Message)
            Return False
        End Try
 
    End Function

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

I have one more question - how can I create a folder and place stp files in there, but this folder will be 1 level up.
Here is my theoretical structure:

CODE

<Project number>
<2D>
<3D>
NX parts
<STEP>

The folder I wanna create is <STEP>.

With best regards
Michael

RE: Export STEP journal

(OP)
Thanks again, I will try it tomorrow.

With best regards
Michael

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