Introduction
This document is intended to provide detail guide on how to generate custom NC Documentation output using new command and the Business Rules scripts.
Version – Applicable since 2026x FD02 (FP)
Pre-requisites: User must be assigned with Leader and Owner Role
Licenses –
CSV (Collaborative Industry Innovator)
- NSR (NC Shop Floor Programmer) or any other Machining Programmer Role
Disclaimer: Licenses mentioned above are as per 2026x documentation.Below video shows how business rules can be configured to generate custom NC Documentation output.
Logical Workflow
Detail Explanation
When we launch "Generate NC Documentation" command, two business rules are triggered which determine options available during document generation and the content of document. Let us see how they work in detail.
1.Business Rule for Customizing NC Documentation Options: DELNCDocumentation
During NC Documentation generation, this business rule determines the output type (HTML or PDF), output format (different document layouts available), logos to be added etc.
Below script will explain how these options are managed by the business rule.
First define the list of customization keys
// Option to define available customization keys
let Customizations(List)
Customizations.Append("html_sample_brief")
Customizations.Append("html_sample_complete")
Customizations.Append("pdf_sample_brief")
Customizations.Append("pdf_sample02_brief")
Customizations.Append("pdf_sample_intermediate")
Customizations.Append("pdf_sample_complete")
Parameters.SetAttributeObject("Customizations",Customizations)These customization key values appear as list of values to choose from when command is launched as show below
Based on selected customization key by user, the business rule sets the output type value
// Get selected customization
let sCustomKey(String)
sCustomKey = Parameters.GetAttributeString("CustomizationKey")// Option to generate standard HTML output or custom output
// Valid values
// 0 - Let user choose interactively (default)
// 1 - Generate standard HTML
// 2 - Generate output using external post processing
let iOutputType(Integer)
iOutputType = 0
if (sCustomKey like "html*") iOutputType =1
else if (sCustomKey like "pdf*") iOutputType =2
Parameters.SetAttributeInteger("OutputType", iOutputType)If the customization key is corresponding to HTML format, formatting XSLT is assigned accordingly.
// Option to specify formating XSLT that should be used
// Can be a file path or the title of a document in database
// if empty, user can choose XSLT from startup\\manufacturing\\documentation folder
if (sCustomKey like "html*")
{
let sFormatingXSLT(String)
sFormatingXSLT = ""
if (sCustomKey == "html_sample_complete") sFormatingXSLT ="NC_Documentation_Format.xslt"
else if (sCustomKey == "html_sample_brief") sFormatingXSLT ="NC_Documentation_Lists.xslt"
Parameters.SetAttributeString("FormatingXSLT", sFormatingXSLT)
}Path for Logo Image is defined
// Option to specifiy logo image to use in the NC documentation
// Can be a internet address or a file path
Parameters.SetAttributeString("LogoImage", "https://www.3ds.com/templates/images/_logo/logo_3DS_dassault.png")If the customization key is corresponding to PDF format, formatting XSLT is assigned accordingly. Also for custom formats second image can be added in document as custom image. For now, DELMIA logo is added as custom image.
if (sCustomKey like "pdf*")
{
// Option to specifiy 2nd logo image
let sDocumentationStartupDirectory(String)
sDocumentationStartupDirectory = Parameters.GetAttributeString("DocumentationStartupDirectory")
let sCustomlogo(String)
sCustomlogo = sDocumentationStartupDirectory + "\\CustomLogo.png"
Parameters.SetAttributeString("LogoImage2", sCustomlogo )Set ExternalCmdPath variable. For generation of PDF format we need pdf converter like Apache FOP. It can be downloaded from https://xmlgraphics.apache.org/fop/download.html.
Once downloaded, unzip it at required location.
Check the fop.bat file in the unzipped folder, this fop.bat is used to convert XML to PDF.
You can either add and modify environment variable below in ENV file :
NC_FOP_EXE: path of the fop.bat file used as external command name. Set value of unzipped fop.bat.
Or you can directly set value of sExternalCmdPath to the value of unzipped fop.bat as shown below.
<strong>Note: It is recommended to directly set the fop.bat file path value in business rule itself and not in environment variable as it is easier to manage it during platform updates.</strong>
<strong>If fop.bat file path is set in environment variable NC_FOP_EXE, when there is GA update for platform you need to set this environment variable again for new GA.</strong> // Custom post processing external command path
// Full path of executable to launch after output has been generated
let sExternalCmdPath(String)
//sExternalCmdPath = GetEnvVariableValue("NC_FOP_EXE")
<span class="cke-highlighted" style="background-color:#ffff00">sExternalCmdPath</span> = "D:\\work_dsi\\Projects\\DELMIA_IPS_Support\\WikiPages\\TechnicalDocumentation_EKL\\FOP\\fop-2.10-bin\\fop-2.10\\fop\\fop.bat"
Parameters.SetAttributeString("CustomCmdPath", sExternalCmdPath)
if (sExternalCmdPath == "") Notify("Environment variable 'NC_FOP_EXE' is not set. Please set it to the path of the fop.bat executable.")Assign name to the output NC Document.
// Custom Output File Path
// Name of the file generated via post processing
let sXmlFilePath(String)
sXmlFilePath = Parameters.GetAttributeString("XmlFilePath")
let sPdfFileName(String)
sPdfFileName = ThisObject.Name + ".pdf"
let sCustomOutputFilePath(String)
sCustomOutputFilePath = ReplaceSubText(sXmlFilePath,"data.xml",sPdfFileName)
Parameters.SetAttributeString("CustomOutputFilePath", sCustomOutputFilePath)Define correct XSLT files against customization key values.
// Custom Post Processing External Command Arguments
// Arguments to launch executable with given inputs
let sXsltDirectory(String)
sXsltDirectory = sDocumentationStartupDirectory + "\\PDF\\\\"
let sXSLTFilePath(String)
sXSLTFilePath = ""
if (sCustomKey like "pdf_sample_brief") sXSLTFilePath = sXsltDirectory + "PDF_Format_Sample.xsl"
else if (sCustomKey like "pdf_sample02_brief") sXSLTFilePath = sXsltDirectory + "PDF_SimpleSetupSheet.xslt"
else if (sCustomKey like "pdf_sample_intermediate") sXSLTFilePath = sXsltDirectory + "PDF_IntermediateSetupSheet.xslt"
else if (sCustomKey like "pdf_sample_complete") sXSLTFilePath = sXsltDirectory DF_CompleteSetupSheet.xslt"Provide argument string for external pdf converter Apache FOP.
let sExternalCmdArgs(String)
sExternalCmdArgs = " -xml " + "\\"" + sXmlFilePath +"\\""
sExternalCmdArgs = sExternalCmdArgs + " -xsl " + "\\"" + sXSLTFilePath +"\\""
sExternalCmdArgs = sExternalCmdArgs + " -pdf " + "\\"" + sCustomOutputFilePath +"\\""
Parameters.SetAttributeString("CustomCmdArgs", sExternalCmdArgs)
}2. Business Rule for Customizing NC Documentation Content: DELNCDocumentationAttributes
During NC Documentation generation, this business rule is used to retrieve attributes to expose in NC documentation for given Mfg object either mfg program or part operation. Also it is used to define the user input values in command UI as shown below.
Below script will explain how these contents are managed by the business rule.
General Guideline regarding input and output parameters
/* DELNCDocumentationAttributes_ID for given Mfg object
* BL script to retrieve attributes to expose in NC documentation for given Mfg object
* Input:
* RootObject : Given Mfg Object
* Output:
* Attributes_Name: List of attribute names
* Attributes_DisplayName : List of attribute alias (optional can be empty when name is same than alias)
* Attributes_Mode: String list (value can be “INTERACTIVE”, “CUSTOM” or “STD”).
* INTERACTIVE: let user define interactively the attribute value
* CUSTOM: attribute value is returned by the BL script
* STD : attribute value is retrieved from the model
* Attributes_Value: List of attribute values (insert NULL in case of STD).
* Image_format: List of lists defining the format of exposed image.
Each list contains two strings, one for the format attribute name and one for the format attribute value:
* width: picture width size (default is 640)
* height: picture height size (default is 480)
* active: to generate or not a picture (default is true)
* showPart: to display the part
* showStock: to display the stock
* showMfgProduct: to display the whole mfg product
* showMachine: to display the NC machine
* showAccessories: to display the NC accessories
* showIntermediateStock : to display the intermediate stock (when it is computed)
* showMachAxisSystem : to display the current machining axis system
*/Retrieve Root Object and define Interactive attributes for which user can enter value in UI
let OutAttribute_Mode(List)
let OutAttribute_Name(List)
let OutAttribute_Alias(List)
let OutAttribute_Value(List)
let OutFormat(List)
let RootMfgProgram (ManufacturingActivity)
set RootMfgProgram = Parameters.GetAttributeObject("RootObject")
// Doc title
OutAttribute_Mode.Append("INTERACTIVE")
OutAttribute_Name.Append("Title")
OutAttribute_Alias.Append(BuildMessageNLS("DELNCDocumentationAttributesNLS","Title"))
OutAttribute_Value.Append(RootMfgProgram.Name)
// Programmer Name
OutAttribute_Mode.Append("INTERACTIVE")
OutAttribute_Name.Append("Programmer")
OutAttribute_Alias.Append(BuildMessageNLS("DELNCDocumentationAttributesNLS","Programmer"))
OutAttribute_Value.Append(Parameters.UserID)
// Programmer Comment
OutAttribute_Mode.Append("INTERACTIVE")
OutAttribute_Name.Append("Comment")
OutAttribute_Alias.Append(BuildMessageNLS("DELNCDocumentationAttributesNLS","Comment"))
OutAttribute_Value.Append("")Define custom attributes for which value is computed in BL script
// Date
let now(Date)
let nowString(String)
set now = BuildDate()
set nowString = DateFormat("%d-%m-%y %H:%M:%S", now)
OutAttribute_Mode.Append("CUSTOM")
OutAttribute_Name.Append("ReportDate")
OutAttribute_Alias.Append(BuildMessageNLS("DELNCDocumentationAttributesNLS","ReportDate"))
OutAttribute_Value.Append(nowString)
// Manufacturing Cell name
let BehaviorRep (VPMRepReference)
set BehaviorRep = GetPLMOwner(RootMfgProgram)
if (NULL <> BehaviorRep)
{
let ManufCell (VPMReference)
set ManufCell = BehaviorRep.AggregatingReference
OutAttribute_Mode.Append("CUSTOM")
OutAttribute_Name.Append("ManufacturingCellName")
OutAttribute_Alias.Append(BuildMessageNLS("DELNCDocumentationAttributesNLS","ManufacturingCellName"))
OutAttribute_Value.Append(ManufCell.Name)
}Similarly more custom attributes can be added in document.
Now set image format for the image generated for mfg program. By default, only Manufacturing Product is visible in image but if the customization key is for intermediate file format, then accessories are also shown in generated image.
// Image Format
OutFormat.Append(List("showMfgProduct", true))
let sCustomKey(String)
sCustomKey = Parameters.GetAttributeString("CustomizationKey")
if (sCustomKey == "pdf_sample_intermediate") OutFormat.Append(List("showAccessories", 1))Set output
/* OUPUTS */
Parameters.SetAttributeObject("Attributes_Mode", OutAttribute_Mode)
Parameters.SetAttributeObject("Attributes_Name", OutAttribute_Name)
Parameters.SetAttributeObject("Attributes_DisplayName", OutAttribute_Alias)
Parameters.SetAttributeObject("Attributes_Value", OutAttribute_Value)
Parameters.SetAttributeObject("Image_format", OutFormat)Similarly individual BL scripts can be added to retrieve attributes to expose in NC documentation for Manufacturing operation, part operation, machine, tool assembly, tool, tool holder, insert and PP Instructions.
Note: All the generated data like images, output document, Data.XML etc. are stored in local folder at location shown in below image. There will be new folder created in C:\\Users\\<UserName>\\AppData\\Local\\Temp folder with name NcDocXXXXX. It is temparary folder and only available when the current session is open. Once the session is closed, this folder is deleted.Business Rule Setup
There are two Business Rules applicable for Generation of NC Documentation.
Customizing NC Documentation Options:
Business Rule opening Id - DELNCDocumentation_ID:
The Business Rule can be executed in two different ways.
DataSetup App: If you create the script through DataSetup, it remains persistent in the database, is stored on the server and available to all. The script opening ID will be available under Machining Business Logic.
CATRule/CATRuleExit: If you create the script using a CATRule, you must store the files
DELNCDocumentation.CATRuleandDELNCDocumentation.CATRuleExitin..\\resources\\knowledge\\scripts. You can then edit the CATRule file or create a new CATRule and CATRuleExit files with an Opening ID of DELNCDocumentation_ID.<strong>Note: </strong>The <strong>Opening ID</strong> cannot be changed. Be careful while using this method as the setup is done on local machine and it is not available to all users. Each user will have to do the setup individually.
Customizing NC Documentation Content:
Business Rule opening Id - DELNCDocumentationAttributes_ID:
The Business Rule can be executed in two different ways.
DataSetup App: If you create the script through DataSetup, it remains persistent in the database, is stored on the server and available to all. The script opening ID will be available under Machining Business Logic.
CATRule/CATRuleExit: If you create the script using a CATRule, you must store the files
DELNCDocAttributes_Header.CATRule,DELNCDocAttributes_Holder.CATRule,DELNCDocAttributes_Insert.CATRule,DELNCDocAttributes_Machine.CATRule,DELNCDocAttributes_ManufacturingOperation.CATRule,DELNCDocAttributes_PartOperation.CATRule,DELNCDocAttributes_PPInstruction.CATRule,DELNCDocAttributes_Tool.CATRule,DELNCDocAttributes_ToolAssembly.CATRuleandDELNCDocumentationAttributes.CATRuleExitin..\\resources\\knowledge\\scripts. You can then edit the CATRule file or create a new CATRule and CATRuleExit files with an Opening ID of DELNCDocumentationAttributes_ID.<strong>Note: </strong>The <strong>Opening ID</strong> cannot be changed. Be careful while using this method as the setup is done on local machine and it is not available to all users. Each user will have to do the setup individually.
How to Customize the Output NC Documentation
Business Rule Creation
Apache FOP Setup
Environment Variable Setup
How to Change CustomLogo Image
How to Add new User Input
Note: Similarly we can add more attributes in document which are not coming from user input by using OutAttribute_Mode.Append("CUSTOM") or OutAttribute_Mode.Append("STD") syntax.
Reference Data:
| Sr.No. | Customization Key Value | XSLT File Name (Documentation Folder*) | Sample Output File |
| 1 | html_sample_brief | NC_Documentation_Lists.xslt | |
| 2 | html_sample_complete | NC_Documentation_Format.xslt | |
| 3 | pdf_sample_brief | PDF_Format_Sample.xsl | |
| 4 | pdf_sample02_brief | PDF_SimpleSetupSheet.xslt | |
| 5 | pdf_sample_intermediate | PDF_IntermediateSetupSheet.xslt | |
| 6 | pdf_sample_complete | PDF_CompleteSetupSheet.xslt |
*Note : The Documentation folder is located in 3DExperience Platform Installation path.
For Example, C:\\Program Files\\Dassault Systemes\\B428_Cloud\\win_b64\\startup\\Manufacturing\\DocumentationReference
Author
Person of Contact - @Sheetal MARDE
Special Thanks to @Nicolas SPISS and @Grégory VANNESTE for providing support in this topic.
Feel free to reach out to me if you have any questions or need more details.
