]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.tutorial/scl/Tutorial/2.06 (Exercise) Pipelines again.md
Import org.simantics.scl.tutorial from incubator SVN repo
[simantics/platform.git] / bundles / org.simantics.scl.tutorial / scl / Tutorial / 2.06 (Exercise) Pipelines again.md
diff --git a/bundles/org.simantics.scl.tutorial/scl/Tutorial/2.06 (Exercise) Pipelines again.md b/bundles/org.simantics.scl.tutorial/scl/Tutorial/2.06 (Exercise) Pipelines again.md
new file mode 100644 (file)
index 0000000..5bd4383
--- /dev/null
@@ -0,0 +1,79 @@
+## Pipelines again\r
+\r
+In this exercise, we write points and pipes of a\r
+diagram in the same format used earlier for reading.\r
+\r
+### Step 1\r
+\r
+Use\r
+\r
+::value[Simantics/DB/relativeResource]\r
+\r
+and \r
+\r
+::value[Simantics/DB/currentModel]\r
+\r
+to define a variable `dia` that refers to some composite (configuration element\r
+corresponding to a diagram). Create some content (points and pipes) to\r
+the diagram.\r
+\r
+Print the value to the console and check that it corresponds to the\r
+resource id given by the graph debugger.\r
+\r
+### Step 2\r
+\r
+Import the ontology `http://www.simantics.org/Layer0-1.1` as `L0`.\r
+\r
+Use \r
+\r
+::value[Simantics/DB/#]\r
+\r
+and `L0.ConsistsOf` to find all children of `dia`.\r
+Print their names using\r
+\r
+::value[Prelude/map, Simantics/DB/nameOf]\r
+\r
+### Step 3\r
+\r
+Import the ontology `http://www.apros.fi/Combustion/Configuration-6.0` as `Conf`.\r
+\r
+Modify the commands in step 2 to find only the points (`Conf.ModuleTypes.POINT`) of the diagram. \r
+\r
+### Step 4 \r
+\r
+Print the names and elevations of all points in `dia` using the function\r
+\r
+::value[Simantics/DB/relatedValue]\r
+\r
+and the attribute `Conf.Relations.PO11_ELEV`.\r
+\r
+### Step 5 \r
+\r
+Use the relation `http://www.simantics.org/Modeling-1.2/ElementToComponent`\r
+and \r
+\r
+::value[Simantics/DB/singleObject]\r
+\r
+to find the graphical symbol of the point.\r
+\r
+Use the relation `http://www.simantics.org/Diagram-2.2/HasTransform` and\r
+\r
+::value[Simantics/DB/relatedValue]\r
+\r
+to read the transformation of the point. The last two elements of the transformation\r
+are the coordinates of the point.\r
+\r
+### Step 6\r
+\r
+Give an indices for all points you find for example using\r
+\r
+::value[Prelude/range, Prelude/zip]\r
+\r
+### Step 7\r
+\r
+Print the data about the points in the format described in\r
+the previous pipelines exercise.\r
+\r
+### Step 8\r
+\r
+Print the corresponding data about the pipes.
\ No newline at end of file