Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

nx journal to create Teamcenter folder

Status
Not open for further replies.

cschnei

Industrial
Aug 14, 2014
14
Hello,
I am using the ufs.Clone function to import Parts to Teamcenter. Here it is possible to derfine with ufs.Clone.SetDefFolder (user_name + ":" + import_folder) the destination folder for the parts. If it does not exist, this folder is created automatically.
I have to copy these parts to several additional Teamcenter folders. For existing folders it is no problem to copy these new parts also to different TC folders with ufs.Ugmgr.AddToFolder(database_part_tag, rootfolder_tag). My problem is, if the destination folder does not exist.
Does anyone know how to create an empty folder in Teamcenter with a journal?

Thanks in advance
Carsten
 
Replies continue below

Recommended for you

Carsten,
Do you have an example on how the ufs.Clone works. I'm trying to create a folder in TC and want to try this way, but when I try to run it in NX I get a message that "The Clone operation has not been initialised" (with an S instead of a Z).
How does one initialise the clone operation?

Thanks!
Alex H
 
Hello Alex,
I think you forgot to initialise the clone operation. Here is a snippet of the code I use to import all parts of a selected OS Folder to a specified Teamcenter folder:

ufs.Clone.Terminate()
ufs.Clone.Initialise(UFClone.OperationClass.ImportOperation)
ufs.Clone.SetFamilyTreatment(UFClone.FamilyTreatment.StripFamilyStatus)
ufs.Clone.setDefNaming(UFClone.NamingTechnique.Autogen)
ufs.Clone.SetDefDirectory(pathsave)
ufs.Clone.SetDefAction(UFClone.Action.Overwrite)
ufs.Clone.SetLogfile(pathsave + "clone.txt")
ufs.Clone.SetDefAssocFileCopy (False)
ufs.Clone.SetDefFolder (user_name + ":" + import_folder)


Dim di As New IO.DirectoryInfo(pathsave)

Dim lFiles As IO.FileInfo() = di.GetFiles("*.prt")

Dim fi As System.IO.FileSystemInfo

Dim foundfile As IO.FileInfo

' get the files in the directory

For Each foundFile In lFiles


OS_FileName = foundFile.name.Remove(foundFile.name.Length - 4, 4)
ufs.Clone.AddAssembly(pathsave + foundfile.name, load_status)
ufs.Clone.AddPart(pathsave + foundfile.name)
ufs.Clone.setNaming(foundFile.name, UFClone.NamingTechnique.Autogen, OS_FileName)
ufs.Clone.SetPdmDesc(foundfile.name, OS_FileName)
ufs.Clone.SetPdmName(foundfile.name, OS_FileName)
ufs.Clone.SetAssocFileCopy (foundfile.name, False)

Next
Dim naming_failures As UFClone.NamingFailures = Nothing
ufs.Clone.setdryrun (false)
ufs.Clone.GenerateReport()
ufs.Clone.PerformClone (naming_failures)
ufs.Clone.Terminate()

I hope this helps.
Carsten
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor