Skip to main content
added 44 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

Use the following script in QGIS Code Editor. It also works on nested rules. Select the layer before running the script.

layer = iface.activeLayer()
renderer = layer.renderer().clone()

def set_output_unit(rules):
    for rule in rules.children():
        rule.symbol().setOutputUnit(1) # 1: MapUnits    
        if rule.children():
            set_output_unit(rule)

rules = renderer.rootRule()
set_output_unit(rules)

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

Use the following script in QGIS Code Editor. It also works on nested rules.

layer = iface.activeLayer()
renderer = layer.renderer().clone()

def set_output_unit(rules):
    for rule in rules.children():
        rule.symbol().setOutputUnit(1) # 1: MapUnits    
        if rule.children():
            set_output_unit(rule)

rules = renderer.rootRule()
set_output_unit(rules)

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

Use the following script in QGIS Code Editor. It also works on nested rules. Select the layer before running the script.

layer = iface.activeLayer()
renderer = layer.renderer().clone()

def set_output_unit(rules):
    for rule in rules.children():
        rule.symbol().setOutputUnit(1) # 1: MapUnits    
        if rule.children():
            set_output_unit(rule)

rules = renderer.rootRule()
set_output_unit(rules)

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

added 164 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

Use the following script in QGIS Code Editor. It also works on nested rules.

layer = iface.activeLayer()
renderer = layer.renderer().clone()
rules =
def renderer.rootRule().childrenset_output_unit(rules)
 :
    for rule in rules.children():
        rule.symbol().setOutputUnit(1) # 1: MapUnits    
        if rule.children():
            set_output_unit(rule)

rules = renderer.rootRule()
set_output_unit(rules)

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

Use the following script in QGIS Code Editor.

layer = iface.activeLayer()
renderer = layer.renderer().clone()
rules = renderer.rootRule().children()
 
for rule in rules:
    rule.symbol().setOutputUnit(1) # 1: MapUnits

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

Use the following script in QGIS Code Editor. It also works on nested rules.

layer = iface.activeLayer()
renderer = layer.renderer().clone()

def set_output_unit(rules):
    for rule in rules.children():
        rule.symbol().setOutputUnit(1) # 1: MapUnits    
        if rule.children():
            set_output_unit(rule)

rules = renderer.rootRule()
set_output_unit(rules)

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

added 89 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

Use the following script in QGIS Code Editor.

layer = iface.activeLayer()
renderer = layer.renderer().clone()
rules = renderer.rootRule().children()

for rule in rules:
    rule.symbol().setOutputUnit(1) # 1: MapUnits

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

Use the following script in QGIS Code Editor.

layer = iface.activeLayer()
renderer = layer.renderer().clone()
rules = renderer.rootRule().children()

for rule in rules:
    rule.symbol().setOutputUnit(1) # 1: MapUnits

layer.setRenderer(renderer)
layer.triggerRepaint()

Use the following script in QGIS Code Editor.

layer = iface.activeLayer()
renderer = layer.renderer().clone()
rules = renderer.rootRule().children()

for rule in rules:
    rule.symbol().setOutputUnit(1) # 1: MapUnits

layer.setRenderer(renderer)
layer.triggerRepaint()

enter image description here

Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404
Loading