EPDM: creation of files according to Excel file

Hello

we have a large list of library files that we want to import into EPDM with autofill of the card.

The idea would be to create an SLDPRT file with file numbering according to our configured numbering, and then populate the EPDM map with the data in the table.

Is there a way/utility to do this? We have myCADtools with Visiativ but I can't find a suitable program.

Cdt

Hello

I don't know enough about MyCadTools tools but when I read " DataRecovery: Bulk archive data and metadata from a Windows tree in the vault " it sounds like what you want to do, doesn't it?

If no tool meets your needs, it is possible to do it programmatically but it starts to make a nice little program, it may be better to get closer to your dealer.

Kind regards

Hello

Having already handled the chest quite a bit with excel macros, I think it can be done quite easily. I don't remember where I read this but it seems to me that MyCADTools allows you to update the files from the map data which would allow you to run the excel macro to fill in the SQL database and then update the files.

Otherwise, doing everything in one macro is doable.

It's in the PDMProperties options

1 Like

In fact, I know how to apply variables to files from an excel table (or not), there are software developed for it (BatchProperties, Intergration). 

On the other hand, none of them seem to be able to create the SLDPRT file.

Basically, I want to make my excel file with all the variables, and send it to EPDM. From then on, he takes care of creating the SLDPRT file, filling in the map and archiving.

Today, I have to create the empty files, archive them, then send my excel file to fill in the variables automatically.

If I read correctly, your files are already existing but outside of Epdm and probably misnamed (" we have a large list of library files that we want to import into EPDM with autofill of the card. "). So what you're looking to do would be to copy the files from a Windows folder to Epdm by renaming them and then assigning them their variables?

From memory, you have to create an empty template file archived in the vault in order to copy it to another folder and rename it while applying the variables to it in the process.

I don't have this amcro anymore because we don't need it anymore but by compiling different codes it can be easily redone.

 

It must therefore depend on the Epdm settings because on my side, copy Windows file to Epdm, archive by keeping extracted from this file, update variables, archive ... It works well. However, you have to pay attention to the latency period between copying the file and adding it to the vault.

No, no, the file doesn't exist. I want it to be created automatically. I don't have any files, just an excel list of codes to create. I want the file creation to be automatic as well.

We come back to what Cyril.f said above, you have to create a template file, copy it under its new name, apply its variables to it and then archive it.

For copying, see http://help.solidworks.com/2014/English/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmFolder5~CopyFile.html

To work on variables, see http://help.solidworks.com/2014/English/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmEnumeratorVariable8.html

For archiving, see http://help.solidworks.com/2014/English/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmFile5~UnlockFile.html

Kind regards

1 Like

OK. I wanted to avoid macro to save a little time, but when I have to!

Thank you very much:)

Some of the codes (didn't have time to compile everything in one so I'll have to adapt)

Renaming:

Dim sRename As String
Dim vault As EdmVault5
Dim folder As IEdmFolder6
Dim file As IEdmFile6
Dim sPathName As String
Dim sNewName As String
Dim sActualName As String

Sub main()
Set vault = New EdmVault5
vault.LoginAuto "xxx", 0
I = 7
Do While Cells(I, 1) <> ""
    sReference = Cells(I, 1).Value
    sFolder = Cells(I, 5).Value
    sRename = Cells(I, 12).Value
    Set folder = vault.GetFolderFromPath(sFolder)
    Set file = folder.GetFile(sReference)
    file.Rename 0, sRename, True
    I = I + 1
Loop
DoEvents
I = 0
End Sub

Moving a file:

Sub MoveFile()
Set vault = New EdmVault5
vault.LoginAuto "xxx", 0
I = 7
Do While Cells(I, 1) <> ""
    Reference = Cells(I, 1).value
    Source = Cells(I, 11).value
    Destination = Cells(I, 5).value
    Set Folder = vault.GetFolderFromPath(Source)
    Set file = Folder.GetFile(Reference)
    Set dest = vault.GetFolderFromPath(Destination)
    file.Move 0, Folder.ID, dest.ID, 0
I = I + 1
Loop
End Sub

Map Updates

Sub UpdateTDM()

Set vault = New EdmVault5
vault.LoginAuto "xxx", 0

i = 2
Do While Cells(i, 11) <> ""
    Set folder = vault.GetFolderFromPath(Cells(i, 5))
    Set file = vault.GetFileFromPath(Cells(i, 5) & "\" & Cells(i, 1))
    file.LockFile folder.ID, 0
    Set pEnumVar = file.GetEnumeratorVariable
    pEnumVar.SetVar "xxx", "", Cells(i, 12) 'Mettre le nom de la variable
    pEnumVar.SetVar "xxx", "", Cells(i, 13) 'Mettre le nom de la variable
    pEnumVar.SetVar "xxx", "", Cells(i, 11) 'Mettre le nom de la variable
    pEnumVar.CloseFile (True)
    file.UnlockFile folder.ID, "Ajout réf, désignation et indice" 'Si archivage dans la foulée se servir de cette ligne sinon supprimer 
    Cells(i, 14).value = "Traité"
i = i + 1
Loop
End Sub

I can be in support if needed but not totally available.

1 Like

I omitted, copy by renaming in passing (more automated than copying then renaming)

Dim vault As EdmVault5
Dim folder As IEdmFolder6
Dim destfolder As IEdmFolder6
Dim file As IEdmFile6

Sub CopyFile()
Set vault = New EdmVault5
vault.LoginAuto "xxx", 0
Set folder = vault.GetFolderFromPath("C:\xxx\yyy")
Set destfolder = vault.GetFolderFromPath("C:\xxx\zzz")
Set file = folder.GetFile("toto.sldprt")

destfolder.CopyFile file.ID, folder.ID, 0, "Rename.sldprt" 'ne pas omettre l'extension sinon fichier inexploitable

End Sub

 

Thank you very much, I'll exploit this and see what happens!