×
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

Journal to import assembly into Teamcenter with "Add Suffix"

Journal to import assembly into Teamcenter with "Add Suffix"

Journal to import assembly into Teamcenter with "Add Suffix"

(OP)
I’m pretty sure some of you are going to know what I’m doing wrong really quickly. I am trying to make a Journal that imports an assembly into Teamcenter, specifically with the Append or Add Suffix Rule Type. Let me explain a little more why I want to use this Rule Type.

I found that AutoTranslate won’t work because of the default naming rules that change the string after the last “_” (underscore) to a revision. For example, with AutoTranslate, model_1.prt and model_2.prt would be renamed to @DB/model/1 and @DB/model/2. So I get same Item, 2 revisions.

I did some “manual” testing by going into File -> Import Assembly into Teamcenter and by changing the Import numbering to Number Rule and changing the Numbering Rule to “Add Suffix”, and type a blank space in the Add String, and once it’s imported into Teamcenter, it keeps the same name, just adds the Revision according to my Revision Rules. So in this case, using the same example as above, model_1.prt and model_2.prt would import as @DB/model_1/A, and @DB/model_2/A (apparently without the blank space), which is 2 items, both on revision “A”. I would have thought that the result would be @DB/model_1 /A (a space in between the 1 and the /). But I was gladly surprised that the result was what I was looking for. Keeping the same “leaf” name if you will, just adding the revision.

So now I’m trying to create a Journal to do this behavior in a more automatic way. I’ve read some of the Programing API Documentation, but I’m not that good a programmer. And the Import Assembly can’t be recorded with the Journal commands so it’s not so simple.

Here is what I have so far. I’ve added commets to explain my reasoning hopefully making it more clear to someone with more experience what or where I’m going wrong.

CODE

Option Strict Off
Imports System
Imports System.IO
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.PDM

Module ModuleTC

    Sub Main()
        Dim theSession As Session = Session.GetSession()
        Dim theUI As UI = UI.GetUI()
        Dim ufs As UFSession = UFSession.GetUFSession()

        Dim naming_failures As UFClone.NamingFailures
        Dim naming_technique As UFClone.NamingTechnique
        Dim name_rule As UFClone.NameRuleDef 'Do I need this?
        Dim append As String = " "           'I want to append the blank space

        ufs.Clone.Initialise(UFClone.OperationClass.ImportOperation)
        ufs.Clone.AddPart("C:\temp\model_1.prt")
        ufs.Clone.SetDefAction(UFClone.Action.Overwrite)
        ufs.Clone.SetDefFolder("infodba:Newstuff:IMPORT")
        naming_technique = UFClone.NamingTechnique.NamingRule 'I want to use this rule, but where do I declare what will be appended?
        append = UFClone.NameRuleType.AppendString            'Is this the way to declare the string to be appended?

        '==== Do I need this? ====
        name_rule.base_string = "base string"
        name_rule.new_string = "new string"
        name_rule.type = UFClone.NameRuleType.AppendString
        '==== End Question ====

        naming_failures.n_failures = 0      'No idea what this does
        naming_failures.statuses = {0}      'No idea what this does 
        naming_failures.input_names = {""}  'No idea what this does
        naming_failures.output_names = {""} 'I think this is the output "error message" you'd get in the window if there is a problem

        ufs.Clone.PerformClone(naming_failures)
        ufs.Clone.Terminate()

    End Sub
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
    End Function

End Module 


Any insight on what I might be doing wrong will be greatly appreciated.
Best Regards!

RE: Journal to import assembly into Teamcenter with "Add Suffix"

(OP)
Sorry, NX 9 and TC 9.1

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