• Abfrage über Ja/Nein Dialog ob die Unsichtbaren Elemente gedruckt werden sollen…
  • Einstellung wird gesetzt
  • Verbindungen werden aktualisiert
  • Dann öffnet sich der normale Drucken-Dialog (kann man nur auf das gesamte Projekt ausführen nicht auf “Markierte Seiten”)
  • Einstellung wird bis zum nächsten starten des Buttons gespeichert.

Falls ihr den Druckdialog nicht starten möchtet dann löscht oder Kommentiert Zeile 58+59.

Suplanus - Scripts - Print-invisible-Objects (76)

Diskussionsthread P8-Magic.de

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
public class PrintInvisibleObjects
{
    [DeclareAction("PrintInvisibleObjects")]
 
    public void PrintInvisibleObjectsVoid()
    {
 
        ////////////////////////////////////////////////////////////////////////
        // Allgemeine Funktionen
        ////////////////////////////////////////////////////////////////////////
 
        // Projektdatei, Projektpfad, Projektname
        string sSelectedProjectData = string.Empty;     // kompletter Pfad + Projektdateinamen + Erweiterung
        string sSelectedProjectName = string.Empty;     // Projektname
 
        // Projektdatei komplett
        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        Eplan.EplApi.ApplicationFramework.ActionCallingContext ctx = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
        ctx.AddParameter("TYPE", "PROJECT");
 
        bool bRet = oCLI.Execute("selectionset", ctx); // Action: Projektpfad
        if (bRet == true)
        {
            ctx.GetParameter("PROJECT", ref sSelectedProjectData);
        }
 
        // Projektname
        sSelectedProjectName = System.IO.Path.GetFileNameWithoutExtension(sSelectedProjectData);
 
        ////////////////////////////////////////////////////////////////////////
        // Yes/No Abfrage
        ////////////////////////////////////////////////////////////////////////
 
        // Setting
        Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); 
 
        // Dialog
        DialogResult oDialogResult = new DialogResult();
        oDialogResult = MessageBox.Show("Sollen unsichtbare Elemente gedruckt werden?", "Drucken [" + sSelectedProjectName + "]", MessageBoxButtons.YesNo);
 
      if (oDialogResult == DialogResult.Yes )
        {
            // Ja
            oSettings.SetBoolSetting("USER.GedViewer.Print.PrintInvisibleObjects", true, 0);
        }
 
        else
        {
            // Nein
            oSettings.SetBoolSetting("USER.GedViewer.Print.PrintInvisibleObjects", false, 0);
        }
 
        // Verbindungen aktualisieren
        oCLI.Execute("EsGenerateConnections");
 
        // Drucken-Dialog öffnen
        oCLI.Execute("PrnPrintDialogShow");
 
        return;
    }
 
    [DeclareMenu]
    public void MenuFunction()
    {
        uint intIDUntermenue1;                                         // MenuID
        Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
        intIDUntermenue1 = oMenu.AddMainMenu(
            "ePlanus",                                                     // Hauptmenüname
            "Hilfe",                                                       // neben Menüpunkt...
            "< ePlanus.de >",                                              // Menüpunktname
            "ePlanus",                                                     // Action
            "ePlanus.de - Scripting in Eplan ist einfach (toll)",          // Statustext
            1                                                              // Hinter Menüpunkt x
        );
        // Untermenüpunkte
        oMenu.AddMenuItem(
            "Print invisible objects...",                                   // Menüpunktname
            "PrintInvisibleObjects",                                        // Action
            "Sollen unsichtbare Elemente gedruckt werden?",                 // Statustext
            intIDUntermenue1,                                               // Menü-ID
            1,                                                              // 1 = Hinter Menüpunkt X
            false,                                                          // Seperator davor
            false                                                           // Seperator dahinter
        );
 
    }
 
}