[QGIS-Developer] QgsMeshLayer object has no attribute triangularMesh

Vincent Cloarec vcloarec at gmail.com
Tue Jun 30 14:23:38 PDT 2020


Hi,

The triangular mesh of mesh layer is not accessible from the python API,
only from the C++ API.

So for now, not possible to access directly to the triangular mesh from
Python. It is possible to acces ro the native from  the provider, but it
will not be in the map coordinates if different from the data :
https://qgis.org/pyqgis/master/core/QgsMeshDataSourceInterface.html#module-QgsMeshDataSourceInterface

Vincent

Le mar. 30 juin 2020 à 12:23, Jorge Almerio <jorgealmerio at yahoo.com.br> a
écrit :

> Hi devs,
>
>
>
> I still can not get the triangular mesh from a Mesh Layer using Qgis
> version 3.14.0-Pi.
>
> The triangularMesh() attribute is present in the API documentation
>
>
> https://qgis.org/api/classQgsMeshLayer.html#ae5d4ae367cfbd2abf6920d26701f0143.
>
>
> But I get an Error:
>
> AttributeError: 'QgsMeshLayer' object has no attribute 'triangularMesh'
>
>
>
>
>
> Is it possible to return the triangular mesh? I would like to use the
> triangular mesh for make an exact profile/cross section from the mesh using
> a polyline. The others plugins, like Crayfish and Profile tools does this
> profile using a defined interval offset, so it's accuracy depends on this
> interval.
>
>
>
> My code below returns
>
> AttributeError: 'QgsMeshLayer' object has no attribute 'triangularMesh'
>
> :
>
> proj = QgsProject.instance()
>
> mdtLyr = proj.mapLayersByName("RA04_Surface")[0]
>
> mdtLyr.updateTriangularMesh()
>
> triang = mdtLyr.triangularMesh()
>
>
>
> Best regards,
>
>
>
> Jorge Almerio
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200630/c43db3b9/attachment.html>


More information about the QGIS-Developer mailing list