×
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

Problems with batch exporting in NX 9.0

Problems with batch exporting in NX 9.0

Problems with batch exporting in NX 9.0

(OP)
Hi All,

I have been trying to automate moving and translating files. I basically have all the code done and I'm using the "ug_inspect.exe -extract_all". I'm trying to export a whole assembly into one parasolid, and it seems like the only thing that is exporting is a body feature that is in the assembly itself.

I was wondering if anyone knows if there is a way to change this? Perhaps somewhere in NX's options? OR maybe in my code?


CODE --> batch

@ECHO on

ECHO "%~1"


SET "trufolder=%~1"


SET "moddate=%DATE:~4,2%%DATE:~7,2%%DATE:~12,2%"


SET "filename=%~n1"

SET "shortname=%filename:~0,8%"


SET "datefolder=D:\Quotations\Customer Files Recd\%shortname%\files recd %moddate%"


MD "%datefolder%"


CD /D C:\Program Files\Siemens\NX 9.0\UGII

ug_inspect -extract_all "%trufolder%" "%trufolder%"

move /-y "%trufolder%*.x_b" "%datefolder%\%filename%.x_b"

start "%datefolder%\%filename%.x_b" 

RE: Problems with batch exporting in NX 9.0

The "ug_inspect -extract" option will only extract bodies contained within the file. Unfortunately for you, the assembly file does not contain the bodies of the components. It contains links to the component part files. When you open the assembly, the components are loaded and positioned accordingly.

I don't think "ug_inspect" is up to the task. However, a journal could be made to open the assembly file, load the components, and export the assembly to a single parasolid file. With a few tweaks, such a journal could be made to work in 'batch' mode, where it is called with the command line utility 'run_journal'.

www.nxjournaling.com

RE: Problems with batch exporting in NX 9.0

(OP)
Thank you cowski. I will look into that.

RE: Problems with batch exporting in NX 9.0

(OP)
I have my journal set up and it works great when I have NX open, but I can't seem to pass the data on to the .vb from the .bat. From what I have seen others saying, you can enter "c:\path\run_journal.exe C:\path\journal.vb -args c:\path\part.prt". When I do this I get an error that says "Runtime error: System.nullReferenceException: Object reference not set to an instance of an object. Do I need to add some code to the .vb file to tell it to look for the info from the .bat file?

RE: Problems with batch exporting in NX 9.0

In your journal file, you will need to examine the arguments that have been passed in. Check that "args" contains a valid file path, then open the file so the journal can operate on it.

www.nxjournaling.com

RE: Problems with batch exporting in NX 9.0

(OP)
I ended up finding a journal on a forum that worked for me. Thank you for your help.


CODE --> vb

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.Utilities
Imports NXOpen.Annotations
 
Module ChangeNoteWord
   Dim s As Session = Session.GetSession()
   dim lw as listingwindow = s.listingwindow
	Dim dp as part
	Dim wp as part
 
 Sub Main(args() as string)
	lw.open
	OpenPart(args(0))
   Dim nc As NoteCollection = dp.Notes
   Dim notetext1 As String = "existing word"
   notetext1 = "COOL" 
   Dim notetext2 As String = "new word"
   notetext2 = "TEST"
   Dim notestring() As String
   Dim nolines As Integer = 0
   Dim found1 As Boolean = False
   Dim m1 As Session.UndoMarkId = s.SetUndoMark(Session.MarkVisibility.Visible, "M1")
   For Each a_note As Note In nc
     notestring = a_note.GetText()
     nolines = notestring.Length
     For i As Integer = 0 To nolines - 1
       found1 = notestring(i).Contains(notetext1)
         If found1 = True Then
          notestring(i) = notestring(i).Replace(notetext1, notetext2)
         End If
      Next
      a_note.SetText(notestring)
   Next
   s.UpdateManager.DoUpdate(m1)
 
   Dim partSaveStatus1 As PartSaveStatus
	partSaveStatus1 = dp.SaveAs(("R:\Engineering\Program_Files\temp_file\temp.step"))
	partSaveStatus1.Dispose()
 
 End Sub
 
 sub OpenPart(byval thePart as string)
	Dim basePart1 As BasePart
	Dim partLoadStatus1 As PartLoadStatus
	basePart1 = s.Parts.OpenBaseDisplay(thePart, partLoadStatus1)
 
	dp = s.Parts.Display
	wp = s.parts.work
 
	partLoadStatus1.Dispose()
End Sub
 
 Public Function GetUnloadOption(ByVal dummy As String) As Integer
  GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
 End Function
End Module 

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