]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.tutorial/scl/Tutorial/2.06 (Exercise) Pipelines again.md
Merge "Fix to OrderedSetTemplate, preference for autocompletion"
[simantics/platform.git] / bundles / org.simantics.scl.tutorial / scl / Tutorial / 2.06 (Exercise) Pipelines again.md
1 ## Pipelines again\r
2 \r
3 In this exercise, we write points and pipes of a\r
4 diagram in the same format used earlier for reading.\r
5 \r
6 ### Step 1\r
7 \r
8 Use\r
9 \r
10 ::value[Simantics/DB/relativeResource]\r
11 \r
12 and \r
13 \r
14 ::value[Simantics/DB/currentModel]\r
15 \r
16 to define a variable `dia` that refers to some composite (configuration element\r
17 corresponding to a diagram). Create some content (points and pipes) to\r
18 the diagram.\r
19 \r
20 Print the value to the console and check that it corresponds to the\r
21 resource id given by the graph debugger.\r
22 \r
23 ### Step 2\r
24 \r
25 Import the ontology `http://www.simantics.org/Layer0-1.1` as `L0`.\r
26 \r
27 Use \r
28 \r
29 ::value[Simantics/DB/#]\r
30 \r
31 and `L0.ConsistsOf` to find all children of `dia`.\r
32 Print their names using\r
33 \r
34 ::value[Prelude/map, Simantics/DB/nameOf]\r
35 \r
36 ### Step 3\r
37 \r
38 Import the ontology `http://www.apros.fi/Combustion/Configuration-6.0` as `Conf`.\r
39 \r
40 Modify the commands in step 2 to find only the points (`Conf.ModuleTypes.POINT`) of the diagram. \r
41 \r
42 ### Step 4 \r
43 \r
44 Print the names and elevations of all points in `dia` using the function\r
45 \r
46 ::value[Simantics/DB/relatedValue]\r
47 \r
48 and the attribute `Conf.Relations.PO11_ELEV`.\r
49 \r
50 ### Step 5 \r
51 \r
52 Use the relation `http://www.simantics.org/Modeling-1.2/ElementToComponent`\r
53 and \r
54 \r
55 ::value[Simantics/DB/singleObject]\r
56 \r
57 to find the graphical symbol of the point.\r
58 \r
59 Use the relation `http://www.simantics.org/Diagram-2.2/HasTransform` and\r
60 \r
61 ::value[Simantics/DB/relatedValue]\r
62 \r
63 to read the transformation of the point. The last two elements of the transformation\r
64 are the coordinates of the point.\r
65 \r
66 ### Step 6\r
67 \r
68 Give an indices for all points you find for example using\r
69 \r
70 ::value[Prelude/range, Prelude/zip]\r
71 \r
72 ### Step 7\r
73 \r
74 Print the data about the points in the format described in\r
75 the previous pipelines exercise.\r
76 \r
77 ### Step 8\r
78 \r
79 Print the corresponding data about the pipes.