Dear @Shambler ,
How to add custom script and its metadata
Following steps create a custom script named “TESTSCRIPT” and its metadata including script previews:
- Create a folder named “CustomScripts” under content folder “%ContentPath%/CPak Common/”
- Create a custom python script, such as “TestScript.py” under the created folder.
How to create custom python script is the key point, generally, there are three steps to create as follows:
- Import needed Python packages, for example:
from varmain.primitiv import *
from varmain.custom import *
- Write metadata section, for example:
@activate(Group="Support", TooltipShort="Test script", TooltipLong="This is a custom Testscript", LengthUnit="in")
@group("MainDimensions")
@param(D=LENGTH, TooltipShort="Cylinder Diameter", Ask4Dist=True)
@param(L=LENGTH, TooltipLong="Length of the Cylinder")
@param(OF=LENGTH0)
@group(Name="meaningless enum")
@param(K=ENUM)
@enum(1, "align X")
@enum(2, "align Y")
@enum(3, "align Z")
The purpose for above code is to create metadata for custom script. Meta data includes tooltips for script, tooltips for script parameters, group information for script and its parameters.
Following is more detailed description for above metadata section:
- the script is in the "Support" group
- its display name is "test script"
- its description is "This is a custom testscript"
- its length unit is "in"
- the parameters D,L,OF are in group "MainDimensions"
- the parameter K is in group "meaningless enum"
- parameters D and L are Lengths (may not e zero),
- OF is a length that may be zero
- D carries a flag (Ask4Dist) that tells us its length may also be given by specifying a distance in the drawing
- K is an enumerated Value, where 1 means "align X", 2 means "align Y", etc.
Following are key words used in this section:
@activate:
==========
It *must* be the very first decorator. Declares the script's own metadata.
It allows these properties to be specified:
Group, FirstPortEndtypes, Ports, TooltipShort, TooltipLong,
ThumbnailImage, ParamDimImage, SCEditDimImage, Language, LengthUnit
@group:
=======
Defines a parameter group.
It usually precedes @param declarations and allows these properties to be
specified:
Name, TooltipLong
@param:
=======
Defines a parameter's metadata.
Has these properties:
Name, Type, Value, TooltipShort, TooltipLong, Ask4Dist
Name and Type can be either specified like @param(Name="A", Type="ANGLE", ...) or by @param(A=ANGLE, ...)
@enum:
======
Defines the enumeration for its preceding ENUM type parameter.
Arguments are:
Value, TooltipLong
The decorator's arguments follow standard Python function call syntax, they may be given by position or by keyword.
- Write main function for the custom script, for example:
def TESTSCRIPT(s, D=80.0, L=150.0, OF=-1, K=1, **kw):
CYLINDER(s, R=D/2, H=L, O=0.0).rotateY(90)
Above code makes a script named “TESTSCRIPT” which creates a cylinder. Here, user could use their imagination to create what they want.
- Now, we have had a custom script named “TestScript.py” under folder “%ConentPath%/CPak Common/CustomScripts”.
We need to register it. In ACAD command window, use command “PLANTREGISTERCUSTOMSCRIPTS” to register the new added script. If success, some metadata files will be created below the custom script folder as follows:
- TestScript.pyc
This is the complied binary file for python source file “TestScript.py”.
- ScriptGroup.xml
This file includes the group information of all added custom scripts. For example, the group name of added script “TESTSCRIPT” is “Support”. The group names can be the plant 3D class names, such as “Elbow”, “Tee” and so on.
- TESTSCRIPT.xml
This file describes the metadata of script “TestScript”.
- variants.xml
This file has the tooltips for script and its parameters, parameter group names, and enumerator values.
- variants.map
This is a map file which contains mapping information from script name to script path.
If there are syntax problems in file “TestScript.py”, there will be some output information in ACAD command window. In this case, we need to fix the errors and register again.
If success, the added script could be used by “pipe supports” feature in plant. The scripts within “Support” group will be sensed by this feature.
- In command window, Use lisp command (testacpscript “TESTSCRIPT”) to test the added script.
If the script works, a block will be inserted into current drawing.
- Assume we have inserted the block created by the script, and then we can create its preview images as following steps:
- In ACAD command window, run command “PlantSnapShot”
- Select “Part” option to create image for a single part
- Select image size in options [200/64/32]
- Input the image name in file saving dialog. Following is the naming rule for custom script previews:
Scriptname_200.png 200x200
Scriptname_64.png 64x64
Scriptname_32.png 32x32
For example, for script “TestScript”, we need to input “TestScript_200.png” for its 200x200 preview.
- Save the image to custom script folder. When user request the custom script images by image API, the image API will scan the custom script folder to fetch the images which meet requirement.
1 variants.zip
All variants are organized inside a directory structure.
Normally each variant is defined inside 1 separate file.
Some variant have also sub files.
So we get very much directories and files that make some problems with slow hard disk (it slows down the machine).
To solve that we pack all the directories and variant files inside variant.zip. Python can handle this archive as package and is very fast.
What is all inside variant.zip:
- the compile variant files (*.pyc)
- dimensioned images with resolution 640x640px per script (*_640.png)
- basic thumbnail images per script with resolution
- 200x200px (*_200-png)
- 64x64px (*_64.png)
- 32x32px (*_32.png)
- Script metadata (*.xlm)
Variant.zip is build with p3dmakeall.bat (or you call amake.bat inside directory “…\plant\Develop\Piping\3rdParty\ACP”
1.1 amake.bat
That Plant 3D can work with all the variant scripts we have to generate some files like variants.zip, variants.map and variants.xlm.
amake.bat helps us to generate this files and looks like (batch content / comment not in batch):
@rem $Header: //depot/plant/Develop/PnID/Source/Components/amake.bat#2 $
@echo off
if (%ACTOP%) == () goto BADACADROOT
…set the base environment vars…
@set PYTHONPATH=%PIPING_3RDPARTY_ACP%\variants\aqa\varmap;%PIPING_3RDPARTY_PYTHON%\Source\Lib;%PIPING_3RDPARTY_PYTHON_BIN%
@echo pnproot is %PNPROOT%
@echo PYTHON_EXE is %PYTHON_EXE%
@echo PIPING_3RDPARTY_ACP is %PIPING_3RDPARTY_ACP%
@rem -----------------------------------------------------------------------
@if not exist %PIPING_3RDPARTY_ACP%\buildzip.py goto BADBLDROOT
@cd %PIPING_3RDPARTY_ACP%
@set CONTENTTOOLPATH=%PIPING_3RDPARTY_ACP%\ContentTools
@set XLSREADERPATH=%PIPING_3RDPARTY_ACP%\ContentTools\XmlCreator
@if /i "%1" == "clean" goto makeClean
… remove existing error files
@rm -f %CONTENTTOOLPATH%\ContentTools.err
… build xlm creator tools
@devenv /useenv %CONTENTTOOLPATH%\ContentTools.sln /build %BLDTYPE% /out %CONTENTTOOLPATH%\ContentTools.err
@if exist %CONTENTTOOLPATH%\ContentTools.err typeerr.exe %CONTENTTOOLPATH%\ContentTools.err
%CBIN%\XmlCreator -img %PIPING_CONTENT%\Templates\Piping.dcfx %PIPING_CONTENT%\Templates\PipingClassToImgRel.xml
… compile all the python files, create also variants.map
%PYTHON_EXE% %PIPING_3RDPARTY_ACP%\buildzip.py --build
… build all the needed xlm files
%CBIN%\XmlCreator -acp %PIPING_3RDPARTY_ACP%\variants\variant_parameter_doc.xlsx %PIPING_3RDPARTY_ACP%\dummy_var.load %PIPING_3RDPARTY_ACP%\log.txt %PIPING_3RDPARTY_ACP%\variants.xml
… now create variants.zip
%PYTHON_EXE% %PIPING_3RDPARTY_ACP%\buildzip.py --zip
@goto DONE
:makeClean
@cd %PIPING_3RDPARTY_ACP%
@%CBIN%\XlsToXml.exe -d %PIPING_3RDPARTY_ACP%\log.txt
@devenv /useenv %CONTENTTOOLPATH%\ContentTools.sln /clean %BLDTYPE%
@rm -f %PIPING_3RDPARTY_ACP%\intermediaryXml.xml %PIPING_3RDPARTY_ACP%\scriptInXls.map
%PYTHON_EXE% %PIPING_3RDPARTY_ACP%\buildzip.py --clean
@rm -f %PIPING_3RDPARTY_ACP%\VARIANTS.zip %PIPING_3RDPARTY_ACP%\VARIANTS.map
@goto DONE
@rem -----------------------------------------------------------------------
:BADBLDROOT
@echo The PIPING_3RDPARTY_ACP environment variable has incorrect value
@goto DONE
@rem -----------------------------------------------------------------------
:BADACADROOT
echo The ACTOP environment variable has incorrect value
goto done
:DONE
@set PYTHONPATH=
amake.bat
@echo off
rem *****************************************************************************
rem * *
rem * build batch for content db's, db templatas & content test routines *
rem * *
rem * *
rem * *
rem * call options: *
rem * amake -C -> creates the pipe catalog databases *
rem * amake -I -> creates the structural database *
rem * amake -N -> creates the nozzle catalog databases *
rem * amake -P -> creates the files for localisation *
rem * amake -S -> creates the pipe spec databases *
rem * amake -T -> creates the needed database templates *
rem * amake -M -> creates the MEP spec databases *
rem * amake -> creates all above *
rem * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
rem * amake -C -X -> creates only the engl. catalog db's *
rem * amake -I -X -> creates only the engl. structural catalog db's *
rem * amake -N -X -> creates only the engl. nozzle catalog db's *
rem * amake -S -X -> creates only the engl. pipe spec db's *
rem * amake -T -X -> creates the needed catalog/spec db templates only *
rem * amake -X -> creates all above inc. (all) templates and loc file *
rem * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
rem * clean as last parameter jumps into cleaning section *
rem * *
rem *****************************************************************************
if "%localeBuildEnvironment%" == "1" goto setDefaultEnv
if "%PIPING_3RDPARTY_PYTHON%" == "" goto setDefaultEnv
goto pcont
:setDefaultEnv
rem set default environment if not set
IF EXIST __setBuildEnv.bat goto callEnvBat
goto pcont
:callEnvBat
rem loads a batch called __setBuildEnv.bat
rem this batch must contain basic environment settings and looks like
rem set PNPROOT=C:\gator\acad\acad\plant
rem set CBIN=C:\gator\acad\acad\develop\RunRoot\Debug\acad\Program Files\AutoCAD Gator
rem set ACTOP=%PNPROOT%\Develop
rem set PIPING_CONTENT=%ACTOP%\Piping\Content
rem set COMMON_3RDPARTY=%PIPING_CONTENT%\_Compile_
rem set PIPING_3RDPARTY_PYTHON=%PIPING_CONTENT%\_Compile_\Python
rem set PATH=%PATH%;%CBIN%;%COMMON_3RDPARTY%
rem set ACPLATFORM=x86
rem set PYTHONNET_EXE=%PIPING_3RDPARTY_PYTHON%\pythonnet.exe
rem set PYTHONPATH=%PIPING_3RDPARTY_PYTHON%;%PIPING_3RDPARTY_PYTHON%\Lib;%CBIN%;%COMMON_3RDPARTY%\Framework\v3.0;%COMMON_3RDPARTY%\Framework\v3.5;%COMMON_3RDPARTY%
rem set PROJECT_PICKLIST_TOOL = %CBIN%\ProjectDcfx.exe
rem this batch and settings allows us to build the dbs, templates and check routines without
rem setup a complete C compile environment
call __setBuildEnv.bat
goto cont
:pcont
rem
rem Please do not change the explicit references to "Release" - this breaks the non prod build
rem it is just fine to use the release pythonnet.exe
rem
set PYTHONNET_EXE=%PIPING_3RDPARTY_PYTHON%\bin\Release\%ACPLATFORM%\pythonnet.exe
set PYTHONPATH=%PIPING_3RDPARTY_PYTHON%\bin\Release\%ACPLATFORM%;%CBIN%;%PIPING_3RDPARTY_PYTHON%\Source\Lib;%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0;%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5
:cont
set PROJECT_PICKLIST_TOOL=%CBIN%\ProjectDcfx.exe
if ("%ACTOP%") == ("") goto BADACADROOT
IF EXIST "%INSTCONTENTLOC%\CPak Common\variants.zip" goto addDevVariants
IF EXIST "%PIPING_3RDPARTY_ACP%\variants\aqa\splitValve\__init__.py" goto addVariants
IF EXIST "%ALLUSERSPROFILE%\Application Data\Autodesk\AutoCAD Plant 3D\Content\NativeContent\variants.zip" goto NativeContentVariants
IF EXIST "%CommonProgramFiles%\Autodesk Shared\Content\CPak Common\variants.zip" goto CommonContentLoc
IF EXIST "%INSTCONTENTLOC%\NativeContent\variants.zip" goto InstContentLoc
set PYTHONPATH=%PYTHONPATH%;%ALLUSERSPROFILE%\Application Data\Autodesk\AutoCAD Plant 3D\Content\CPak Common\variants.zip
goto icont
:CommonContentLoc
set PYTHONPATH=%PYTHONPATH%;%CommonProgramFiles%\Autodesk Shared\Content\CPak Common\variants.zip
goto icont
:NativeContentVariants
set PYTHONPATH=%PYTHONPATH%;%ALLUSERSPROFILE%\Application Data\Autodesk\AutoCAD Plant 3D\Content\NativeContent\variants.zip
goto icont
:InstContentLoc
set PYTHONPATH=%PYTHONPATH%;%INSTCONTENTLOC%\NativeContent\variants.zip
goto icont
:addVariants
set PYTHONPATH=%PYTHONPATH%;%PIPING_3RDPARTY_ACP%\variants
goto icont
:addDevVariants
set PYTHONPATH=%PYTHONPATH%;%INSTCONTENTLOC%\CPak Common\variants.zip
:icont
rem set PIPING_CONTENT=%PNPROOT%\Develop\Piping\Content
set PIPING_CONTENT_BUILD_TOOLS=%PIPING_CONTENT%\Catalog Build Tools
set PIPING_CONTENT_TEMPLATE=%PIPING_CONTENT%\Templates
set PIPING_CONTENT_CATALOG_src=%PIPING_CONTENT%\Catalog Src
set PIPING_CONTENT_CATALOG_REL=%PIPING_CONTENT%\Catalogs
set PIPING_CONTENT_SPEC_src=%PIPING_CONTENT%\Spec Src
set PIPING_CONTENT_SPEC_REL=%PIPING_CONTENT%\Specs
set PIPING_CONTENT_LOCALE=%PIPING_CONTENT%\Locale
set PIPING_EQUIPMENT=%PIPING_3RDPARTY_ACP%\equipment
rem echo -------------------------------------------------------------------------
rem echo PNPROOT is %PNPROOT%
rem echo CBIN is %CBIN%
rem echo ACTOP is %ACTOP%
rem echo PIPING_CONTENT is %PIPING_CONTENT%
rem echo COMMON_3RDPARTY is %COMMON_3RDPARTY%
rem echo PIPING_3RDPARTY_PYTHON is %PIPING_3RDPARTY_PYTHON%
rem echo PATH is %PATH%
rem echo ACPLATFORM is %ACPLATFORM%
rem echo -------------------------------------------------------------------------
rem echo BASEDIR is %BASEDIR%
echo PYTHONNET_EXE is %PYTHONNET_EXE%
echo PYTHONPATH is %PYTHONPATH%
echo.
echo PIPING_CONTENT is %PIPING_CONTENT%
echo PIPING_CONTENT_BUILD_TOOLS is %PIPING_CONTENT_BUILD_TOOLS%
echo PIPING_CONTENT_TEMPLATE is %PIPING_CONTENT_TEMPLATE%
echo PIPING_CONTENT_CATALOG_SRC is %PIPING_CONTENT_CATALOG_SRC%
echo PIPING_CONTENT_CATALOG_REL is %PIPING_CONTENT_CATALOG_REL%
echo PIPING_CONTENT_SPEC_SRC is %PIPING_CONTENT_SPEC_SRC%
echo PIPING_CONTENT_SPEC_REL is %PIPING_CONTENT_SPEC_REL%
echo PIPING_CONTENT_LOCALE is %PIPING_CONTENT_LOCALE%
echo.
if not exist "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaCatalog.py" goto BADBLDROOT
cd %PIPING_CONTENT%
if /i "%1" == "clean" goto makeClean
if /i "%2" == "clean" goto makeClean
if /i "%3" == "clean" goto makeClean
rem
rem (temporary) fix to get (especially 64bit) build going
rem it also fixes PnPTest on 64bit environments
rem
gacutil /i "%COMMON_3RDPARTY%\bin\%ACPLATFORM%\System.Data.SQLite.dll"
rem
copy "%PIPING_SCHEMAS%\NominalDiameterMap.csv" "%CBIN%\NominalDiameterMap.csv">NUL
if /i "%1" == "-C" goto makeCatalog
if /i "%1" == "-I" goto makeStructuralCatalog
if /i "%1" == "-N" goto makeNozzleCatalog
if /i "%1" == "-P" goto makeLocaleFiles
if /i "%1" == "-S" goto makePipeSpec
if /i "%1" == "-T" goto makeTemplate
if /i "%1" == "-M" goto makeMepSpec
:makeTemplate
echo.
echo creating database templates..............................................
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaTemplate.py" --template="%PIPING_CONTENT_TEMPLATE%\Template.csv" --outdir="%PIPING_CONTENT_TEMPLATE%"
if /i "%2" == "-X" goto skip_metric_3dpicklists
IF ERRORLEVEL == 1 goto skip_metric_3dpicklists
IF NOT EXIST "%PIPING_CONTENT_TEMPLATE%\Piping.dcfx" goto skip_3dpicklists
echo copy piping.dcfx as metric_piping.dcfx................................
@if exist "%PIPING_CONTENT_TEMPLATE%\metric_piping.dcfx" del "%PIPING_CONTENT_TEMPLATE%\metric_piping.dcfx">NUL
copy "%PIPING_CONTENT_TEMPLATE%\piping.dcfx" "%PIPING_CONTENT_TEMPLATE%\metric_piping.dcfx">NUL
echo add picklists to Piping.dcfx, create layer - color scheme.............
"%PROJECT_PICKLIST_TOOL%" "%PIPING_CONTENT_TEMPLATE%\Piping.dcfx" -picklists "%PIPING_CONTENT_TEMPLATE%\3dPicklistnames.csv" -picklistvalues "%PIPING_CONTENT_TEMPLATE%\3dPicklistValues.csv" -table PnPProjectVariables "%PIPING_CONTENT_TEMPLATE%\imperialvars.csv" -CreateDefaultScheme
echo done
:skip_3dpicklists
IF NOT EXIST "%PIPING_CONTENT_TEMPLATE%\metric_piping.dcfx" goto skip_metric_3dpicklists
echo add picklists to metric_piping.dcfx, create layer - color scheme......
"%PROJECT_PICKLIST_TOOL%" "%PIPING_CONTENT_TEMPLATE%\metric_piping.dcfx" -picklists "%PIPING_CONTENT_TEMPLATE%\3dPicklistnames_metric.csv" -picklistvalues "%PIPING_CONTENT_TEMPLATE%\3dPicklistValues_metric.csv" -table PnPProjectVariables "%PIPING_CONTENT_TEMPLATE%\metricvars.csv" -CreateDefaultScheme
echo done
:skip_metric_3dpicklists
if /i "%1" == "" goto makeLocaleFiles
if /i "%1" == "-X" goto makeLocaleFiles
goto DONE
:makeLocaleFiles
echo.
echo creating translation files...............................................
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaMakePo.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%;%PIPING_CONTENT_SPEC_SRC%" --localedir="%PIPING_CONTENT_LOCALE%" --masterloc="%PIPING_CONTENT_LOCALE%\locale.csv"
if /i "%1" == "" goto makeCatalog
if /i "%1" == "-X" goto makeCatalog
goto DONE
:makeCatalog
echo.
echo creating Pipe 3D catalogs................................................
if /i "%1" == "-X" goto shortCat
if /i "%2" == "-X" goto shortCat
goto normCat
:shortCat
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaCatalog.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DCatalogSchema.dcfx" --outdir="%PIPING_CONTENT_CATALOG_REL%" --localedir="%PIPING_CONTENT_LOCALE%" --CPKGINFO="%PIPING_CONTENT_CATALOG_SRC%\_ContentPackageInfo_.txt"
goto contCat
:normCat
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaCatalog.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DCatalogSchema.dcfx" --outdir="%PIPING_CONTENT_CATALOG_REL%" --localedir="%PIPING_CONTENT_LOCALE%" --CPKGINFO="%PIPING_CONTENT_CATALOG_SRC%\_ContentPackageInfo_.txt" --masterloc="%PIPING_CONTENT_LOCALE%\locale.csv"
:contCat
if /i "%1" == "" goto makeNozzleCatalog
if /i "%1" == "-X" goto makeNozzleCatalog
goto DONE
:makeNozzleCatalog
echo.
echo creating nozzle catalogs.................................................
if /i "%1" == "-X" goto shortNozz
if /i "%2" == "-X" goto shortNozz
goto normNozz
:shortNozz
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaNozzleCatalog.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DCatalogSchema.dcfx" --outdir="%PIPING_CONTENT_CATALOG_REL%" --localedir="%PIPING_CONTENT_LOCALE%" --CPKGINFO="%PIPING_CONTENT_CATALOG_SRC%\_ContentPackageInfo_.txt" --equipment="%PIPING_EQUIPMENT%"
goto contNozz
:normNozz
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaNozzleCatalog.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DCatalogSchema.dcfx" --outdir="%PIPING_CONTENT_CATALOG_REL%" --localedir="%PIPING_CONTENT_LOCALE%" --CPKGINFO="%PIPING_CONTENT_CATALOG_SRC%\_ContentPackageInfo_.txt" --equipment="%PIPING_EQUIPMENT%" --masterloc="%PIPING_CONTENT_LOCALE%\locale.csv"
:contNozz
if /i "%1" == "" goto makeStructuralCatalog
if /i "%1" == "-X" goto makeStructuralCatalog
goto DONE
:makeStructuralCatalog
echo.
echo creating steel structure catalogs........................................
if /i "%1" == "-X" goto shortStruct
if /i "%2" == "-X" goto shortStruct
goto normStruct
:shortStruct
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaStructuralCatalog.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\StructuralCatalogSchema.dcfx" --outdir="%PIPING_CONTENT_CATALOG_REL%" --localedir="%PIPING_CONTENT_LOCALE%" --CPKGINFO="%PIPING_CONTENT_CATALOG_SRC%\_ContentPackageInfo_.txt"
goto contStruct
:normStruct
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaStructuralCatalog.py" --path2csv="%PIPING_CONTENT_CATALOG_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\StructuralCatalogSchema.dcfx" --outdir="%PIPING_CONTENT_CATALOG_REL%" --localedir="%PIPING_CONTENT_LOCALE%" --CPKGINFO="%PIPING_CONTENT_CATALOG_SRC%\_ContentPackageInfo_.txt" --masterloc="%PIPING_CONTENT_LOCALE%\locale.csv"
:contStruct
if /i "%1" == "" goto makePipeSpec
if /i "%1" == "-X" goto makePipeSpec
goto DONE
:makePipeSpec
echo.
echo creating pipe specs......................................................
if /i "%1" == "-X" goto shortSpec
if /i "%2" == "-X" goto shortSpec
goto normSpec
:shortSpec
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaSpec.py" --path2csv="%PIPING_CONTENT_SPEC_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DSpecSchema.dcfx" --outdir="%PIPING_CONTENT_SPEC_REL%" --catdir="%PIPING_CONTENT_CATALOG_SRC%" --localedir="%PIPING_CONTENT_LOCALE%"
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaSpec.py" --path2csv="%PIPING_CONTENT_SPEC_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DSpecSchema.dcfx" --outdir="%PIPING_CONTENT_SPEC_REL%" --catdir="%PIPING_CONTENT_CATALOG_SRC%" --localedir="%PIPING_CONTENT_LOCALE%" --demospecs
goto contSpec
:normSpec
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaSpec.py" --path2csv="%PIPING_CONTENT_SPEC_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DSpecSchema.dcfx" --outdir="%PIPING_CONTENT_SPEC_REL%" --catdir="%PIPING_CONTENT_CATALOG_SRC%" --localedir="%PIPING_CONTENT_LOCALE%" --masterloc="%PIPING_CONTENT_LOCALE%\locale.csv"
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaSpec.py" --path2csv="%PIPING_CONTENT_SPEC_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DSpecSchema.dcfx" --outdir="%PIPING_CONTENT_SPEC_REL%" --catdir="%PIPING_CONTENT_CATALOG_SRC%" --localedir="%PIPING_CONTENT_LOCALE%" --demospecs
:contSpec
rem ... empty story partfamily ids for image lsp generation ...
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildStellaSpec.py" --emptyimageids
rem
rem You could use the following to uninstall the DLL from the GAC again,
rem but this breaks PnPTest on my development machine, so we just leave it
rem registered.
rem
rem gacutil /u System.Data.SQLite
rem
goto DONE
:makeMepSpec
copy "%PIPING_SCHEMAS%\NominalDiameterMap.csv" "%PIPING_3RDPARTY_PYTHON%\bin\Release\%ACPLATFORM%\NominalDiameterMap.csv">NUL
"%PYTHONNET_EXE%" "%PIPING_CONTENT_BUILD_TOOLS%\buildMEPSpec.py" --path2csv="%PIPING_CONTENT_SPEC_SRC%" --template="%PIPING_CONTENT_TEMPLATE%\Pn3DSpecSchema.dcfx" --outdir="%PIPING_CONTENT_SPEC_REL%" --catdir="%PIPING_CONTENT_CATALOG_REL%"
del "%PIPING_3RDPARTY_PYTHON%\bin\Release\%ACPLATFORM%\NominalDiameterMap.csv">NUL
goto DONE
:makeClean
cd %PIPING_CONTENT%
if /i "%1" == "clean" call :cleanTemplate
if /i "%1" == "-T" call :cleanTemplate
goto DONE
:cleanTemplate
for /r "%PIPING_CONTENT_TEMPLATE%" %%F in (
*.dcfx
*.dcfx.bak
) do (
if exist "%%~F" del "%%~F"
)
exit /b 0
rem -----------------------------------------------------------------------
:BADBLDROOT
echo The PNPROOT environment variable has incorrect value
goto DONE
rem -----------------------------------------------------------------------
:BADACADROOT
echo The ACTOP environment variable has incorrect value
goto done
:DONE
for %%F in (
"%CBIN%\NominalDiameterMap.csv"
) do (
if exist "%%~F" del "%%~F"
)
set PIPING_CONTENT_BUILD_TOOLS=
set PIPING_CONTENT_TEMPLATE=
set PIPING_CONTENT_SPEC_src=set PIPING_CONTENT_SPEC_REL=
set PIPING_CONTENT_CATALOG_src=set PIPING_CONTENT_CATALOG_REL=
set PIPING_CONTENT_LOCALE=
rem set PIPING_CONTENT=
set PYTHONPATH=
set PROJECT_PICKLIST_TOOL=
if "%localeBuildEnvironment%" == "1" goto remDefaultEnv
:remDefaultEnv
rem set default environment if not set
IF EXIST __remBuildEnv.bat goto callRemEnvBat
goto amakeEnd
:callRemEnvBat
rem loads a batch called __remBuildEnv.bat
rem this batch must contain basic environment settings and looks like
rem set PNPROOT=
rem set CBIN=
rem set PIPING_3RDPARTY_ACP=
rem set ACTOP=
rem set PIPING_CONTENT=
rem set COMMON_3RDPARTY=
rem set PIPING_3RDPARTY_PYTHON=
rem set PATH=%OLDPATH%
rem set OLDPATH=
rem set ACPLATFORM=
rem set PYTHONNET_EXE=
rem set PYTHONPATH=
rem set PIPING_SCHEMAS=
rem set GBIN=
rem set localeBuildEnvironment=
rem this batch and settings remove the environment if we build the dbs, templates and
rem check routines without setup a complete C compile environment
call __remBuildEnv.bat
:amakeEnd