Skript

InsertComment

Ein echtes Schmankerl von Frank…

Mit diesem Script können PDF-Kommentare nun auch in EPLAN platziert werden und man kann somit den Kommentarnavigator nutzen. Super im Multiuserbetrieb!

2015-02-02_21-57-48

Von |2022-01-10T08:24:48+01:002015-02-06|EPLAN, EPLAN-Scripts|

ShopForProcess

Heute gibt es mal eine große Ankündigung.
Seit August 2014 arbeite ich bei der Firma ibKastl als Consultant. Wir beraten Firmen bei der Installation bzw. Betreuung rund um das Thema EPLAN, Prozesse & Normen.

Mein Schwerpunkt liegt hier in der Programmierung, wie sollte es auch anders sein :^)

Wir haben zusammen mit Kunden einige praktische Scripte entwickelt und möchten diese nun auch mit allen EPLAN-Anwender teilen.

Hierfür haben wir den ShopForProcess eingerichtet und bieten dort kostenlose wie auch kostenpflichtige Scripte an.

BannerGear

Somit, falls jemand mal ein Script benötigt, aber selbst nicht programmieren kann, einfach melden und wir erstellen gerne ein Angebot.

Man könnte glauben dass es nun auf Suplanus keine Scripte mehr geben wird, das ist aber nicht der Fall. Eigentlich genau das Gegenteil. Dadurch dass ich nun wieder mehr mit Thema Scripting & EPLAN zu tun habe, entstehen viele Lösungen wie GetProjectProperty oder ScriptTest

 

Zu einigen Scripten haben wir ein Youtube-Video gemacht, um deren Funktion zu zeigen. Vielleicht ist was für den ein oder anderen dabei! Freue mich auch über jedes Feedback.

 

 

 

 

 

Von |2015-11-30T09:21:07+01:002015-02-02|EPLAN|

EPLAN Pong

Der Preis für die beste EPLAN Erweiterung geht an Daniel Papp!

Das ganze funktioniert als API-Addin und ist auf Github zu finden. Einfach klasse :^)

Von |2017-11-09T12:23:54+01:002014-11-26|EPLAN, EPLAN-API|

GetProjectProperty

Info: Es gibt eine neue Version von diesem Script.

Mit diesem Script könnt ihr einzelne Projekteigenschaften lesen.

Als Parameter habe ich mich für string entschieden, da zum Setzen der Projekteigenschaft die ID auch als String übergeben werden muss.

Verwendung:

string value = GetProjectProperty(Id, Index);

Die Methode muss im verwendeten Script vorhanden sein:

private static string GetProjectProperty(string id, string index)
{
	string value = null;
	ActionCallingContext actionCallingContext = new ActionCallingContext();
	actionCallingContext.AddParameter("id", id);
	actionCallingContext.AddParameter("index", index);
	new CommandLineInterpreter().Execute("GetProjectProperty", actionCallingContext);
	actionCallingContext.GetParameter("value", ref value);
	return value;
}

Das Script GetProjectProptery.cs laden und das Schema (GetProjectProperty_Template.xml) im Ordner Scripte/GetProjectProperty abspeichern.
Anbei das ganze Script + Download.

/* Usage
	private static string GetProjectProperty(string id, string index)
	{
		string value = null;
		ActionCallingContext actionCallingContext = new ActionCallingContext();
		actionCallingContext.AddParameter("id", id);
		actionCallingContext.AddParameter("index", index);
		new CommandLineInterpreter().Execute("GetProjectProperty", actionCallingContext);
		actionCallingContext.GetParameter("value", ref value);
		return value;
	}
*/

using System;
using System.Windows.Forms;
using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.Base;
using Eplan.EplApi.Scripting;
using System.IO;

class GetProjectProperty
{
    [DeclareAction("GetProjectProperty")]
    public void Action(string id, string index, out string value)
    {
        string pathTemplate = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
            "GetProjectProperty", "GetProjectProperty_Template.xml");
        string pathScheme = Path.Combine(PathMap.SubstitutePath("$(MD_SCRIPTS)"),
            "GetProjectProperty", "GetProjectProperty_Scheme.xml");

        try
        {
            // Set scheme
            string content = File.ReadAllText(pathTemplate);
            content = content.Replace("GetProjectProperty_ID", id);
            content = content.Replace("GetProjectProperty_INDEX", index);
            File.WriteAllText(pathScheme, content);

            new Settings().ReadSettings(pathScheme);

            string pathOutput = Path.Combine(
                PathMap.SubstitutePath("$(MD_SCRIPTS)"), "GetProjectProperty",
                "GetProjectProperty_Output.txt");

            // Export
            ActionCallingContext actionCallingContext = new ActionCallingContext();
            actionCallingContext.AddParameter("configscheme", "GetProjectProperty");
            actionCallingContext.AddParameter("destinationfile", pathOutput);
            actionCallingContext.AddParameter("language", "de_DE");
            new CommandLineInterpreter().Execute("label", actionCallingContext);

            // Read
            value = File.ReadAllLines(pathOutput)[0];
        }
        catch (Exception exception)
        {
            MessageBox.Show(exception.Message, "GetProjectProperty", MessageBoxButtons.OK,
                MessageBoxIcon.Error);
            value = "[Error]";
        }
    }
}

GetProjectProperty auf GitHub

Von |2018-08-17T12:30:10+02:002014-11-12|EPLAN, EPLAN-Scripts|

SetGrid

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);
        }
    }
}
Von |2017-11-09T12:23:41+01:002014-09-30|EPLAN, EPLAN-Scripts|
Nach oben