Introduction
Usage : rule to place automatically a stamping symbol on a sheet view based on a sheet criteria
allows to specify which symbol to used and where to place it in the sheet
Datasetup Resource Set :
- Diagram Resource
Datasetup Resource : Schematic_computeStampingPlacement
Rule Example 1
Description
the rule is looking to the Sheet description and insert the symbol with the same name
4 values supported : "France", "Diffusion", "Restricted", "NoRestriction"
symbol is placed horizontally at position around : sheet top middle
Pre-req
Define a logical References with one symbol per stamp.
Attach this logical reference in datasetup Diagram Resources / StampingSymbolSet
Rule
/* Compute Stamping Placement (Schematic_ComputeStampingPlacement) */
/* ThisObject : #In DIFSheet */
/* Parameters : #In RuleContext */
//Notify All Available Symbol Names
let InputSymbols(list)
set InputSymbols = Parameters.GetAttributeObject("Symbol_Names_In")
let symbolName(String)
for symbolName inside InputSymbols
{
Notify(symbolName)
}
//Declare the output Lists
let OutputSymbols(list)
let OutputSymbolsPosX(list)
let OutputSymbolsPosY(list)
let OutputSymbolsRotation(list)
let OutputSymbolsFlip(list)
let OutputSymbolsScale(list)
//Get The Sheet Properties and monitored attribute/attributes
let sSheetDescr(String)
set sSheetDescr = ThisObject.GetAttributeString("V_description")
let sheetWidth(Real)
let sheetHeight(Real)
sheetWidth = ThisObject.V_DIFFormatWidth
sheetHeight = ThisObject.V_DIFFormatHeight
//Keyword Found indicators
let France(Real)
let Diffusion(Real)
let Reserve(real)
let NonProtege(Real)
let Conf(Real)
let PropIntel(Real)
//Keyword search process
France = sSheetDescr.Search("France")
Diffusion = sSheetDescr.Search("Diffusion")
Reserve = sSheetDescr.Search("Restricted")
NonProtege = sSheetDescr.Search("NoRestriction")
if(France >= 0)
{
//Output symbol called StampingSymbolFrance is used twice for 2 instances
OutputSymbols.Append("StampingSymbolFrance")
OutputSymbolsPosX.Append((sheetWidth/2) -25)
OutputSymbolsPosY.Append(30)
OutputSymbolsRotation.Append(0)
OutputSymbolsFlip.Append(FALSE)
OutputSymbolsScale.Append(1)
OutputSymbols.Append("StampingSymbolFrance")
OutputSymbolsPosX.Append((sheetWidth/2) +50)
OutputSymbolsPosY.Append(sheetHeight - 40)
OutputSymbolsRotation.Append(0)
OutputSymbolsFlip.Append(FALSE)
OutputSymbolsScale.Append(1)
}
if(Diffusion >= 0)
{
OutputSymbols.Append("StampingSymbolDiffusion")
OutputSymbolsPosX.Append((sheetWidth/2) -25)
OutputSymbolsPosY.Append(sheetHeight - 20)
OutputSymbolsRotation.Append(0)
OutputSymbolsFlip.Append(FALSE)
OutputSymbolsScale.Append(1)
}
if(Reserve >= 0)
{
OutputSymbols.Append("StampingSymbolRestricted")
OutputSymbolsPosX.Append((sheetWidth/2)-100)
OutputSymbolsPosY.Append(sheetHeight - 40)
OutputSymbolsRotation.Append(0)
OutputSymbolsFlip.Append(FALSE)
OutputSymbolsScale.Append(1)
}
if(NonProtege >= 0)
{
OutputSymbols.Append("StampingSymbolNoRestriction")
OutputSymbolsPosX.Append((sheetWidth/2) -100)
OutputSymbolsPosY.Append(sheetHeight - 40)
OutputSymbolsRotation.Append(0)
OutputSymbolsFlip.Append(FALSE)
OutputSymbolsScale.Append(1)
}
//Set the outputs for the BR
Parameters.SetAttributeObject("Symbol_Names_Out", OutputSymbols)
Parameters.SetAttributeObject("Symbol_PositionX", OutputSymbolsPosX)
Parameters.SetAttributeObject("Symbol_PositionY", OutputSymbolsPosY)
Parameters.SetAttributeObject("Symbol_RotationAngle", OutputSymbolsRotation)
Parameters.SetAttributeObject("Is_Flip", OutputSymbolsFlip)
Parameters.SetAttributeObject("Symbol_Scale", OutputSymbolsScale)3DXML
