.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Batch Converting CTB files to STB Files

1 REPLY 1
Reply
Message 1 of 2
Brendan_J_Mallon
1100 Views, 1 Reply

Batch Converting CTB files to STB Files

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.
1 REPLY 1
Message 2 of 2

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.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost