AutoCAD Electrical
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Publisher ecsCAD using in .NET
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Publisher ecsCAD using in .NET
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.R untime.InteropServices.Marshal.GetActiveObject("Au toCAD.Application");
acadApp.LoadArx("ecsPublisher.arx");
acadApp.LoadArx("ecsPublisherOLE.arx");
ecsPublisherOLELib.Generation ep = (ecsPublisherOLELib.Generation)acadApp.GetInterfac eObject("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

