Dieses Script öffnet die eingegebene Seite.
Die aktuelle Seite wird bereits im Formular gefüllt. Es kann jede Struktur einzeln gefüllt werden oder der komplette Seitenname geändert werden.
Hintergrund dafür ist, dass meine Eplan-Zeichner von WSCAD (anderes Zeichenprogramm) kommen… Dort konnte man mit STRG-G zu einer bestimmen Seite springen.
Da das ganze in die ePlanus Toolbar geladen wird, ist es auch möglich eine Tastenkombination festzulegen.
Zu beachten:
  • Dokumentenart darf nicht vorne stehen
  • Falls das Anlagennummerkennzeichen mehr als ein Zeichen besitzt muss das im Script angegeben werden
  • Ansonsten ist die Struktur frei wählbar


Danke an Nairolf für den Gedankenanstoß  (manchmal braucht man sowas)

Installation:

Script laden

  • Unter Dienstprogramme/Eigenschaften extern bearbeiten/Seiten exportieren… das angefügte Schema “PXexP.ePlanus_OpenPage.xml” importieren
  • Unter Projekteigenschaften Blockeigenschaft 100 für Seiten festlegen (Am besten im Basisprojekt, dadurch ist diese Eigenschaft dann immer Verfügbar, im Anhang)


Suplanus - Scripts - OpenPage (74)

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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
 // Action
    [DeclareAction("OpenPage")]
 
    public void OpenPageVoid()
    {
        ////////////////////////////////////////////////////////////////////////
        // Open dialog
        ////////////////////////////////////////////////////////////////////////
        string sProjectname = PathMap.SubstitutePath("$(PROJECTNAME)");
 
        FrmOpenPage Frm1 = new FrmOpenPage();
        Frm1.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
 
        // Titel
        Frm1.Text = "OpenPage [Project: " + sProjectname + "]";
 
        Frm1.ShowDialog();
        return;
    }
 
    private void FrmOpenPage_Load(object sender, System.EventArgs e)
    {
        ////////////////////////////////////////////////////////////////////////
        // Loading dialog
        ////////////////////////////////////////////////////////////////////////
 
        // Select Page
        new CommandLineInterpreter().Execute("XGedSelectPageAction");
 
        // Pagename Tempdata
        string sPageNameFile = @"C:\TEMP\OpenPageTemp.txt";
 
        // Export Pagename
        ActionCallingContext contextPageName = new ActionCallingContext();
        contextPageName.AddParameter("ConfigScheme", "ePlanus - OpenPage");
        contextPageName.AddParameter("Destination", sPageNameFile);
        contextPageName.AddParameter("ExecutionMode", "0");
        new CommandLineInterpreter().Execute("XMExportPagesAction", contextPageName);
 
        // Get Line in Tempdata
        string sLine3 = "";
        int iLine = 3;
        float fRow = 0;
        if (File.Exists(sPageNameFile))
        {
            StreamReader myFile = new StreamReader(sPageNameFile, System.Text.Encoding.Default);
            while (!myFile.EndOfStream && fRow < iLine)
            {
                fRow++;
                sLine3 = myFile.ReadLine();
            }
            myFile.Close();
            if (fRow < iLine)
                sLine3 = "";
        }
 
        // Split Line
        string[] slPageLine = sLine3.Split('\t');
 
        // Split Parameters
        string[] slPageParameters = slPageLine[2].Split(';');
        // 0 = Function
        // 1 = Plant
        // 2 = Location
        // 3 = Mount location
        // 4 = Plantnumber
        // 5 = Document
        // 6 = Defined by User
        // 7 = Pagename
        // 8 = FullPagename
 
        // Split Function
        txtFunction.Text = slPageParameters[0].Substring(2);
 
        // Split Plant
        txtPlant.Text = slPageParameters[1].Substring(1);
 
        // Split Location
        txtLocation.Text = slPageParameters[2].Substring(2);
 
        // Split Mount location
        txtMountLoc.Text = slPageParameters[3].Substring(1);
 
        // Split Plantnumber
        txtPlantNr.Text = slPageParameters[4].Substring(1); // Plantnumber = 1 Char (2 Chars = "2")
 
        // ---> Split Plantnumber identifier
        string sPlantNrIndex = slPageParameters[4].Substring(0, 1); // Plantnumber = 1 Char (2 Chars = "0, 2")
        txtPlantNrIndex.Text = sPlantNrIndex; // Plantnumber
 
        // Split Document
        txtDocument.Text = slPageParameters[5].Substring(1);
 
        // Split Defined by User
        txtUserDef.Text = slPageParameters[6].Substring(1);
 
        // Split Pagename
        txtPagename.Text = slPageParameters[7];
 
        // Split FullPagename
        txtFullPagename.Text = slPageParameters[8];
 
        txtFullPagename.Select();
 
    }
 
    public void btnOK_Click(object sender, System.EventArgs e)
    {
        ////////////////////////////////////////////////////////////////////////
        // Button: OK
        ////////////////////////////////////////////////////////////////////////
 
        Refresh();
 
        // Open Page
        ActionCallingContext context = new ActionCallingContext();
        context.AddParameter("PAGENAME", txtFullPagename.Text);
        new CommandLineInterpreter().Execute("edit", context);
 
        // Close Form
        Close();
        return;
    }
 
    private void btnAbbrechen_Click(object sender, System.EventArgs e)
    {
        ////////////////////////////////////////////////////////////////////////
        // Button Cancel
        ////////////////////////////////////////////////////////////////////////
 
        Close();
        return;
    }
 
    public void GetPagename()
    {
        ////////////////////////////////////////////////////////////////////////
        // Generate new pagename
        ////////////////////////////////////////////////////////////////////////
 
        // Function
        if (txtFunction.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "==" + txtFunction.Text;
        }
 
        // Plant
        if (txtPlant.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "=" + txtPlant.Text;
        }
 
        // Location
        if (txtLocation.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "++" + txtLocation.Text;
        }
 
        // Mount location
        if (txtMountLoc.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "+" + txtMountLoc.Text;
        }
 
        // Plantnumber
        if (txtPlantNr.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + txtPlantNrIndex.Text + txtPlantNr.Text;
        }
 
        // Document
        if (txtDocument.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "&&" + txtDocument.Text;
        }
 
        // Defined by User
        if (txtUserDef.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "#" + txtUserDef.Text;
        }
 
        // Pagename
        if (txtPagename.Text != "")
        {
            txtFullPagename.Text = txtFullPagename.Text + "/" + txtPagename.Text;
        }
 
        return;
    }
 
    ////////////////////////////////////////////////////////////////////////
    // Keyevent
    ////////////////////////////////////////////////////////////////////////
    private void keyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)13)
        {
            // Open Page
            ActionCallingContext context = new ActionCallingContext();
            context.AddParameter("PAGENAME", txtFullPagename.Text);
            new CommandLineInterpreter().Execute("edit", context);
 
            // Close Form
            Close();
            return;
        }
    }