Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

GRIP command to export parasolid 1

Status
Not open for further replies.

aek16

Aerospace
Aug 12, 2015
8
Hi, I need some help

How to export a parasolid from the existing part file using GRIP programming ?

The only command that I found is CPATT/ and it exports .prt file

thank you
 
Replies continue below

Recommended for you

Just curious, why GRIP and not a journal?

Kevin
 

Because my supervisor loves GRIP :p

Is it more simple with a journal ? I mean do you advice me to lean how to proceed with journaling ? Therefore,I have to convince him ;)

thank you

kader
 
My experience is that journal transition to new releases of NX without issue, I am not sure if GRIP macros do. The journals I write are what I believe would be considered simple too though.
I also think you will find more support for journaling(VB)

Portion of a Journal for exporting parasolid:

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

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
Dim lw As ListingWindow = theSession.ListingWindow



Sub Main
Const bodyLayer As Integer = 1
Const bodyLayer79 As Integer = 79
Dim myOptions As UFPart.ExportOptions
myOptions.params_mode = UFPart.ExportParamsMode.RemoveParams
myOptions.new_part = True

Dim partName As String = (GetFilePath+GetFileName+".x_t")
Dim objectTags As New List(Of Tag)
Dim objectTags79 As New List(Of Tag)

' Determine whether the directory exists.


'collect bodies from layer 1
For Each myObj As Body In workPart.Bodies
If myObj.Layer = bodyLayer Then
objectTags.Add(myObj.Tag)
End If
Next
'collect bodies from layer 79
lw.open
For Each myObj As Body In workPart.Bodies
If myObj.Layer = bodyLayer79 Then
objectTags.Add(myObj.Tag)
End If
Next
If objectTags.Count = 0 Then
msgbox("There Are No Objects On Layer 1")
Exit Sub
End If
' Determine whether the directory exists.
Dim di As DirectoryInfo = New DirectoryInfo(GetFilePath)
If di.Exists Then
'msgbox("That path exists already.")
lw.WriteLine(partName)
'lw.WriteLine("Under Construction")
Else
' Try to create the directory.
di.Create()
lw.WriteLine(partName)
'lw.WriteLine("Under Construction")
End If
ufs.Ps.ExportData(objectTags.ToArray, partName)

lw.close

End Sub
 
There are NO GRIP commands which support Parasolid operations including exporting models. The best that you could do is create an NX Open function that does support exporting a Parasolid file and call that from the GRIP program, but that's a bit obtuse considering the more modern tools that are now available.

That being said, I do need to clear up a few things. To start with with DO NOT confuse GRIP with Macros. GRIP is a true, albeit proprietary to UG/NX, programming language. And older GRIP programs will still run with newer versions of NX. In fact, I have a GRIP program that was written over 35 years ago that still runs today with the latest version of NX. Not one line of code has been changed. All I had to do was recompile and link it and it ran first time, performing the exact task that it was created for back in 1978 when I originally wrote it.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Digital Factory
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.
 
Sorry John, I was confused.

aek16, I found this thread you may be interested in: thread561-282269

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor