×
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

For claforet
2

For claforet

For claforet

2
(OP)
While searching for journals to export parasolid files, I ran across an old thread:
thread561-277942: Export Parasolid using journal

Here is a fixed version of that journal:

CODE

'eng-tips.com thread561-277942: Export Parasolid using journal
'journal to export all solids on work layer to parasolid file

Option Strict Off
Imports System
Imports System.IO
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI

Module NXJournal

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

Sub Main

dim wlayer as integer = workPart.layers.worklayer
dim objs as NXObject()=workpart.layers.getallobjectsonlayer(wlayer)
dim obj as NXObject
dim taglst() as Tag
dim t as tag
dim x as integer=0
dim b as body
Dim strParasolid as string

for each obj in objs
    if obj.gettype.tostring="NXOpen.Body" then
        b=CTYPE(obj,Body)
    redim preserve taglst(x)
        taglst(x)=b.tag
        x=x+1        
    end if
next

strParasolid = GetFilePath() & GetFileName() & ".x_t"
ufs.Ps.exportdata(taglst, strParasolid)

End Sub 'end of Sub Main

'***********************************************************************

Function GetFileName()
    Dim strPath as String
    Dim strPart as String
    Dim pos as Integer
    
    'get the full file path
    strPath = displayPart.fullpath
    'get the part file name
    pos = InStrRev(strPath, "\")
    strPart = Mid(strPath, pos + 1)
    
    strPath = Left(strPath, pos)
    'strip off the ".prt" extension
    strPart = Left(strPart, Len(strPart) - 4)
    
    GetFileName = strPart
End Function
'***********************************************************************

Function GetFilePath()
    Dim strPath as String
    Dim strPart as String
    Dim pos as Integer
    
    'get the full file path
    strPath = displayPart.fullpath
    'get the part file name
    pos = InStrRev(strPath, "\")
    strPart = Mid(strPath, pos + 1)
    
    strPath = Left(strPath, pos)
    'strip off the ".prt" extension
    strPart = Left(strPart, Len(strPart) - 4)
    
    GetFilePath = strPath
End Function


End Module

Hopefully it will help someone.

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