示例#1
0
//################################################################################################
    public string Get_Project()
    {
        try
        {
            // Read selected Eplan project Path
            //==========================================
            Eplan.EplApi.ApplicationFramework.ActionManager oMngr         = new Eplan.EplApi.ApplicationFramework.ActionManager();
            Eplan.EplApi.ApplicationFramework.Action        oSelSetAction = oMngr.FindAction("selectionset");
            string sProjektT = "";
            if (oMngr != null)
            {
                Eplan.EplApi.ApplicationFramework.ActionCallingContext ctx = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
                ctx.AddParameter("TYPE", "PROJECT");
                bool sRet = oSelSetAction.Execute(ctx);

                if (sRet)
                {
                    ctx.GetParameter("PROJECT", ref sProjektT);
                }
                //MessageBox.Show("Project: " + sProjektT);
            }
            return(sProjektT);
        }
        catch
        { return(""); }
    }
    private void LoadScript(string register)
    {
        foreach (string FullFilename in Directory.GetFiles(PathIni))
        {
            try
            {
                string Filename = Path.GetFileNameWithoutExtension(FullFilename);
                if (Filename != null)
                {
                    string[] parameters = Filename.Split('.');

                    Eplan.EplApi.ApplicationFramework.ActionCallingContext acc =
                        new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
                    acc.AddParameter("Register", register);
                    acc.AddParameter("Action", "CustomPropertyEditor");
                    acc.AddParameter("PropertyId", parameters[0]);
                    acc.AddParameter("PropertyIndex", parameters[1]);
                    acc.AddParameter("Editable", parameters[2]);
                    new CommandLineInterpreter().Execute("RegisterCustomPropertyEditorAction", acc);

                    BaseExceptionMessage("RegisterCustomPropertyEditorAction: " +
                                         "PropertyId:" + parameters[0] +
                                         " PropertyIndex:" + parameters[1] +
                                         " Editable:" + parameters[2]);
                }
            }
            catch (System.Exception ex)
            {
                BaseExceptionError("RegisterCustomPropertyEditorAction: " + ex.Message);
            }
        }
    }
示例#3
0
//################################################################################################
// PDF Export
    public void Export_PDF()
    {
        try
        {
            // MessageBox.Show(sDirPDF);
            // Path of the selected Eplan project
            sProject = Get_Project();
            if (sProject == "")
            {
                return;
            }
            // Name of the Eplan project
            sProjectName = Get_Name(sProject);
            // PDF - Export file name / path
            sFileExport = sDirPDF + sProjectName + ".pdf";
            //MessageBox.Show("Pfad : " + sFileExport);

            Eplan.EplApi.ApplicationFramework.ActionCallingContext aPDF = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
            aPDF.AddParameter("TYPE", "PDFPROJECTSCHEME");
            aPDF.AddParameter("PROJECTNAME", sProject);
            aPDF.AddParameter("EXPORTFILE", sFileExport);
            //aPDF.AddParameter("EXPORTSCHEME", "Standard");  // Optional - enter here your EPLAN Export Scheme instead of "Standard"
            aPDF.AddParameter("BLACKWHITE", "1");     // PDF Print as Black & White

            Eplan.EplApi.ApplicationFramework.CommandLineInterpreter aEx = new Eplan.EplApi.ApplicationFramework.CommandLineInterpreter();
            bool sRet = aEx.Execute("export", aPDF);

            if (!sRet)
            {
                System.Windows.Forms.MessageBox.Show("ERROR : PDF EXPORT");
            }
            string SUBJECT = "Eplan Schematic : " + sProjectName;
            string BODY    = "Original file path :  " + sFileExport;
            string ATTACH  = sFileExport;

            MAPI mapi = new MAPI();

            // Definition email adresse  / Optional

            //string ADDRESS = "YourEmail@....";
            //mapi.AddRecipientTo(ADDRESS);
            //string ADDRESS2 = "YourEmail@....";
            //mapi.AddRecipientTo(ADDRESS2);

            if (File.Exists(ATTACH))
            {
                mapi.AddAttachment(ATTACH);
            }
            mapi.SendMailPopup(SUBJECT, BODY);     // show E-mail before sending
            // mapi.SendMailDirect(SUBJECT, BODY); // or send E-mail directly
        }
        catch
        {
            return;
        }
    }
示例#4
0
    private void ToggleDesignMode()
    {
        Eplan.EplApi.ApplicationFramework.ActionManager mgr = new Eplan.EplApi.ApplicationFramework.ActionManager();

        Eplan.EplApi.ApplicationFramework.Action act = mgr.FindAction("XGedActionToggleConstructionMode");
        if (act != null)
        {
            Eplan.EplApi.ApplicationFramework.ActionCallingContext ictx = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
            act.Execute(ictx);
        }
    }
示例#5
0
    private void Copy()
    {
        Eplan.EplApi.ApplicationFramework.ActionManager mgr = new Eplan.EplApi.ApplicationFramework.ActionManager();

        Eplan.EplApi.ApplicationFramework.Action act = mgr.FindAction("XGedStartInteractionAction");
        if (act != null)
        {
            Eplan.EplApi.ApplicationFramework.ActionCallingContext CopyCtx = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
            CopyCtx.AddParameter("Name", "XMIaClipboardCopy");
            act.Execute(CopyCtx);
        }
    }
    private void LoadScript(string register)
    {
        foreach (string FullFilename in Directory.GetFiles(PathIni))
        {
            try
            {
                string Filename = Path.GetFileNameWithoutExtension(FullFilename);
                if (Filename != null)
                {
                    string[] parameters = Filename.Split('.');

                    Eplan.EplApi.ApplicationFramework.ActionCallingContext acc =
                        new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
                    acc.AddParameter("Register", register);
                    acc.AddParameter("Action", "CustomPropertyEditor");
                    acc.AddParameter("PropertyId", parameters[0]);
                    acc.AddParameter("PropertyIndex", parameters[1]);
                    acc.AddParameter("Editable", parameters[2]);
                    new CommandLineInterpreter().Execute("RegisterCustomPropertyEditorAction", acc);

                    BaseExceptionMessage("RegisterCustomPropertyEditorAction: " +
                                         "PropertyId:" + parameters[0] +
                                         " PropertyIndex:" + parameters[1] +
                                         " Editable:" + parameters[2]);
                }
            }
            catch (System.Exception ex)
            {
                BaseExceptionError("RegisterCustomPropertyEditorAction: " + ex.Message);
            }
        }
    }
示例#7
0
        //[Start]
        public void Export_Txt_Fehlworte()
        {
            //=======================================================================
            // Dialogabfrage
            const string message = "Prüfung von fehlenden Übersetzungen durchführen?";
            const string caption = "Export Fehlworteliste";
            var          result  = MessageBox.Show(message, caption,
                                                   MessageBoxButtons.YesNo,
                                                   MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return;
            }
            //=======================================================================
            // aktuelles Projektpfad ermitteln
            string sProject = Get_Project();

            //sProject = sProject.Replace("File-2", "K-ELT-01");

            if (sProject == "")
            {
                MessageBox.Show("Projekt auswählen !");
                return;
            }
            //MessageBox.Show(sProject);

            // Projektname ermitteln
            string strProjectname = Get_Name(sProject);

            //=======================================================================
            //eingestellte Projektsprache EPLAN ermitteln
            string strDisplayLanguage       = null;
            ActionCallingContext ACCDisplay = new ActionCallingContext();

            new CommandLineInterpreter().Execute("GetDisplayLanguage", ACCDisplay);
            ACCDisplay.GetParameter("value", ref strDisplayLanguage);
            //MessageBox.Show("Language : " + strDisplayLanguage);

            //=======================================================================
            //Fehlworteliste erzeugen :
            Eplan.EplApi.ApplicationFramework.ActionCallingContext   acctranslate = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
            Eplan.EplApi.ApplicationFramework.CommandLineInterpreter CLItranslate = new Eplan.EplApi.ApplicationFramework.CommandLineInterpreter();
            Eplan.EplApi.Base.Progress progress = new Eplan.EplApi.Base.Progress("SimpleProgress");
            progress.BeginPart(100, "");
            progress.SetAllowCancel(true);


            string MisTranslateFile = @"c:\TEMP\EPLAN\EPLAN_Fehlworteliste_" + strProjectname + "_" + strDisplayLanguage + ".txt";

            acctranslate.AddParameter("TYPE", "EXPORTMISSINGTRANSLATIONS");
            acctranslate.AddParameter("LANGUAGE", strDisplayLanguage);
            acctranslate.AddParameter("EXPORTFILE", MisTranslateFile);
            acctranslate.AddParameter("CONVERTER", "XTrLanguageDbXml2TabConverterImpl");

            bool sRet = CLItranslate.Execute("translate", acctranslate);

            if (!sRet)
            {
                MessageBox.Show("Fehler bei Export fehlende Übersetzungen!");
                return;
            }

            // MessageBox.Show("Fehlende Übersetzungen exportiert in : " + MisTranslateFile);

            //=================================================================
            //Fehlworteliste lesen und Zeilenanzahl ermitteln :

            int    counter = 0;
            string line;

            if (File.Exists(MisTranslateFile))
            {
                using (StreamReader countReader = new StreamReader(MisTranslateFile))
                {
                    while (countReader.ReadLine() != null)
                    {
                        counter++;
                    }
                }
                // MessageBox.Show("Zeilenanzahl in " + MisTranslateFile + " : " + counter);

                if (counter > 1)

                //=================================================================
                //Fehlworteliste öffnen falls Zeilenanzahl > 1 :

                {
                    // MessageBox.Show("Fehlende Übersetzungen gefunden !");
                    // Open the txt file with missing translation
                    System.Diagnostics.Process.Start("notepad.exe", MisTranslateFile);
                }
            }

            progress.EndPart(true);
            return;
        }