P&ID Sheets
P&ID uses general sheets ([library or project] > Document Production > Drawing Sheets) to define the layout of plotted reports.
For P&I diagrams there are special P&ID sheets. Setting up the P&ID sheets includes the following steps:
Contents of PI_CATALOG
Specify what kind of header information is needed for diagrams. This includes the items you want to plot into the title box.
Setup the database structure with the table editor according to the specification.
Startup Scripts
When you create a new diagram you select a sheet for it. Behind the sheet selection there is a startup script for initializing certain settings for the new diagram. Typical settings to set up are:
- Define sheet size.
- Load decorations to the sheet, e.g. border lines.
- Set up grid attributes and cut parameters.
- Define the title box label and its initial contents.
- Load currently existing Systems, pipelines, and instrument tags from the database into the diagram.
All the tasks in the former list could be set up inside a single script file (i.e. the startup script). Usually the startup script calls script sheets to set 2D decorations to the sheet.
It is also possible to create a diagram without any startup script.
Example Script
In the example code below the typical items to configure are shown with bold text.
#include include/dg.h #include include/pd.h #include include/dmutil.h main() { SetupDrwSheet("CREATE"); return(0); } SetupDrwSheet(string func) { w = 420.; h = 296.; /* load 2D decoration style */ PD_CALL_SCRIPT(setup/sheets.mac, DecorateSheet, Cadmatic, w, h); if(func == "CREATE"){ /* ** Set default Drawing attributes */ SET_INT_DEFAULT(ObjDrwAttr, ArLayer,1); SET_INT_DEFAULT(ObjDrwAttr, ArColor,1); SET_INT_DEFAULT(ObjDrwAttr, ArWidth,1); SET_INT_DEFAULT(ObjDrwAttr, EqLayer,1); SET_INT_DEFAULT(ObjDrwAttr, EqColor,2); SET_INT_DEFAULT(ObjDrwAttr, EqWidth,1); SET_INT_DEFAULT(ObjDrwAttr, InstruLayer,1); SET_INT_DEFAULT(ObjDrwAttr, InstruColor,3); SET_INT_DEFAULT(ObjDrwAttr, InstruWidth,1); SET_INT_DEFAULT(ObjDrwAttr, PirunLayer,1); SET_INT_DEFAULT(ObjDrwAttr, PirunColor,6); SET_INT_DEFAULT(ObjDrwAttr, PirunWidth,1); /* load necessary objects needed already at the start */ PD_CALL_SCRIPT("",READ_SYSTEMS_FROM_DATABASE); PD_CALL_SCRIPT("",READ_PIPELINES_FROM_DATABASE); PD_CALL_SCRIPT("",READ_TAGS_FROM_DATABASE); } return(0); }
Title Box Symbol
Make the 2D symbol to be used as a text type label to plot the title box and its associated data from PI_CATALOG. See Title Box Symbol.
Configure Title Box Label
Edit the 'labels' script and configure the script function RETRIEVE_TITLEBOX_DATA to retrieve data from PI_CATALOG. See The labels Script.