When I run the rotate tool in the Advanced Digitizing Toolbar it pops up a 
small window that allows you to change the snap to angle and show the angle the 
selected feature is rotated to.  Is there a way to get access to the angle 
through python?

        actions = iface.mainWindow().findChildren(QAction)
        self.action_rotate_feature = [x for x in actions if 
x.objectName()=='mActionRotateFeature'][0]

        self.placed_element_layer.selectAll()

        # Inititates rotate feature action allowing to select a snap to value.
        self.action_rotate_feature.trigger()

My problem is I call this tool on a layer where I programmatically select the 
features to rotate.  I can see they are all rotating but when I edit my session 
as below only one of the features gets unrotated somehow,  If I do not end the 
edit session as below and I allow the user to toggle editing off all the layers 
stay rotated until I exit QGIS and then QGIS unexpectedly ends.


        if self.element_rotated:
            self.placed_element_layer.commitChanges()
            self.placed_element_layer.endEditCommand()

I have posted the issue about features rotating and then some getting unrotated 
after the edit session was programmatically ended and the solution provided did 
not work and after replying I have not yet heard back from the person that 
helped.  So I though as a work around if I can get the angle from the rotate 
tool and run the processing tool processing.run("native:rotatefeatures") using 
that angle I can rotate the features in the layer using that tool.

Luke Catania
US Army ERDC-GRL
JCMS Site Planning Developer

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to