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 (194 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 (181 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 (164 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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
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.

Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!