Converting a UG assembly file into a single part file with component names and attributes
Converting a UG assembly file into a single part file with component names and attributes
(OP)
We have to upload our asm files into our OEM teamcenter. We have been getting away with putting our asm files in as bulk parasolid files. The oem now wants us to supply individual part files because when they open the file all the see is "body" in the part navigator. I have been going through this site trying to find a journal or work around with no luck. What i need is a way that i can get a single file with with parasolids that show the component name, has material associated with it. I know you can do this manually but there is no association and will have to be done every time we put somehting in teamcenter. We have attributes in the file sucha as DB_PART_NAME and P_MAT that i would like to be added to the solids. Ive tried wave and that only shows as linked body and doesn't have the part name or material. Catia has a function called generate CATPART from PRODUCT that that converts an asm file into a single part file and names the bodys the file names. This is what i need in UG.





RE: Converting a UG assembly file into a single part file with component names and attributes
Sounds like the OEM wants native NX files, not parasolids...
www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
Turn off Timestamp Order in the Assy Navigator
From the Assy Navigator, select a body that you wish to add attributes
Add attributes to the body's properties (i.e. DESC, CALLOUT, etc) or you can simply name the body under the General tab
Repeat for each part body
Turn Timestamp Order back on
Hope this helps!
“Know the rules well, so you can break them effectively.”
-Dalai Lama XIV
RE: Converting a UG assembly file into a single part file with component names and attributes
Where is the turn off time stamp order? I'm not seeing it. So are you wave linking an assembly file into a single part file? I've tried this and it only displays as linked bodies. Trying to find something that is somewhat automated like a journal or grip program. We have a lot of assemblies with up 30 separate stampings and having to select each individually and assign part attributes would be very time consuming. I'll try your method just need to find turn off time stamp.
RE: Converting a UG assembly file into a single part file with component names and attributes
1) RMB over the desired body and pick Properties
2) Choose the General tab and assign a feature name. This will appear when you hover the curser over the body in modeling, the same as generic block would show "Block".
3) Yes, it can seem time consuming, but as with much in NX once you get the flow down it moves quickly.
If you wish to automatically populate a parts list with these bodies, you need to include the Timestamp Order step. RMB over the "Name" row in the Part Navigator - you should see a check box for timestamp order.
You don't have to wave-link the bodies to do this; I included them only as an explanation of how to get assy dwg balloons and the parts list to both update properly when wave-linked bodies are used in an assy.
“Know the rules well, so you can break them effectively.”
-Dalai Lama XIV
RE: Converting a UG assembly file into a single part file with component names and attributes
www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
NXOpen.NXException: Modeler error: argumant is still referenced. Any ideas what's up?
RE: Converting a UG assembly file into a single part file with component names and attributes
Did you run the journal on the same part, selecting the same components the 2nd time? If not, what was different on the 2nd run?
www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
If you run this journal then open the parasolid file directly (change the file open type to ".x_t"), it will open a parasolid assembly where the assembly structure is preserved, but component names have been appended with a parasolid ID such as "_id##_x_t". Individual component files will be created. In the individual parasolid component files (part files that contain a single "body" feature), the name will show up in the feature tree whether or not you are in timestamp mode.
If you import the resulting parasolid file into a new part file, the names will only show up if you are not in timestamp mode. This method does not create individual component files (in your original post, it sounded like you wanted individual files). However, if this approach is acceptable, I might be able to write a secondary journal that would copy the "body" names to the corresponding "feature" names.
Which would you prefer? Open the parasolid file directly, component files are created and named; or import the parasolid and have multiple body features in a single file?
www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
I saw the thread
thread561-316531: Parasolid Export Naming: Parasolid Export Naming
and found it useful for my work. Is it possible for you to modify the vb code to rename the Body(0), Body(1) features instead of Timestamp bodies, with component names? If there are two bodies in a component, let it rename all bodies with the same component name.
RE: Converting a UG assembly file into a single part file with component names and attributes
im a permanent follower od this tread, I have a (used) an other option with step to bring the right name to v5.
I have defined the step attributes PRDCT_ID and PRDCT_DESCRIPTION on nx part level to bring them to catia or any other cad system with step.
This discussed is an alternative way. Question to cowski can I automate to put (all) part attributes to the solid body on the model reference set?
Thanks in advance
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
CODE
Option Strict Off Imports System Imports System.Collections.Generic Imports NXOpen Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() Dim partBodies As New List(Of Body) 'grab all the solid bodies For Each tempBody As Body In workPart.Bodies If tempBody.IsSolidBody Then partBodies.Add(tempBody) End If Next 'if the solid body has a name, 'get the parent feature and give the feature the same name For Each tempBody As Body In partBodies If tempBody.Name <> "" Then Dim parentFeatures() As Features.Feature parentFeatures = tempBody.GetFeatures 'lw.WriteLine("body name: " & tempBody.Name) 'lw.WriteLine("num parent features: " & parentFeatures.Length.ToString) 'lw.WriteLine("") parentFeatures(0).SetName(tempBody.Name) End If Next End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image when the NX session terminates GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination End Function End Modulewww.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
Let me make sure I understand the question.
You want to take each part attribute and assign it to each solid body that is currently in the model reference set. Is this correct?
www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
yes, you got it,
regards
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
my idea behind is to offer an all catpart the people in v5/many viewers like in downstream process... one single catpart file from step.
regards
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
thats no problem the following workflow:
Activate your to assembly level put everything you want to have in your all catpart in to show.
goto file export part choose new a name for the allcatpart.prt
object scope to all objects
class selection to body select all
optional remove parameters -> Ok
thats all -
a one click solution can be done with a journal but its no problem to create an all catpart in nx.
historic in unigraphics we pulled it to parasolid in V5 the workaround was the allcatpart
in V5 there's nothing like parasolid - does anybody save as cgm(the v5 kernal base / not the grapfic format) ?
regards
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
with the object name size...
regards
NX 7.5.3.3
64 bit
RE: Converting a UG assembly file into a single part file with component names and attributes
CODE
Option Strict Off Imports System Imports System.Collections.Generic 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 New List(Of NXOpen.Tag) Dim strParasolid As String lw.Open() strParasolid = workPart.FullPath strParasolid = Left(strParasolid, Len(strParasolid) - 4) strParasolid = strParasolid & ".x_t" If My.Computer.FileSystem.FileExists(strParasolid) Then Try My.Computer.FileSystem.DeleteFile(strParasolid) Catch ex As Exception lw.WriteLine(ex.GetType.ToString & " : " & ex.Message) lw.WriteLine("journal exiting") Exit Sub End Try End If 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 If obj.OwningComponent.DisplayName.Length > 30 Then obj.SetName(obj.OwningComponent.DisplayName.Substring(0, 30)) Else obj.SetName(obj.OwningComponent.DisplayName) End If Else If obj.OwningPart.Leaf.Length > 30 Then obj.SetName(obj.OwningPart.Leaf.Substring(0, 30)) Else obj.SetName(obj.OwningPart.Leaf) End If End If tagList.Add(obj.Tag) Next ufs.Ps.ExportData(tagList.ToArray, 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 Modulewww.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
Any chance to modify this journal to assign Material properties to the solid bodies. What you have done so far is great. Problem now is assigning the same material that was in the original file. Many of our parts in the asm have different materials assigned. It leaves room for error. The attribute is P_MAT. I don't know how to do it.
Thanks
RE: Converting a UG assembly file into a single part file with component names and attributes
www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
CODE -->
Option Strict Off Imports System Imports System.Collections.Generic 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 New List(Of NXOpen.Tag) Dim strParasolid As String lw.Open() strParasolid = workPart.FullPath strParasolid = Left(strParasolid, Len(strParasolid) - 4) strParasolid = strParasolid & ".x_t" If My.Computer.FileSystem.FileExists(strParasolid) Then Try My.Computer.FileSystem.DeleteFile(strParasolid) Catch ex As Exception lw.WriteLine(ex.GetType.ToString & " : " & ex.Message) lw.WriteLine("journal exiting") Exit Sub End Try End If 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 If obj.OwningComponent.DisplayName.Length > 30 Then obj.SetName(obj.OwningComponent.DisplayName.Substring(0, 30)) Else obj.SetName(obj.OwningComponent.DisplayName) End If Else Dim Attribute As String Attribute = workPart.GetStringAttribute("DESCRIPTION") If obj.OwningPart.Leaf.Length > 30 Then obj.SetName(Attribute) Else obj.SetName(Attribute) End If End If tagList.Add(obj.Tag) Next ufs.Ps.ExportData(tagList.ToArray, 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 ModuleRE: Converting a UG assembly file into a single part file with component names and attributes
CODE
Attribute = workPart.GetStringAttribute("DESCRIPTION")I think you want:
CODE
Attribute = obj.OwningComponent.GetStringAttribute("DESCRIPTION")www.nxjournaling.com
RE: Converting a UG assembly file into a single part file with component names and attributes
RE: Converting a UG assembly file into a single part file with component names and attributes
the parasolid created "remember" the original name
for example: part name "2430_cylinder" ---> merkle_xmdesf_sasd
worst with more solids into the part "2430_cylinder" --> create more parts merkle_rod,merkle_block_merkle_o-ring.