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 (1622 Downloads )
// 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;
}
}
Hinterlasse einen Kommentar