Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

journal to export all ensemble to parasolid WITH NAMES OF PARTS

Status
Not open for further replies.

elvin00

Industrial
Oct 27, 2018
3
Hi,
I usually work with this journal to export from NX to parasolid (all the ensemble with all the parts,maintaining the names of the parts): (works greats BUT ONLY WITH NX8 OR NX9 WHY DON'T WORKS WITH NX11 OR NX12???)

CAN SOMEBODY HELP ME? other journal?

Option Strict Off
Imports System
Imports System.Collections
Imports NXOpen
Imports NXOpen.UF

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 tags as new ArrayList
Dim strParasolid As String

lw.Open

strParasolid = workPart.FullPath
strParasolid = Left(strParasolid, Len(strParasolid) - 4)
strParasolid = strParasolid & ".x_t"

myResponse = SelectObjects(mySelectedObjects)
if (myResponse = Selection.Response.Cancel) OrElse (myResponse = Selection.Response.Back) then
'user canceled selection, exit journal
exit sub
end if

For each obj as Body in mySelectedObjects
if obj.IsOccurrence then
obj.SetName(obj.OwningComponent.DisplayName)
else
obj.SetName(obj.OwningPart.Leaf)
end if
tags.Add(obj.Tag)
Next

tagList = CType(tags.ToArray(GetType(NXOpen.Tag)), NXOpen.Tag())

ufs.Ps.ExportData(tagList, strParasolid)
lw.WriteLine("Output file: " & strParasolid)
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_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




 
Replies continue below

Recommended for you

I tested on NX 9 and NX 12; the results were the same in each case: a parasolid file is created in the directory of the part, with the same name as the part (except for the parasolid file extension); when imported to a new file, the body name is found to be the parent file name (leaf name for a part, display name of a component) of the original body.

What results are you getting?

www.nxjournaling.com
 
Ok, in NX opens correctly
Both in NX 9 or NX11. The problem I have when I open or import from another program (powershape in this case). When I import the parasolid of the NX 9 the names are kept but if I import the parasolid of the NX11 the names are lost.
 
Try with this enviroment variable:
UGII_EXPORT_TYSA_NAME_ATTRIBUTE = 1


----
kukelyk
 
great!!
thank you very much kukelyk
its workes perfectly

elvin00
 
I turned on the EVNT variable..Still do not see the name of solids in the Part Navigator.. Is there some column I need to configure or turn on in part navigator?

Do you open the parasolid or import it into a new NX part file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor