AutoCAD Electrical General

Active Member
Posts: 7
Registered: ‎06-25-2012
Message 1 of 2 (354 Views)

Publisher ecsCAD using in .NET

354 Views, 1 Replies
08-28-2012 09:04 AM

We developed a function to manage ecsCAD projects in a DMS/EDM system. For this we have developed an addin to do the following:

- write a PDF using the ecscad publisher

- zip the ecscad project

both  document are then imported in the dms-system.

We use ecscad 2012


now the problem ist the publisher-function, if we use the following code to start the publisher-process:

                string projectName = "MyProject";

                ecsPublisherOLELib.Generation ep = new ecsPublisherOLELib.Generation();


                ep.Setting = "Einstellung PDF";

                ep.Format = 0;

                ep.Project = projectName;

                ep.OutputFile = projectName + ".pdf";

                ep.OutputFolder = "C:\\Temp\\";


                 //optional PDF Info

                string[] vInfo = new string[5];

                vInfo[0] = "Info 1";

                vInfo[1] = "Info 2";

                vInfo[2] = "Info 3";

                vInfo[3] = "Info 4";

                vInfo[4] = "Info 5";


                ep.DocumentInfo = vInfo;


                int r = ep.StartOutput;


- the publisher is starting

- I can see 1 of 4, 2 of 4 and so on

- at the end what I get is an empty PDF (sometimes there are some fragments in there) and after this the ecscad project is corrupted, even the dwg files are empty now

- the mdb seems to stay open (there is an ldb-file)


Does somebody has any idea what is going wrong here, any snippes how to do it...


Thank you for help




Posts: 12
Registered: ‎08-08-2011
Message 2 of 2 (313 Views)

Re: Publisher ecsCAD using in .NET

09-06-2012 02:13 PM in reply to: innowell



the following C# code snippet works:


[CommandMethod("ET_PDF_TEST", CommandFlags.Session)]
//session flag necessary for all commands invoked in AutoCAD ecscad        
static public void _cmd_pdf_test()
            Autodesk.AutoCAD.Interop.AcadApplication acadApp = (Autodesk.AutoCAD.Interop.AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("AutoCAD.Application");

            ecsPublisherOLELib.Generation ep = (ecsPublisherOLELib.Generation)acadApp.GetInterfaceObject("ecsPublisherOLE.Generation.182");  //182 correspond to ecsPublisher for AutoCAD ecscad 2012 

            ep.Setting = "Einstellung PDF"; //the setting must be available in ecsPublisher
            ep.Format = 0;
            ep.Project = "M1N"; 
            ep.OutputFile = "M1N.pdf";  
            ep.OutputFolder = "C:\\Temp\\"; 

            int r = ep.StartOutput;
            //r == 0 ok or specific error code


You have also to set the references to the AutoCAD COM-API and the ecsPublisherOLE.arx (COM-API). 




You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Ask the Community