.. _python_testMEDCouplingcorba1_solution:

Visualiser une instance de MEDCoupling dans ParaViS Ă  travers CORBA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::
	
	import MEDCoupling as mc
	from MEDCouplingCorba import MEDCouplingUMeshServant
	
	# Creating a mesh
	arr = mc.DataArrayDouble(11)
	arr.iota(0)
	m = mc.MEDCouplingCMesh() 
	m.setCoords(arr,arr) 
	m = m.buildUnstructured()
	
	# Making it available on the CORBA bus
	ref_m = MEDCouplingUMeshServant._this(m)
	import CORBA
	orb = CORBA.ORB_init()
	ior = orb.object_to_string(ref_m)
	print ior
	
	# Displaying it in ParaVis
	import salome
	salome.salome_init()
	print "About to import module 'pvsimple' ..."
	import pvsimple as pvs
	print "Module 'pvsimple' was imported!"
	
	# From here, we use the standard ParaView API:
	src1 = pvs.ParaMEDCorbaPluginSource()
	src1.IORCorba = ior	  # This is where we need the CORBA reference of the object created
	dr = pvs.Show(src1)