Unsere russischen Freunde von Eplan For All haben ein schönes Script geschrieben um die Raster-Größe anzupassen.
Download auf eplan4all.info
Vielen Dank!
// Ersteller (разработчик): madwolf_by aka Виталий
// Datum: 2014-08-18
// www.eplan4all.info - Eplan For All
using Eplan.EplApi.Base;
using System.Windows.Forms;
using Eplan.EplApi.Scripting;
using Eplan.EplApi.ApplicationFramework;
using System;
public class SetGrid
{
Settings oSettings = new Settings();
string sPath = "USER.Control.UserGridSize";
string sPath1 = "USER.Control.UserGridSizeMode";
[DeclareRegister]
public void Register()
{
if (!oSettings.ExistSetting(sPath))
{
if (!oSettings.ExistSetting(sPath))
oSettings.AddStringSetting(sPath, new string[] { }, new string[] { }, "Current Gridsize", new string[] { @"4" }, ISettings.CreationFlag.Insert);
// MessageBox.Show("Setting " + sPath + " registered");
}
if (!oSettings.ExistSetting(sPath1))
oSettings.AddBoolSetting(sPath1, new bool[1], "UserGridSizeMode", new bool[1], ISettings.CreationFlag.Insert);
return;
}
[DeclareUnregister]
public void UnRegister()
{
if (oSettings.ExistSetting(sPath))
{
oSettings.DeleteSetting(sPath);
// MessageBox.Show("Setting " + sPath + " unregistered");
}
}
[DeclareAction("SetUserGridSize")]
public void SetUserGrid(string GridSize)
{
if (oSettings.GetBoolSetting(sPath1, 0))
{
oSettings.SetStringSetting(sPath, GridSize, 0);
//MessageBox.Show("Incoming param " + oSettings.GetDoubleSetting(sPath, 0));
SetGridSizeToPage(GridSize);
}
else MessageBox.Show("Function is OFF", "SetGrid mode");
}
[DeclareAction("SetUserGridMode")]
public void SetUserGridMode()
{
oSettings.SetBoolSetting(sPath1, !oSettings.GetBoolSetting(sPath1, 0), 0);
if (oSettings.GetBoolSetting(sPath1, 0))
{
MessageBox.Show("Function is ON", "SetGrid mode");
}
else MessageBox.Show("Function is OFF", "SetGrid mode");
}
[DeclareEventHandler("onActionEnd.String.XGedNextPageAction")]
public bool MyEventHandlerFunction1(IEventParameter iEventParameter)
{
SetGridSizeToPage(oSettings.GetStringSetting(sPath, 0));
return true;
}
[DeclareEventHandler("onActionEnd.String.XGedPrevPageAction")]
public bool MyEventHandlerFunction2(IEventParameter iEventParameter)
{
SetGridSizeToPage(oSettings.GetStringSetting(sPath, 0));
return true;
}
[DeclareEventHandler("onActionStart.String.XPmPageOpenOnePage")]
public bool MyEventHandlerFunction3(IEventParameter iEventParameter)
{
SetGridSizeToPage(oSettings.GetStringSetting(sPath, 0));
return true;
}
public void SetGridSizeToPage(string paramValue)
{
if (oSettings.GetBoolSetting(sPath1, 0))
{
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext oACC = new ActionCallingContext();
string nameAction = "XEsSetPagePropertyAction";
oACC.AddParameter("PropertyId", "11051");
oACC.AddParameter("PropertyIndex", "0");
// MessageBox.Show("param from setting " + Convert.ToString(oSettings.GetDoubleSetting(sPath, 0)));
oACC.AddParameter("PropertyValue", paramValue);
oCLI.Execute(nameAction, oACC);
}
}
}
Hinterlasse einen Kommentar