AutoCAD P&ID General Discussion

AutoCAD P&ID General Discussion

Reply
*Expert Elite*
Rave.Tam
Posts: 204
Registered: ‎05-19-2011
Message 11 of 13 (185 Views)

Re: Silent ExportToAutoCAD command

04-06-2012 05:15 AM in reply to: derek.jarvis

i'm invoking the dialog box the first time by using acedpostcommand to send a "exporttoautocad" command. the user will cancel the dialog box, and the script would run. its a simple open drawing (using document manager), then send the command -exporttoautocad and close the drawing. No p&id command needed. This works for both Plant3D model and P&ID drawing.

If my post answers your question, please click the "Accept as Solution" button.

Check out my blog http://lazcad.com
*Expert Elite*
Rave.Tam
Posts: 204
Registered: ‎05-19-2011
Message 12 of 13 (172 Views)

Re: Silent ExportToAutoCAD command

04-08-2012 06:07 PM in reply to: Rave.Tam

Something like this

 

foreach (string file in filePath.ToList())
{
ExportDrawing(file);
}

 

ExportDrawing method below

 

var doc = Application.DocumentManager.Open(file, true);
var db = doc.Database;
Application.DocumentManager.MdiActiveDocument = doc;

using (doc.LockDocument())
{
if (counter < maxCounter)
{
Core.PostCmd("ExportToAutoCAD" + "\n");
counter++;
}

Core.PostCmd("-ExportToAutoCAD 2010 " + localFile + "\n");

 

If my post answers your question, please click the "Accept as Solution" button.

Check out my blog http://lazcad.com
Active Member
derek.jarvis
Posts: 10
Registered: ‎09-07-2011
Message 13 of 13 (155 Views)

Re: Silent ExportToAutoCAD command

04-13-2012 10:19 AM in reply to: Rave.Tam

Thank you for your response.

 

While this is the same snippet that I've seen for LISP / Script files, I did finally find my problem. For some reason, some of my drawings had a different prompt for the export command, and I think it's because they needed to be audited/recovered.

 

I used this on a test project and it worked fine.

 

Thanks again for your help.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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

New AutoCAD P&ID Category!

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