Posts: 5
Registered: ‎11-18-2009
Message 1 of 2 (388 Views)

Batch Converting CTB files to STB Files

388 Views, 1 Replies
11-19-2009 03:06 PM
As an organisation, we have opted to go with STB as we have some complicated requirements that CTB doesn't accommodate. The wisdom of that decision is a moot point and I'm aware of the vast array of opinion.

We have a legacy of CTB drawings that occassionally need to be brought forward when projects get resurrected (state government highway designs are prone to getting shelved).

Up to AutoCAD 2009, I've had a VBA routine that performed a few operations on a list of files stored in a text file:
- Open the file
- Convert to STB using "CONVERTPSTYLES" with a specified STB file.
- Run a script to load a layer state file to change the plot styles from Style1, Style2 etc, to their correct named plot styles.
- Manage a recalcitrant layer that refused to play ball.
- Save and close the document
- Get the next file........

This was all fine until 2010 came along with the announcement that VBA was to be phased out. 2010 is OK with the VBA enablers, but now I've got some work to do.

Our organisation's development language is C# and I'm using Visual Studio 2008 Professional Edition to develop my C# .NET code.

So... after all that background, my question is:

Is there another mechanism than "SendStringToExecute" for sending a command such as convertpstyles to AutoCAD and getting .NET to wait for it to finish before proceeding.

I've got CommandEnded code that handles waiting for MTEXT and DTEXT commands to finish and I've tried constructing a CommandEnded for CONVERTPSTYLES, but it seems to me that commands that throw dialogue boxes such as CONVERTPSTYLESand SCRIPT aren't handled the same way.

I've tried setting FILEDIA to 0 prior to running the CONVERTPSTYLES command, however the message box that CONVERTPSTYLES presents before asking for the STB file appears to be getting in the way.

Any suggestions would be greatly appreciated.
Active Member
Posts: 7
Registered: ‎02-20-2009
Message 2 of 2 (183 Views)

Re: Batch Converting CTB files to STB Files

07-16-2012 02:45 PM in reply to: bjmallon

I know this is an old post, but I wanted to reply with the method that works the best for us.  Instead of using ConvertPStyles, we begin with a fresh drawing that is already STB based.  We then insert the old drawing into the STB drawing and merge the old CTB layers into previously setup STB layers which already had the Plot Styles and lineweights associated to them.  This can be easily scripted if you had good layer management when you drawings were originally created.  It's not a full-on batch convert, but it works well for us.

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 or visit the Installation and Licensing Forum to get help installing your software.