Es handelt sich um eine interne Action von EPLAN, welche offiziell nicht supported wird!
SVG ist ein tolles Format… Hab den Anwendungsfall dass ich SVG aus EPLAN brauche. Darum habe ich mir mal einen Helfer-Klasse geschrieben, damit der Zugriff einfacher ist:
public class SvgExportUtility { public static void ExportProject(Project project, string exportPath, bool isFrameVisible = true) { if (Directory.Exists(exportPath)) { Directory.Delete(exportPath); } ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("DatabaseId", project.DatabaseIdentifier.ToString()); acc.AddParameter("ExportPath", exportPath); acc.AddParameter("DrawFrame", isFrameVisible.ToString()); acc.AddParameter("WriteGroupIds", false.ToString()); new CommandLineInterpreter().Execute("SVGExportAction", acc); } public static void ExportPage(Page page, string fullFilename, bool isFrameVisible = true) { if (File.Exists(fullFilename)) { File.Delete(fullFilename); } ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("ExportPath", Path.GetDirectoryName(fullFilename)); acc.AddParameter("PageObjId", page.ToStringIdentifier()); acc.AddParameter("Filename", Path.GetFileNameWithoutExtension(fullFilename)); // only name needed acc.AddParameter("DrawFrame", isFrameVisible.ToString()); acc.AddParameter("WriteGroupIds", false.ToString()); new CommandLineInterpreter().Execute("SVGExportAction", acc); } public static void ExportPageMacro(Project project, string pageMacroFile, string fullFilename, bool isFrameVisible = true) { using (PageMacro pageMacro = new PageMacro()) { // Have to insert pages into project because its not working with pageMacro.Pages.First() pageMacro.Open(pageMacroFile, project); // Set temp structure for (var index = 0; index < pageMacro.Pages.Length; index++) { var pageMacroPage = pageMacro.Pages[index]; pageMacroPage.NameParts[Properties.Page.PAGE_COUNTER] = "SvgExportUtility" + index; } var storableObjects = new Insert().PageMacro(pageMacro, project, null, PageMacro.Enums.NumerationMode.None); var newPages = storableObjects.OfType().ToList(); for (var index = 0; index < newPages.Count; index++) { var newPage = newPages[index]; var path = Path.GetDirectoryName(fullFilename); var filename = Path.GetFileNameWithoutExtension(fullFilename) + "_" + (index + 1) + ".svg"; // ReSharper disable once AssignNullToNotNullAttribute filename = Path.Combine(path, filename); if (File.Exists(fullFilename)) { File.Delete(fullFilename); } ExportPage(newPage, filename, isFrameVisible); // Remove pages after export newPage.Remove(); } } } public static void ExportMacro(string macroFile, string fullFilename, int variant, WindowMacro.Enums.RepresentationType representationType) { if (File.Exists(fullFilename)) { File.Delete(fullFilename); } ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("MacroFile", macroFile); acc.AddParameter("Filename1", fullFilename); // Full path needed acc.AddParameter("Variant1", variant.ToString()); acc.AddParameter("RepType1", ((int)representationType).ToString()); acc.AddParameter("WriteGroupIds", false.ToString()); new CommandLineInterpreter().Execute("SVGExportAction", acc); } }
Das exportieren von Symbol- & Fenstermakros funktioniert auch im Scripting!
Ich habe auch mal ein kleines Beispiel-Addin geschrieben um die Funktionalitäten zu testen.
Hi Johann,
It has been a while since I visit you website.
I like the “sound” of this function and I’m still trying to find out what it does.
What do you mean with “The export of symbol and window macros also works in scripting!”?
On you help link there are namespaces you cannot use such as DataModel.
Not sure if I’m looking at this right.
Can you clarify?
Many thanks.
Stay safe
You can call the method `ExportMacro()` in scripting. The rest is only possible via API.