Hi,
I have created a TopDown Template for our projects, it has the minimum size for our projects but you can scale it up with more than one test beds etc.
In the past I did the setup for the colleagues, I used copy tree generated new serial numbers and changed on some files by hand individual prefixes and location for some of this files, like the project specific testbed names, subsystems that we manage in subassemblies etc.
now I am working on some kind of engineering app. after we align the names of testbeds, rooms etc. in one common room I want to use this for the Copy Tree job.
I managed to start the copy tree job but how can I change the file names and activate also the serial numbers in data cards.
this is just the base for the copyTree Macro, the names etc. will be controlled by a CopyItem class with a SerialNumber generator for the FileNumber
Please let me know which variables I have to control to change the TargetFileName, DestinationFolderPath per File und in general the checkmark for the serial numbers
using System;
using System.Collections.Generic;
using EPDM.Interop.epdm;
using PEngUIn.src.core.Pdm;
namespace PEngUIn.src.core.Pdm.Commands
{
public static class CopyTreeTest
{
public static void Run()
{
try
{
IEdmVault5 vault = new EdmVault5Class();
vault.LoginAuto("EPDM_Test", 0);
IEdmVault19 vault19 = (IEdmVault19)vault;
string sourcePath = @"C:\EPDM_Test\Projects\0000\111111_PEngUIn_Test\TestTemplate\TB_Template_F00836430.SLDASM";
string destFolder = @"C:\EPDM_Test\Projects\0000\111111_PEngUIn_Test\LAYOUTS";
IEdmFolder5 parentFolder;
IEdmFile5 file = vault.GetFileFromPath(sourcePath, out parentFolder);
if (file == null)
{
MessageBox.Show("❌ Datei nicht im Vault gefunden.");
return;
}
EdmCopyTreeOptions options = new EdmCopyTreeOptions
{
mbsPrefix = "Copy_",
mbsSuffix = "",
mbIncludeDrawings = -1,
mbUseLatestVersion = -1
};
vault19.CopyTree(file.ID, parentFolder.ID, destFolder, true, true, options, 0);
}
}
private static string ReplacePlaceholders(string template, CopyItem item)
{
return template
.Replace("{F}", item.DocumentNumber ?? "")
.Replace("{P}", item.ProjectNumber ?? "")
.Replace("{TB}", item.TestbedName ?? "")
.Replace("{R}", item.RoomName ?? "");
}
}
}
Thank you 4 your support