<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="Ubuntu">Hello,<br>
      <br>
      Have you tried this following code? Using  </font><font
      face="Ubuntu"><font face="Ubuntu"><font face="Ubuntu">iface.mapCanvas().mapTool().pointsZM()
          is good for me with any digitizing tool, while drawing.<br>
        </font></font></font><font face="Ubuntu"><font face="Ubuntu"><font
          face="Ubuntu"><font face="Ubuntu"><font face="Ubuntu"><br>
              <br>
              # Measurement object (adapt with crs/transform
              context/ellipsoid)<br>
              da = QgsDistanceArea()<br>
              da.setSourceCrs(QgsProject.instance().crs(),
              QgsProject.instance().transformContext())<br>
              # If distance measurement must use ellipsoid<br>
              da.setEllipsoid(QgsProject.instance().ellipsoid())<br>
              <br>
              # This is a demonstration function to adapt with your
              needs<br>
              def showArea(current_point):<br>
                  if not isinstance(iface.mapCanvas().mapTool(),
              QgsMapToolDigitizeFeature):<br>
                      return<br>
                      <br>
                  # Snapping<br>
                  snapped_point =
              iface.mapCanvas().snappingUtils().snapToMap(current_point).point()<br>
                  if not snapped_point.isEmpty():<br>
                      current_point = snapped_point<br>
                      <br>
                  # Coordinates of currently drawn points in map
              coordinates<br>
                  points = [QgsPointXY(point) for point in
              iface.mapCanvas().mapTool().pointsZM()]<br>
                  points.append(current_point)<br>
                  <br>
                  # Get area<br>
                  print(da.measurePolygon(points))<br>
              <br>
              # Must be handled correctly in the final code, but here is
              for testing<br>
              iface.mapCanvas().xyCoordinates.connect(</font><font
              face="Ubuntu"><font face="Ubuntu">showArea</font>)<br>
              <br>
              <br>
            </font></font><br>
        </font></font></font>
    <div class="moz-cite-prefix">Le 29/04/2023 à 01:45, Catania, Luke A
      ERDC-RDE-GRL-VA CIV via QGIS-Developer a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:d0ec9cbf412043d4968b1aaf6fa5ec5a@erdc.dren.mil">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">When you digitize a shape using the Edit
          menu in QGIS is the shape accessible?  I am looking to get he
          area of the shape as it is drawn.  I have added an event
          filter to my code to capture the coordinates and calculate it
          by creating a QgsGeometry, but my code is getting complicated
          as there are many shapes that a user can draw from this menu
          so if I can get access to this shape if it is temporary in
          memory, then I can just calculate the area on the shape and
          not have to capture all the positions of the mouse when
          clicked and moved.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><img style="width:3.0833in;height:1.6666in"
            id="Picture_x0020_1"
            src="cid:part1.zBXpditH.pqx40Mak@oslandia.com" class=""
            width="296" height="160"><o:p></o:p></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Jacky Volpes

Ingénieur SIG - Oslandia</pre>
  </body>
</html>