X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fschemapy.rst;h=c4d4598ea859ebf6ed5c34321d6e2d6ac1f6a686;hb=9b44198b5b5bf3794b63693a778382952a187475;hp=8bf42ca15f57ddd2edc6fc497272fe29f4f44cf3;hpb=c81be9b5e74b26e207bd6efd0ccf68418ac536a3;p=modules%2Fyacs.git diff --git a/doc/schemapy.rst b/doc/schemapy.rst index 8bf42ca15..c4d4598ea 100644 --- a/doc/schemapy.rst +++ b/doc/schemapy.rst @@ -26,6 +26,20 @@ Before YACS modules can be imported, the environment must be correctly configure SALOME application is used. Otherwise, the PYTHONPATH environment variable has to be set to /lib/pythonX.Y/site-packages/salome. +When you build your own Salome application and use your own modules and components (using YACSGEN for example), you may need to load +the module catalog:: + + import SALOMERuntime + SALOMERuntime.RuntimeSALOME_setRuntime() + salome_runtime = SALOMERuntime.getSALOMERuntime() + import salome + salome.salome_init() + mc = salome.naming_service.Resolve('/Kernel/ModulCatalog') + ior = salome.orb.object_to_string(mc) + session_catalog = salome_runtime.loadCatalog("session", ior) + salome_runtime.addCatalog(session_catalog) + + .. _loadxml: Create a calculation scheme by loading an XML file @@ -332,22 +346,21 @@ Node n3 will be executed before node n4. Dataflow link ++++++++++++++++++++++++++++ -The first step in defining a dataflow link is to obtain port objects using one of the methods described above. -The edAddDFLink method for the context node is then used, transferring the two ports to be connected to it. -The following gives an example of a dataflow link between the output port p1 of node n3 and the input port of node n4:: +The first step in defining a dataflow link is to obtain port objects using one of the methods described above. +Then, the edAddLink method links an output port to an input port:: pout=n3.getOutputPort("p1") pin=n4.getInputPort("p1") - p.edAddDFLink(pout,pin) + p.edAddLink(pout,pin) -Data link -++++++++++++++++++++++++++++ -A data link is defined as being a dataflow link using the edAddLink method instead of edAddDFLink. -The same example as above with a data link:: +Most of the time, when you need a dataflow link between two ports, you also need a control link between the nodes +of the ports. In this case you can use the method edAddDFLink:: pout=n3.getOutputPort("p1") pin=n4.getInputPort("p1") - p.edAddLink(pout,pin) + p.edAddDFLink(pout,pin) + +edAddDFLink is equivalent to edAddCFLink followed by edAddLink. Initialising an input data port ''''''''''''''''''''''''''''''''''''''''''''''' @@ -383,6 +396,7 @@ will appear as follows:: r = pilot.getRuntime() p=r.createProc("pr") ti=p.getTypeCode("int") + td=p.getTypeCode("double") #node1 n1=r.createScriptNode("","node1") p.edAddChild(n1) @@ -406,11 +420,8 @@ will appear as follows:: p.edAddCFLink(n1,n2) p.edAddCFLink(n1,n4) #dataflow links - pout=n3.getOutputPort("p1") - pin=n4.getInputPort("p1") - #dataflow links - p.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1")) - p.edAddDFLink(n1.getOutputPort("p1"),n4.getInputPort("p1")) + p.edAddLink(n1.getOutputPort("p1"),n2.getInputPort("p1")) + p.edAddLink(n1.getOutputPort("p1"),n4.getInputPort("p1")) #initialisation ports n1.getInputPort("p1").edInitPy(5) @@ -440,7 +451,6 @@ Repeating a part of the example above, we will get:: n2.setScript("p1=2*p1") n2.edAddInputPort("p1",ti) n2.edAddOutputPort("p1",ti) - b.edAddCFLink(n1,n2) b.edAddDFLink(n1.getOutputPort("p1"),n2.getInputPort("p1")) .. _py_forloop: