[API] PDMWorks Project tree translated to Windows folder tree

Hi All,

I would like to translate a PDMWorks Workgroup Project tree structure to a Windows folder tree structure in a dedicated folder For each project I would a folder in exactly the same tree structure

Did you have an API sample to do this ?

Thanks in advance

Regards

Nicolas

Reply to
Nicolas Rubin
Loading thread data ...

Hi Nico

you'll find this function useful :

'create a subfolder under root corresponding to p project 'root must have a trailing backslash like "C:\Documents and Settings \All Users\Documents\" Public Function CreateLocalPath(ByVal p As PDMWProject, root As String) As folder Dim path As String While Not p Is Nothing path = p.name + "\" + path Set p = p.parent Wend 'Set CreateLocalPath = fs.CreateFolder(root + path)' does not work because parent folders must exist so... '... let's build the whole structure: Dim stack As Variant: stack = Split(path, "\") path = "" Dim i As Integer For i = LBound(stack) To UBound(stack) path = path + stack(i) + "\" If Not fs.FolderExists(root + path) Then Set CreateLocalPath = fs.CreateFolder(root + path) Next i End Function

Your main code should look like this :

Option Explicit

Public connection As PDMWConnection Public fs As New Scripting.FileSystemObject

Sub main() Set connection = New PDMWorks.PDMWConnection Call connection.Login("pdmwadmin", "pdmwadmin", "localhost") ' your login Call connection.Refresh Dim projects As PDMWorks.PDMWProjects Set projects = connection.projects Dim prj As PDMWorks.PDMWProject For Each prj In projects

Call CreateLocalPath(prj, "C:\Temp\") Next prj

Reply to
Philippe Guglielmetti

Maybe I am missing something here, (it is late in the day here!), but even if you have the folder tree the same as Pdmworks, when you check out the full assembly, all of the documents will still open up into the one folder and not into the sub folders as stored in Pdmworks.

Please correct me if I am wrong.

Reply to
pete

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.