AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Publisher ecsCAD using in .NET

1 REPLY 1
Reply
Message 1 of 2
innowell
808 Views, 1 Reply

Publisher ecsCAD using in .NET

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.Init();

                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

 

Regards

Daniel

1 REPLY 1
Message 2 of 2
WoHo
in reply to: innowell

Daniel,

 

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");
            
            acadApp.LoadArx("ecsPublisher.arx");        
            acadApp.LoadArx("ecsPublisherOLE.arx"); 

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

            ep.Init();
            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). 

 

Regards

Wolfgang

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost