The pure::variants standard transformation can be used to manipulate text files based on pvSCL conditions and calculations. To achieve this, the transformation and family model needs to be set up for transforming a text file, and the file needs to be annotated with pvSCL conditions and calculations.
For setting up the standard transformation, please refer to the section called “Setting up the Standard Transformation” . Now the text file to transform still needs to be referenced. This is done in the family model.Figure 6.74, “Family Model with ps:pvscltext transformation setup” shows an example family model referencing the input file "ConditionalPVSCLText.txt". To create the necessary family model elements, the easiest way is to use a wizard. To do this, add an element of classps:part to the family model and select "New"->"PVSCL Conditional Text" from the part's context menu. Please refer toSection 9.5.5, “ ps:pvscltext ” , for details about supported attributes.
Conditions and calculations are added to the text file as special
statements, such as
PVSCL:IFCOND(pvSCL condition)
or
PVSCL:EVAL(pvSCL
calculation)
. See
Section 9.5.5, “
ps:pvscltext
”
for a list of all statements
and a small example text document.
To edit conditions and calculations, use the actions "Add PVSCL
Condition"
(
), "Add PVSCL Calculation"
(
), and "Edit PVSCL
Condition/Calculation" (
), which are available in the toolbar. These actions give you the
same
support in writing pvSCL rules as already known from editing restrictions
or constraints.
For adding a condition to a section of your text, mark a section of
your text and
press
. Now a pvSCL editor
opens, in which you can write the pvSCL rule that should apply to this
text section (see
Figure 6.75, “Editing pvSCL conditions or calculations”
). For using auto-completion, syntax
highlighting, and error checks, the editor still needs to know the
pure::variants project,
in which context the written rule should be evaluated. Therefore,
select the context model
by pressing
. Only feature models
are allowed as context model. However, all other models of the same
and referenced
projects are considered automatically. After pressing "OK", the new
condition is wrapped
around the selected text.
Adding a calculation to your text works in a similar way. Press
and use the pvSCL editor to write your
rule. After closing the editor, the marked text is replaced with the
calculation.
To edit an existing condition or calculation, move the text
selection to a place
inside the calculation or condition and press
. For conditions, any place
between the beginning of
PVSCL:IFCOND(
and the beginning of
PVSCL:ENDCOND
is ok. For calculations, any place between the beginning of
PVSCL:EVAL(
and the closing
)
is accepted. If a condition or
calculation is found at your current text selection or caret position, the
pvSCL editor
opens, and you can edit your rule.