Keyboard shortcut, View toolbar - Wireframe
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: Keyboard shortcut, View toolbar - Wireframe
Oh - thanks for reminding me to the "dailys". Now I've a 0.17 as well - great.
Anyway. The macro is running now - I set it to toggle between "Flat lines" and "wireframe", these are the views I'm using most.
But now - after once having used the macro, I no longer can use the ctrl-D ("view properties" or so) control - this one will no longer work. It needs a programme relaunch, then it does again.
So - this is not what at least I want. I'm mainly using wireframe for outer elements and leave the inner ones Flat lines, so I can clearly distinguish them, and if that possibility varnishes, I would rather not use that nice macro.
W
Anyway. The macro is running now - I set it to toggle between "Flat lines" and "wireframe", these are the views I'm using most.
But now - after once having used the macro, I no longer can use the ctrl-D ("view properties" or so) control - this one will no longer work. It needs a programme relaunch, then it does again.
So - this is not what at least I want. I'm mainly using wireframe for outer elements and leave the inner ones Flat lines, so I can clearly distinguish them, and if that possibility varnishes, I would rather not use that nice macro.
W
Re: Keyboard shortcut, View toolbar - Wireframe
You have access to all global draw style modes on the View toolbar. Therefore you don't have to restart FreeCAD at any point to change the mode. Based on your description you therefore need to toggle between 3 global modes:
P.S. But i do have a feeling you won't be happy with the macro until it supports changing object/global draw style modes.
Code: Select all
# ==============================
# 0 = "As is"
# 1 = "Flat lines"
# 2 = "Shaded
# 3 = "Wireframe"
# 4 = "Points"
styleA = 0
styleB = 1
styleC = 3
# ==============================
from PySide import QtGui
import FreeCADGui as Gui
mw = Gui.getMainWindow()
for i in mw.findChildren(QtGui.QToolBar):
if i.objectName() == "View":
for b in i.findChildren(QtGui.QToolButton):
if b.menu():
actionA = b.menu().actions()[styleA]
actionB = b.menu().actions()[styleB]
actionC = b.menu().actions()[styleC]
if actionA.isChecked():
actionB.trigger()
elif actionB.isChecked():
actionC.trigger()
else:
actionA.trigger()
else:
pass
else:
pass
Re: Keyboard shortcut, View toolbar - Wireframe
True.
And maybe you'll not be happy til you found a solution for this challenge...? (-;
W l
And maybe you'll not be happy til you found a solution for this challenge...? (-;
W l
Re: Keyboard shortcut, View toolbar - Wireframe
Well i was planning to do something else today and this macro challenge probably already exceeded the initial goal. As i went after compatibility with FreeCAD 0.16 (or older) and up therefore solution has some corner case scenarios when it won't work and it is not as future proof as it could be. Investing effort and building on that doesn’t make much sense. But i guess here we are and therefore:herrdeh wrote:True.
And maybe you'll not be happy til you found a solution for this challenge...? (-;
W l
Just selection:
Code: Select all
# ==============================
a = "Flat Lines"
b = "Shaded"
c = "Wireframe"
d = "Points"
styleA = a
styleB = c
# ==============================
s = FreeCADGui.Selection.getSelectionEx()
for i in s:
if i.Object.ViewObject.DisplayMode == styleA:
i.Object.ViewObject.DisplayMode = styleB
else:
i.Object.ViewObject.DisplayMode = styleA
Code: Select all
# triplus @ 2016
# Toggle object/global DisplayMode
# ==============================
# 0 = "As is"
# 1 = "Flat lines"
# 2 = "Shaded
# 3 = "Wireframe"
# 4 = "Points"
globalA = 0
globalB = 3
a = "Flat Lines"
b = "Shaded"
c = "Wireframe"
d = "Points"
objectA = a
objectB = c
# ==============================
from PySide import QtGui
import FreeCADGui as Gui
mw = Gui.getMainWindow()
s = FreeCADGui.Selection.getSelectionEx()
default = None
actionA = None
actionB = None
for i in mw.findChildren(QtGui.QToolBar):
if i.objectName() == "View":
for b in i.findChildren(QtGui.QToolButton):
if b.menu():
default = b.menu().actions()[0]
actionA = b.menu().actions()[globalA]
actionB = b.menu().actions()[globalB]
else:
pass
if s:
if default:
default.trigger()
else:
pass
for i in s:
if i.Object.ViewObject.DisplayMode == objectA:
i.Object.ViewObject.DisplayMode = objectB
else:
i.Object.ViewObject.DisplayMode = objectA
else:
if actionA and actionB:
if actionA.isChecked():
actionB.trigger()
else:
actionA.trigger()
else:
pass
Re: Keyboard shortcut, View toolbar - Wireframe
Great! - A big step forward. Most of the desired works.
One little thing remains, in 0.16 as well as 0.17.
Try to reproduce:
Keep going... (-;
W
One little thing remains, in 0.16 as well as 0.17.
Try to reproduce:
- deselect all
- trigger macro - e.g. everything to wireframe
- select one item
- trigger macro
=> several (not only the selected) items change their appearance. - from now everything works as desired
Keep going... (-;
W
Re: Keyboard shortcut, View toolbar - Wireframe
Nothing to fix here as when you deselected all objects you toggled global mode to Wireframe. If you want to toggle some or all objects to Wireframe mode and want to see that on the screen you need to select the objects first (macro will automatically adjust the global mode to As is).
Re: Keyboard shortcut, View toolbar - Wireframe
Hi
work fine thanks
mario
work fine thanks
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Keyboard shortcut, View toolbar - Wireframe
To reduce potential confusion i will gather all possible solutions we discussed here:
Toggle global display mode:
Toggle selected object(s) display mode (changes visible only in global As is (located on View toolbar) display mode):
Combination that toggle global display mode when nothing is selected and/or toggle selected objects display mode if objects are selected. When objects are selected global display mode is automatically set to As is:
Toggle global display mode:
Code: Select all
# triplus @ 2016
# Toggle global display mode
# ==============================
# 0 = "As is"
# 1 = "Flat lines"
# 2 = "Shaded
# 3 = "Wireframe"
# 4 = "Points"
styleA = 0
styleB = 3
# ==============================
from PySide import QtGui
import FreeCADGui as Gui
mw = Gui.getMainWindow()
for i in mw.findChildren(QtGui.QToolBar):
if i.objectName() == "View":
for b in i.findChildren(QtGui.QToolButton):
if b.menu():
actionA = b.menu().actions()[styleA]
actionB = b.menu().actions()[styleB]
if actionA.isChecked():
actionB.trigger()
else:
actionA.trigger()
else:
pass
else:
pass
Code: Select all
# triplus @ 2016
# Toggle selected object(s) display mode
# ==============================
a = "Flat Lines"
b = "Shaded"
c = "Wireframe"
d = "Points"
styleA = a
styleB = c
# ==============================
s = FreeCADGui.Selection.getSelectionEx()
for i in s:
if i.Object.ViewObject.DisplayMode == styleA:
i.Object.ViewObject.DisplayMode = styleB
else:
i.Object.ViewObject.DisplayMode = styleA
Code: Select all
# triplus @ 2016
# Toggle object/global display mode
# ==============================
# 0 = "As is"
# 1 = "Flat lines"
# 2 = "Shaded
# 3 = "Wireframe"
# 4 = "Points"
globalA = 0
globalB = 3
a = "Flat Lines"
b = "Shaded"
c = "Wireframe"
d = "Points"
objectA = a
objectB = c
# ==============================
from PySide import QtGui
import FreeCADGui as Gui
mw = Gui.getMainWindow()
s = FreeCADGui.Selection.getSelectionEx()
default = None
actionA = None
actionB = None
for i in mw.findChildren(QtGui.QToolBar):
if i.objectName() == "View":
for b in i.findChildren(QtGui.QToolButton):
if b.menu():
default = b.menu().actions()[0]
actionA = b.menu().actions()[globalA]
actionB = b.menu().actions()[globalB]
else:
pass
if s:
if default:
default.trigger()
else:
pass
for i in s:
if i.Object.ViewObject.DisplayMode == objectA:
i.Object.ViewObject.DisplayMode = objectB
else:
i.Object.ViewObject.DisplayMode = objectA
else:
if actionA and actionB:
if actionA.isChecked():
actionB.trigger()
else:
actionA.trigger()
else:
pass
Re: Keyboard shortcut, View toolbar - Wireframe
hi
work fine i use
mario
work fine i use
thanksCombination that toggle global display mode when nothing is selected and/or toggle selected objects display mode if objects are selected. When objects are selected global display mode is automatically set to As is:
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Keyboard shortcut, View toolbar - Wireframe
Good to hear that and you're welcome.