Use Case
This article is a step-by-step guide on how to convert CADWorx P&ID (CWX) drawings into DIAGRAMS drawings.
Tutorial\Sample2, as shipped with CADWorx P&ID, will be the source project.
It can be found here under 'C:\CADWorx 20##\P&ID\Tutorial' after a default installation.
Learn how to extract, transform, and load (ETL) the CWX Sample2 project into a fully functional DIAGRAMS project that connects to a database.
Steps:
- Isolating CWX source files
- Create a new DIAGRAMS project
- Importing CWX Database Objects; Tables and Fields
- Adding and modifying fields to control and manage their values
- Setting up 'ToolTips' Views
- Updating Layers
- Importing Symbol Library
- Open Project & Import Drawings
Step 1 - Isolating CWX source files
Create a new Directory named DIAGRAMS and then add a new sub-directory CWXSample2Source.
Using Windows, copy the C:\CADWorx 20##\P&ID\Tutorial\Sample2\*.* into it.
Then copy the C:\CADWorx 20##\P&ID\Support directory to the ..\DIAGRAMS \CWXSample2Source directory.
The results should look like this where files are isolated and ready to be consumed.
Step 2 - Create a new DIAGRAMS project
Launch the DIAGRAMS Project Manager and create a new project using the Built-in Database option.
If you want to follow along, add CWXSampl2Target in the same location as the CWXSample2Source directory created in Step 1.
The results should look like this.
Step 3 - Importing CWX Database Objects; Tables and Fields
Navigate to Tables in the CWXSampl2Target project and click on the Import button in the Controls Header
This will launch a Database Configuration window where you will set Access at the database type, set Access file to ..\DIAGRAMS \CWXSample2Source\Project2.mdb, and check the tables to import.
In this use case, we are only going to select the database tables that begin with 'Components-', because they are the only tables that are associated with routes, symbols, and groups within CWX project drawings.
Click OK and the results should look like this where all the 'Components-' tables were added and the Components-Process_Lines is set as a Route Table. This Route Table setting is important so make sure that it is set.
Step 4 - Adding and modifying fields to control and manage their values
The import processor adds all Fields from each imported CWX table, so they can now be configured using DIAGRAMS settings.
IMPORTANT. You need to know that some drawing visible CWX fields like TAG and SIZE will be overwritten once drawings are imported. DIAGRAMS automatically propagate field values from routes to symbols whenever they become associated with each other. DIAGRAMS will automatically associate inline symbols to routes if conditions support that action, so the need to preserve and protect legacy data is critical to achieving a great conversion.
Therefore, ECE recommends adding and modifying fields as follows:
- Add ImportedLineTag to the Components-Process_Lines table as a StringType.
- Copy ImportedLineTag to all other 'Components-' tables.
- Delete TAG_ and SIZE_ from the Components-Process_Lines table
- Add ImportedSize in all 'Components-' tables except Components-Process_Lines as a StringType
- Change SIZE_ to all in all 'Components-' tables except Components-Process_Lines as a ConcatenationType.
Set the SIZE_ to equal ImportedSize, so that values on the drawings will not change.
These Field changes will support the import configuration setup described below. There are many other field adjustments that could be made like deleting all the 'CW_' fields, but those changes are outside the scope of this article.
Step 5 - Setting up 'ToolTips' Views
It is recommended that users configure the ToolTips view for each new table. This view determines what information is displayed when hovering over routes, symbols, and groups, so it makes sense to populate them with key information related to the conversion.
Here is a list of fields we'll add.
Components-Process Lines:
PrimaryRouteID
ImportedLineTag
SYS_Size
SPEC_
Components-Instruments:
PrimaryRouteID
ImportedLineTag
FUNCTION
TAG
ImportedSize
SYS_Size
Components-Vessels:
PrimaryRouteID
ImportedLineTag
TAG
OD
LENGTH
Components-Valves, Miscellaneous, Nozzles, Mechanical, Reducers:
PrimaryRouteID
ImportedLineTag
TAG
SPEC
ImportedSize
SYS_Size
Step 6 - Updating Layers
CWX layers are stored within the Project.cfg file, so DIAGRAMS will overwrite all layers based upon the contents with it.
On the Layers page, click on the Import button and choose the source file.
The results should look like this afterward.
Step 7 - Importing Symbol Library
DIAGRAMS processes CWX 'Flow-alt-dat' files and automatically creates a symbol library. It will then insert block files found within the Support directory, so it is necessary to manually copy CWX files there.
Use Windows Explorer to copy all the drawing files from C:\CADWorx 20##\P&ID\Support and paste them into the ..\DIAGRAMS \CWXSample2Target\Support
CWX ships with numerous Flow-alt-dat files and it is important to know which one has been used to create drawings.
HINT: The flow-alt-dat file is set within Project.cfg files under [Process Startup]. There is where MenuSymbolFile= is set.
In this article, the Flow_alt.dat file is used.
Once you have targeted flow Flow-alt-dat files, click the Import button to start the process
CADWorx *.dat file content notes:
- DIAGRAMS does not allow duplicate 'Display Names', so only the first instance will be processed if they exist.
- DIAGRAMS requires the block filename used in Column1 matches its counterpart in Column3.
e.g.
Next, launch the png image processor to create images for the insertion types you just added.
Step 8 - Open Project & Import Drawings
By now we are well prepared to convert and create new drawings!
Launch AutoCAD and then DIAGRAMS
First, create a blank drawing. It is a good practice to have at least one drawing in projects because you can launch it to set the symbol library active for importing. So, click the Add New Drawing button.
You can call it whatever makes sense, in this case we'll use MyFirstSheet
HINT: Populate Prefix and empty the Suffix and Start Number fields to create a drawing by any text string.
Launch MyFirstDrawing by double-clicking on it, or one-click to select and click the Open Drawing header control.
Start the import process by clicking the Import Legacy Drawings button.
Select both drawings in CWXSample2Source and the Import Legacy Drawings Settings form will pop up.
Set all the Import Legacy Drawing Settings by Section
- Database Configuration.
- CWX Data Mapping. As shown
- Item Types To Import. As Shown and set the Mapping too.
- Import Routes By Layer. None required
Click Import and then click on Yes to satisfy the sync drawings prompts.
Once finished, open the Drawings and inspect them by using the Tracing Tab.
Set the route table and category to Imported Line Tag to see the results.
Click on the 'include symbols' option to trace inlines that could be connected by the processor.