×
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

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

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

Quote:

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.

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

(OP)
They want to be able to select a body and be able to tell what component it is. There is only one OEM part number for the assembly and technically that is all we supply. Our assembly we design is broken up into individual stampings that our plants make. We do not want to maintain 2 sets of data and temacenter is really slow. We want something that we can just combine into one file that shows oue assembly structure. I like UG a lot more than Catia but the CATPART function in CATIA is verry nice.

RE: Converting a UG assembly file into a single part file with component names and attributes

Here is the workflow I have been using for bodies in weldments or linked bodies...

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

(OP)
EWH,
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

If you only require that the bodies have descriptive names and don't need to populate a parts list, follow this work flow...

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

(OP)
Thanks Cowski. I tried that yesterday but it didn't seem to do what i wanted. After i toggled the Part Navigator/ timestamp that EWH mentioned i see that it shows the component names. Awsome! That is what i was looking for. Is there a way to modify the journal to have it load the material properties?

RE: Converting a UG assembly file into a single part file with component names and attributes

(OP)
Cowski, I ran that journal the first time and it worked great. Went to run it agoin and i get a
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

What version of NX are you using?
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

(OP)
Cowski, it seems to be running fine now. We are NX7.5 but switching to 8.0 next week. I think the problem might have been that it can't overwrite a file that already exists. Not sure. Still trying to figure out some of this journal terminology. I'd like this journal to name the bodies the component name without have to switch the part navigator to "timestamp order". That way no matter who opens it the solid bodies would have the component name displayed. Any ideas?

RE: Converting a UG assembly file into a single part file with component names and attributes

Quote (gcrow)

I'd like this journal to name the bodies the component name without have to switch the part navigator to "timestamp order". That way no matter who opens it the solid bodies would have the component name displayed. Any ideas?

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

Hi Cowski,

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

Hi guys,
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

(OP)
Hey Cowski, I do not want individual component files because that is what we are starting with. I basically am trying to only have to upload one bulkfile part file into teamcenter with solid bodies that have the original component names that they were created from. This way we only have to maintain one file instead of 40. Our supplier has a lot of checks that each file must go through that take up a lot of time. Thanks.

RE: Converting a UG assembly file into a single part file with component names and attributes

(OP)
Crowski, I guess i didn't answer your question "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?" I would prefer import the parasolid and have multiple body features in a single file. Thanks.

RE: Converting a UG assembly file into a single part file with component names and attributes

Run the previous journal to name the solids and export them as a parasolid file. Run the code below after importing the parasolid to a new file to give the features the same name as the corresponding solid body.

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 Module 

www.nxjournaling.com

RE: Converting a UG assembly file into a single part file with component names and attributes

Quote (uwam2ie)

Question to cowski can I automate to put (all) part attributes to the solid body on the model reference set?

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

thanks Cowski on reply,
yes, you got it,
regards

RE: Converting a UG assembly file into a single part file with component names and attributes

(OP)
Thanks Cowski! This does what i was looking for. Now hopefully our cutomers will like it. I am also interested in the assigning attributes from the the component files to the body like uwam2ie. Right now after i run the 2 journals i have to assign materials to all bodies. Would be if the material and gauge attribute came for the ride, but i'm not pushing it. What you've already done saves a ton of time.

RE: Converting a UG assembly file into a single part file with component names and attributes

@grow
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

(OP)
It would be nice if UG had the allcat part function like catia.

RE: Converting a UG assembly file into a single part file with component names and attributes

@gcrow
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

(OP)
That doesn't do what i need. Catia names the bodies the file name. UG names them solid body with no reference to original component. Catia combines asm to one file with bodies named same as component (basically same as parasolid). The journal cowski wrote does what i need.

RE: Converting a UG assembly file into a single part file with component names and attributes

yes - we have the same problem, with the naming

RE: Converting a UG assembly file into a single part file with component names and attributes

Updated code that limits names to 30 characters.

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 Module 

www.nxjournaling.com

RE: Converting a UG assembly file into a single part file with component names and attributes

thx cowski

RE: Converting a UG assembly file into a single part file with component names and attributes

thx cowski !!

RE: Converting a UG assembly file into a single part file with component names and attributes

(OP)
Hey Cowski,
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

I believe that attribute information is lost in the parasolid export process. I know of no way to successfully assign attributes to exported parasolids and have them show up when you import the parasolid into a new file.

www.nxjournaling.com

RE: Converting a UG assembly file into a single part file with component names and attributes

(OP)
OK. Thanks Cowski.

RE: Converting a UG assembly file into a single part file with component names and attributes

Hi guys, Is it possible to assign components attribute value to exported bodies names. Each selected component has an attribute "Description" which I want to assign to exported body. I tried to modify the code a little bit. The problem is that it uses only work part attribute, not selected component attribute.


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 Module 

RE: Converting a UG assembly file into a single part file with component names and attributes

Instead of:

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

(OP)
Hey guys, Thanks for the help. Do I have to modify the field where it says ("DESCRIPTION") to the attribute name I want to apply? I'm getting "object reference not set to instance of object" error.

RE: Converting a UG assembly file into a single part file with component names and attributes

when i use a 3d imported from other system like cadenas partserver hasco merkle ecc..
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.

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