Defining an Attribute

You can create attributes characterized by a name and a type. In this example, you are going to create Inputs and Neutrals.

Note: Three types of Attributes are available:
  • Input attributes: They are supposed to be evaluated outside the Concept and used by the engine to evaluate the other attributes.
  • Output attributes: They are supposed to be evaluated by the engine during the instantiation and to be used by other Concept objects.
  • Neutral attributes: They are local to the current Concept and are not visible for other objects.
For Outputs and Neutrals it is possible to define a Formula that will be used to evaluate them. This formula is an EKL one-line expression. All Attributes can be linked to a parameter through a Path (relative to the Object of the current Concept). Thus, when the KML Object Attribute value is modified, the Parameter value is also modified. For literal types, it is also possible to define an enumeration of possible values using the "{ value1, value2, value3, ... }" syntax.
Attributes
{
         Inputs
         {
                 <AttributeType>  <AttributeName> [concrete <PathToPhysicalParameter> | { <values> }];
                 ...
          }
          Neutrals
          {
                 <AttributeType> <AttributeName> [= formula] [concrete <PathToConcreteParameter> | { <values> }];
                 ...
          }
          Outputs 
          {
                 <AttributeType> <AttributeName> [= formula] [concrete <PathToConcreteParameter> | { <values> }];
                 ...
           }
}


Before you begin: You have created a Concept called MyTable of BaseConcept type.
See Also
Defining Children
Creating a Concept
  1. In the Know-how Apps LogicEditor, key in the following script:
    Attributes
             {
                 Inputs
                 {
                         /* For the table to build itself some inputs are necessary */
                         Length tableHeight [80cm,120cm[;
                         Length footRadius;
                         /* The table geometry can only be Round or Rectangular */
                         String tableGeometry { "Round","Rectangular" };
                         VPMReference destination;
    
                 }
                 Neutrals
                 {
                         /* The neutrals attributes are used to store information that will not be 
                         accessible from outside the Concept */
                         VPMReference topReference = instantiatedTop.Reference;
                         VPMInstance instantiatedObject = new("VPMReference","MyTable",destination); 
                         /* Formulas can be used to compute values for attributes. */
                         VPMInstance instantiatedTop = new("VPMReference","MyTableTop",Object);
                  }
  2. Proceed to the next step: Defining Children.

To view an example, import the KMLSample.3dxml file located in win_b64\startup\Knowledgeware\KMLSamples\Sample1 in the installation folder.