EPLAN-Scripts

ExportForm

Heute mal eine kleine Produktvorstellung aus unserem ShopForProcess.

Nachdem LabelForm für Beschriftungsausgaben sehr beliebt bei den EPLAN-Anwendern ist, haben wir uns entschieden ein ähnliches Produkt für PDFs und DXF/DWGs zu entwicklen.

Man kann verschiedene Konfigurationen anlegen, welche wiederum z.B. verschiedene PDFs enthalten. Da es nun möglich ist eine PDF-Ausgabe mit einem Seitenfilter zu machen, ergeben sich viele Möglichkeiten wie z.B. ortsbezogener Export.

Schaut euch die Videos für die zwei Varianten an… vielleicht könnt Ihr es brauchen (Funktionen PDF + DXF + DWG sind alle im Produkt enthalten und müssen nicht separat erworben werden).

 

Hinweis:
Der Export von DXF/DWG Dateien funktioniert leider erst ab der EPLAN Version 2.4!

ShopForProcess: ExportForm

Von |2017-11-09T12:23:41+01:002015-03-05|EPLAN, EPLAN-Scripts, ShopForProcess|

XGedUpdateMacroAction

Werden Makros in EPLAN über die Funktion “Makro aktualisieren” erneuert, wird leider der Wertesatz auf den Ursprungswert gesetzt.

Mit diesem Script wird der Wertesatz nicht verändert.

Die Action überschreibt die eigentlich EPLAN-Action. Da es hier zu einem Bufferoverflow kommen würde muss die eigentliche Action mit dem ActionCallingContext ausgestattet werden.

XGedUpdateMacroAction

 

XGedUpdateMacroAction (4130 Downloads )

 

using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.Scripting;

namespace ibKastl.Scripts.Global
{
    class XGedUpdateMacroAction_Overload
    {
        [DeclareAction("XGedUpdateMacroAction", 50)] // Overwrite with ordinal
        public void Action()
        {
            ActionCallingContext actionCallingContext = new ActionCallingContext();
            actionCallingContext.AddParameter("AutoAssignLastUsedRecord", "1");
            Eplan.EplApi.ApplicationFramework.Action action = new ActionManager().FindBaseActionFromFunctionAction(false); // Full Namespace, couse of compiler warning in EPLAN
            action.Execute(actionCallingContext);
        }
    }
}
Von |2017-11-09T12:23:41+01:002015-02-24|EPLAN, EPLAN-Scripts|

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|

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|
Nach oben