Hi,
I have made a tool to align the structure of our projects between all disciplines:
- electrical
- mechanical
- HVAC
- PLC
this tool can then create based on the project structure, the templates I did over the last 2 years, and the provided project structure with a own "CopyTree" macro the Project assembly with all subassemblies and the devices that we need, located in the right spaces where we need them.
Due that the CopyTree (especially the table on the bottom) can´t be controlled completly via the API, I had to figure out a work around... so by the provided structure the tool now
- creates the right folders and subfolders in PDM
- makes copy tree on the templates
- creates new document numbers
- "kill all PDM Processes" at least in theory
- opens Solidworks
- load the right subassemblies into the right assembly (no mates, everything on origin and fixed, that´s how I want it to be)
- rebuild everything
- saves the assembly Not able to because the files are "opened in another application" (some PDM Processes in the Background)
- close Solidworks
- CheckIn the files Again doesn´t work "opened in another application" (had this result already before using Solidworks in it, hoped it will change something)
- Rename Files based on the provided project structure and with an unique FileNumber
- Move Files to the right subfolders.
Yesterday it worked 1 time, but the next run it was blocked again by some processes.
does anybody know how to kill all background processes of PDM?
public static void KillBackgroundProcesses()
{
string[] knownPdmNames = new[]
{
"conisio", // Klassischer PDM-Prozess
"edmserver", // Eventuell bei älteren Clients
"pdmworks", // Falls ältere Addins verwendet werden
"solidshell", // Selten, aber aktiv bei PDM Shell-Zugriffen
"solworksPDM", // Fallback, falls Windows "SOLIDWORKS PDM" anzeigt
"Solidworks PDM", // Fallback, falls Windows "SOLIDWORKS PDM" anzeigt
};
int killed = 0;
foreach (var proc in Process.GetProcesses())
{
string pname = proc.ProcessName.ToLowerInvariant();
if (knownPdmNames.Any(id => pname.Contains(id)))
{
try
{
proc.Kill();
killed++;
Debug.WriteLine(\$"[PDM-KILL] Prozess beendet: {proc.ProcessName} (ID: {proc.Id})");
}
catch (Exception ex)
{
Debug.WriteLine(\$"[PDM-KILL] ❌ Fehler beim Beenden von {proc.ProcessName}: {ex.Message}");
}
}
}
Debug.WriteLine(\$"[PDM-KILL] ✅ {killed} PDM-Prozesse wurden beendet.");
}
sorry for the German in the code 😃