Scripts in project-specific scriptlib
The project-specific scriptlib stores custom versions of scripts the system uses for operations which are often customized. The interface of these scripts is fixed and the scripts must be defined in every project environment. The source code resides in Piping Isometrics & Spools script objects where the 'Included in script library' attribute is set to 'Yes'.
After calling these functions, the automatic annotation module computes the "best possible" location for the labels and inserts them onto the drawing sheet.
The names of these scripts can be redefined in Settings for Piping Isometrics & Spools, but the argument list is fixed.
Note: When you convert an old project to be compatible with the new Piping Isometrics & Spools version, remember to copy any new project scripts to the old project with the import/export method.
The source objects are:
-
DefaultAnnotation
-
DefaultCoordPoints
-
PiProjSl.h
Note: This file contains project scriptlib includes. Do not put includes in the script files!
-
SpecialSymbols
-
coord_label
-
DefaultDimensions.template
-
Template file for custom default dimensioning
ISOMETRY_ANNOTATION()
This script is run after the standard default annotation procedure when isometrics are annotated. The default annotation script may also call, if needed, scripts of the optional products.
SPOOL_ANNOTATION()
This script is run after the standard default annotation of spools. Typical usage is e.g. to insert custom valve position ID labels.
COORD_LABEL(pnt, STRING label_x, STRING label_y, STRING label_z, STRING label_continue)
This script takes five arguments:
-
Point
-
Label x,y,z location
-
"to be continued" label
The script processes the arguments to four output strings which are output using the application's coordinate label 2D symbol.
COORD_DefaultPoints(NrPoints, STRING valid)
Input Argument:
-
NrPoints: Number of points
Output Argument:
-
if valid: The value is a string of points containing '0' or '1'. '0' means no coordinate and '1' means that the program puts a coordinate to that point. The length of a valid string has to be the same as the number of points in the geometry (NrPoints).
Example:
-
Geometry has ten points, and the first and last points are valid:
"1000000001"
Description:
-
A script to get coordinate points for automatic annotation. The script search opens end points, and if the DefaultPoint() function returns 1 for this point, then the default annotation puts a coordinate onto this point. The customize function is DefaultPoint(). It is recommended that the user confines any changes to this function.
SPECIAL_SYMBOLS()
Piping Isometrics & Spools calls SPECIAL_SYMBOLS after conventional default annotation if the script exists. The purpose of this script is that the users can make their own symbols instead of using the normal Piping Isometrics & Spools symbols when the symbol is not a plane symbol, because Piping Isometrics & Spools can only handle plane symbols properly.
This only works if the geometry type of the part is DM_GT_FLEXCOMP. (Normally, Piping Isometrics & Spools does not draw anything).
Here is an example which draws a 3D valve (i.e. a component which cannot be defined with 2D lines) existing in the example project.
This is the order of script calls:
-
The interface script (SpecialSymbols.api)
-
Another script which calculates values and calls a label: ( ../pi/macro/Draw3dValve.mac).
-
The label definition in file label.cnf
-
( '3dValve; dValve; 12; 1.0; 1.0; 0.0; ; ;' )
-
The symbol in 2D symbol library ( dValve.asy )
Automatic mode requires for part:
-
geometry type DM_GT_FLEXCOMP
-
'Iss' tag value '3dValve' in corporate catalog
-
the number of points is at least four